@libxai/board 1.5.89 → 1.5.90
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 +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Hf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),ny=require('react-markdown'),sy=require('remark-gfm'),iy=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Hf__default=/*#__PURE__*/_interopDefault(Hf);var ny__default=/*#__PURE__*/_interopDefault(ny);var sy__default=/*#__PURE__*/_interopDefault(sy);var iy__default=/*#__PURE__*/_interopDefault(iy);var Ks=(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 qs=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 [qs.Translate.toString(e),qs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ys(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 If(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function vl(e,t){return e.length===0?1e3:t===0?Ys(null,e[0].position):t>=e.length?Ys(e[e.length-1].position,null):Ys(e[t-1].position,e[t].position)}function su(e,t=100){return e>t}var Bf=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 Rf(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 Xs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Bf,onRetry:l}=t,c,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:i,success:false};let g=Rf(p,r,o,s);if(l)try{l(c,p,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Of(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 $f(e,t={}){return async(...a)=>Xs(()=>e(...a),t)}var wl=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 iu=(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))(iu||{}),
|
|
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'),Hf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),ny=require('react-markdown'),sy=require('remark-gfm'),iy=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Hf__default=/*#__PURE__*/_interopDefault(Hf);var ny__default=/*#__PURE__*/_interopDefault(ny);var sy__default=/*#__PURE__*/_interopDefault(sy);var iy__default=/*#__PURE__*/_interopDefault(iy);var Ks=(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 qs=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 [qs.Translate.toString(e),qs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ys(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 If(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function vl(e,t){return e.length===0?1e3:t===0?Ys(null,e[0].position):t>=e.length?Ys(e[e.length-1].position,null):Ys(e[t-1].position,e[t].position)}function su(e,t=100){return e>t}var Bf=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 Rf(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 Xs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Bf,onRetry:l}=t,c,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:i,success:false};let g=Rf(p,r,o,s);if(l)try{l(c,p,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Of(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 $f(e,t={}){return async(...a)=>Xs(()=>e(...a),t)}var wl=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 iu=(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))(iu||{}),Jo=class Jo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Jo.globalOptions};}static configure(t){Jo.globalOptions={...Jo.globalOptions,...t};}child(t){return new Jo({...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 Js((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Js(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:iu[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Jo.globalOptions={};var kl=Jo,Js=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}},lu=new kl;function zf(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 Uf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,Cl(s.title),Cl(s.description||""),Cl(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
2
|
`)}async function Wf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Hf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,p=n.width/n.height,d=c-20,m=d/p;m>i-20&&(m=i-20,d=m*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(l,"PNG",y,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Cl(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function cu(e,t,a,r){switch(t){case "json":return zf(e,r);case "csv":return Uf(e);case "pdf":return await Wf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function uu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Vf(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 Gf(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=pu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=pu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function pu(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function mu(e,t){switch(t){case "json":return Vf(e);case "csv":return Gf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function gu(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 Tl=react.createContext(null);function fu(){return react.useContext(Tl)}var bu=react.createContext(null);function hu({children:e,themeName:t}){return jsxRuntime.jsx(bu.Provider,{value:{themeName:t},children:e})}function wn(){return react.useContext(bu)}function Zt({children:e,container:t}){let[a,r]=react.useState(false),o=fu(),s=wn();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var ku={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Qf="#BDC3C7",Zf=({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 Jo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let C=y-g.bottom,S=g.top,E;C>=f+b?E=g.bottom+b:S>=f+b?E=g.top-f-b:E=C>=S?g.bottom+b:Math.max(10,g.top-f-b),n({top:E,left:w}),o(true);};react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?ku[e]:null,m=d?.color||Qf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(ku).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color: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(Zf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var eb=[{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 ts({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(wn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),C=window.innerHeight,S=window.innerWidth,E=320,k=380,v=4,P=w.left;P+E>S-10&&(P=S-E-10),P<10&&(P=10);let L=C-w.bottom,M=w.top,J;L>=k+v?J=w.bottom+v:M>=k+v?J=w.top-k-v:J=L>=M?w.bottom+v:Math.max(10,w.top-k-v),l({top:J,left:P}),s(true);};react.useEffect(()=>{let w=C=>{c.current&&!c.current.contains(C.target)&&!i.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let C=new Date,S=P=>{let L=P.getFullYear(),M=String(P.getMonth()+1).padStart(2,"0"),J=String(P.getDate()).padStart(2,"0");return `${L}-${M}-${J}`},E=S(C),k=new Date(C);k.setDate(k.getDate()+w);let v=S(k);a(E,v),s(false);},x=()=>{if(!e||!t)return "Set date";let w=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=k.split("-").map(Number);if(v.length!==3||v.some(J=>isNaN(J)))return null;let P=v[0],L=v[1],M=v[2];return P===void 0||L===void 0||M===void 0?null:new Date(P,L-1,M)},C=w(e),S=w(t);if(!C||!S||isNaN(C.getTime())||isNaN(S.getTime()))return "Set date";let E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${E[C.getMonth()]} ${C.getDate()} \u2013 ${E[S.getMonth()]} ${S.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),w<C})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:eb.map(w=>jsxRuntime.jsx("button",{onClick:()=>y(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Zo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,S=300,E=380,k=4,v=b.right-S;v<10&&(v=b.left),v+S>C-10&&(v=C-S-10);let P=w-b.bottom,L=b.top,M;P>=E+k?M=b.bottom+k:L>=E+k?M=b.top-E-k:M=P>=L?b.bottom+k:Math.max(10,b.top-E-k),p({top:M,left:v}),n(true);};react.useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(C=>C.id===b.id);a(w?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.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)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:b=>c(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:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let w=e.some(C=>C.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(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 truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Qs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function rs({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),f=react.useRef(null),b=react.useRef(null),w=()=>{if(!b.current)return;let v=b.current.getBoundingClientRect(),P=window.innerHeight,L=window.innerWidth,M=300,J=d?380:120,H=4,Y=v.right-M;Y<10&&(Y=v.left),Y+M>L-10&&(Y=L-M-10);let T=P-v.bottom,G=v.top,te;T>=J+H?te=v.bottom+H:G>=J+H?te=v.top-J-H:te=T>=G?v.bottom+H:Math.max(10,v.top-J-H),y({top:te,left:Y}),c(true);};react.useEffect(()=>{if(!l||!b.current)return;let v=b.current.getBoundingClientRect(),P=window.innerHeight,L=window.innerWidth,M=300,J=d?380:120,H=4,Y=v.right-M;Y<10&&(Y=v.left),Y+M>L-10&&(Y=L-M-10);let T=P-v.bottom,G=v.top,te;T>=J+H?te=v.bottom+H:G>=J+H?te=v.top-J-H:te=T>=G?v.bottom+H:Math.max(10,v.top-J-H),y({top:te,left:Y});},[d,l]),react.useEffect(()=>{let v=P=>{f.current&&!f.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),react.useEffect(()=>{let v=P=>{P.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]);let C=v=>{let P=t.includes(v),L=a.find(M=>M.id===v);if(h(null),P){let M=t.filter(J=>J!==v);r(M),M.length===0&&m(false);}else {if(s&&Qs(a,v,e)){let J=`Cannot add "${L?.title||v}" as dependency - would create circular reference`;h(J),n?.(v,L?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),m(true);}},S=()=>{let v=!d;m(v),v||r([]);},E=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>l?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),l&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:S,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>p(v.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:E.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"}):E.map(v=>{let P=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>C(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:L=>{L.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:L=>{L.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:P?"#3b82f6":"transparent",borderColor:P?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:P&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var go=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:qs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=l.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:C=>{C.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,S)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:E=>{E.currentTarget.style.display="none";}}),S===3&&b.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",b.length-4]})})]},C.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Jo,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(ts,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(C,S)=>n?.(e.id,{startDate:C,endDate:S})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Zo,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(S=>S.id)})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(rs,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsxRuntime.jsx("span",{className:"asakaa-label",children:C},C))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));go.displayName="Card";var Zs={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"}},Au=({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 Lu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=[...Object.entries(Zs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Zs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Zs[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Zs.todo,id:"todo"}},m=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,C=280,S=4,E=h.right-w;E<10&&(E=h.left),E+w>b-10&&(E=b-w-10);let k=f-h.bottom,v=h.top,P;k>=C+S?P=h.bottom+S:v>=C+S?P=h.top-C-S:P=k>=v?h.bottom+S:Math.max(10,h.top-C-S),l({top:P,left:E}),s(true);};react.useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsxRuntime.jsx(Au,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.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:h.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(Au,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Iu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Bu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Iu[s]||Iu.en,[l,c]=react.useState(false),[i,p]=react.useState(false),[d,m]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let S=h.current.getBoundingClientRect();y({top:S.bottom+window.scrollY+8,left:S.left+window.scrollX});}},[l]),react.useEffect(()=>{let S=E=>{x.current&&!x.current.contains(E.target)&&!h.current?.contains(E.target)&&(c(false),p(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),react.useEffect(()=>{let S=E=>{E.key==="Escape"&&(c(false),p(false),m(e));};if(l)return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{p(true),m(e);},w=()=>{let S=d.trim();S&&S!==e&&t(S),p(false),c(false),m(e);},C=S=>{S.key==="Enter"?w():S.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:S=>m(S.target.value),onKeyDown:C,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var Tn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:C,isOver:S}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),E=react.useRef(null),k=p??su(t.length),v=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>E.current,estimateSize:()=>d,enabled:k});if(a)return jsxRuntime.jsx("div",{ref:C,className:f,children:a(e,t)});let L=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),M=L.state==="exceeded",J=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:C,className:u("asakaa-column",S&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(J()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&L.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${L.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[L.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"})]}),L.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"})]}),L.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"})}),L.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"})]})]}),(y||x)&&jsxRuntime.jsx(Bu,{columnTitle:e.title,onRename:H=>y?.(e.id,H),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!m&&jsxRuntime.jsx("div",{ref:E,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(H=>H.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"})}):k?jsxRuntime.jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative"},children:v.getVirtualItems().map(H=>{let Y=t[H.index];return Y?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsxRuntime.jsx(go,{card:Y,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},Y.id):null})}):t.map(H=>jsxRuntime.jsx(go,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},H.id))})})]})});Tn.displayName="Column";function Ml({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function vb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Uu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function wb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function kb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Cb=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Wu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=react.useState(false),[w,C]=react.useState([]),[S,E]=react.useState(0),[k,v]=react.useState(null),[P,L]=react.useState(false),M=react.useRef(null),J=react.useRef(null),H=react.useRef(null),Y=react.useRef(null),T=react.useCallback(($,ee)=>{let le=vb($,ee);if(v(le),le){let ke=r.filter(xe=>xe.name.toLowerCase().includes(le.query)||xe.email&&xe.email.toLowerCase().includes(le.query)).slice(0,5);C(ke),b(ke.length>0),E(0);}else b(false),C([]);},[r]),G=$=>{let ee=$.target.value;if(t(ee),T(ee,$.target.selectionStart||0),M.current){M.current.style.height="24px";let le=M.current.scrollHeight,ke=280,xe=Math.min(le,ke);M.current.style.height=`${xe}px`,M.current.style.overflowY=le>ke?"auto":"hidden";}},te=()=>{M.current&&T(e,M.current.selectionStart||0);},Le=react.useCallback($=>{if(!k||!M.current)return;let ee=e.slice(0,k.start),le=e.slice(k.end),ke=`@${$.name.replace(/\s+/g,"")} `,xe=ee+ke+le;t(xe),b(false),v(null),setTimeout(()=>{if(M.current){let Be=k.start+ke.length;M.current.selectionStart=Be,M.current.selectionEnd=Be,M.current.focus();}},0);},[k,e,t]),B=$=>{if(f&&w.length>0)switch($.key){case "ArrowDown":$.preventDefault(),E(ee=>ee<w.length-1?ee+1:0);break;case "ArrowUp":$.preventDefault(),E(ee=>ee>0?ee-1:w.length-1);break;case "Enter":{$.preventDefault();let ee=w[S];ee&&Le(ee);break}case "Tab":{$.preventDefault();let ee=w[S];ee&&Le(ee);break}case "Escape":$.preventDefault(),b(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};react.useEffect(()=>{let $=ee=>{J.current&&!J.current.contains(ee.target)&&M.current&&!M.current.contains(ee.target)&&b(false),Y.current&&!Y.current.contains(ee.target)&&L(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let q=react.useCallback($=>{if(!M.current)return;let ee=M.current.selectionStart||e.length,le=e.slice(0,ee)+$+e.slice(ee);t(le),L(false),setTimeout(()=>{if(M.current){let ke=ee+$.length;M.current.selectionStart=ke,M.current.selectionEnd=ke,M.current.focus();}},0);},[e,t]),be=react.useCallback($=>{if(!g||!$.target.files)return;let ee=Array.from($.target.files),le=x*1024*1024,ke=ee.filter(xe=>xe.size>le?(console.warn(`File ${xe.name} exceeds max size of ${x}MB`),false):true);ke.length>0&&g(ke),$.target.value="";},[g,x]),_e=react.useCallback($=>$.type.startsWith("image/")?lucideReact.Image:$.type.includes("pdf")||$.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&J.current){let $=J.current.children[S];$&&$.scrollIntoView({block:"nearest"});}},[S,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map($=>{let ee=_e($.file),le=$.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[le&&$.preview?jsxRuntime.jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ee,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:$.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:kb($.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y($.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},$.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(!P),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Cb.map($=>jsxRuntime.jsx("button",{type:"button",onClick:()=>q($),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:be,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:M,value:e,onChange:G,onSelect:te,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map(($,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Le($),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ee===S?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:$.color||"#8B5CF6"},children:wb($.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:$.name}),$.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function Vu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var oi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Po({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(false),[g,y]=react.useState(oi[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),f=react.useRef(null),b=react.useRef(null),w=react.useRef(null),C=react.useRef(null),S=t.filter(M=>M.name.toLowerCase().includes(i.toLowerCase())),E=t.some(M=>M.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&b.current){let M=b.current.getBoundingClientRect();h({top:M.bottom+6,left:M.left});}},[l]),react.useEffect(()=>{let M=J=>{let H=J.target,Y=f.current?.contains(H),T=w.current?.contains(H);!Y&&!T&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[l]),react.useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=M=>{let J=e.some(H=>H.id===M.id);a(J?e.filter(H=>H.id!==M.id):[...e,M]);},v=async()=>{if(!(!r||!i.trim())){m(true);try{let M=await r(i.trim(),g);M&&(a([...e,M]),p(""),y(oi[Math.floor(Math.random()*oi.length)]||"#2E94FF"));}finally{m(false);}}},P=(M,J)=>{J.stopPropagation(),a(e.filter(H=>H.id!==M));},L={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:L,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${M.color}20`,color:M.color},children:M.name},M.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:M=>p(M.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:M=>{M.key==="Enter"&&i.trim()&&!E&&r&&v();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(M=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${M.color}20`,color:M.color},onClick:J=>P(M.id,J),children:[M.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},M.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:S.length>0?S.map(M=>{let J=e.some(H=>H.id===M.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(M),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:J?`${M.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{J||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{J||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:M.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:M.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:M.color}})]},M.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!E&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:oi.map(M=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(M),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:M,outline:g===M?`2px solid ${M}`:"none",outlineOffset:"2px"}},M))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Pl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function ju({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Pl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var tn=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function _u(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Ab(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Lb({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Al({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Ab(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=_u(e.loggedMinutes),i=e.estimateMinutes?_u(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Lb,{className:l[t]}),jsxRuntime.jsx("span",{children:p})]})}function Ib(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function si(e){let t=Ib(e);return t!==null?String(t):e}function qu(e){let a=si(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ii(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Ob(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function $b({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Hb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Yu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function zb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Ll({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?ii(t.estimateMinutes):""),[h,f]=react.useState(""),[b,w]=react.useState(false),[C,S]=react.useState(false),E=react.useRef(null);react.useEffect(()=>{E.current?.focus();},[]);let k=async()=>{let L=qu(m);if(!(L<=0||!s)){w(true);try{await s({durationMinutes:L,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},v=async()=>{if(!n)return;let L=y.trim()?qu(y):null;await n(L),S(false);},P=L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),k()),L.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Yu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Ob(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Hb,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Yu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx($b,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(zb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:E,type:"text",value:m,onChange:L=>g(L.target.value),onKeyDown:P,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:k,disabled:b||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:L=>f(L.target.value),onKeyDown:P,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ii(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),C?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:L=>x(L.target.value),onKeyDown:L=>{L.key==="Enter"&&v(),L.key==="Escape"&&S(false);},onBlur:v,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>S(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ii(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(L=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:L.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:ii(L.durationMinutes)})]},L.id))})]})]})}function jb(e){let a=si(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function _b(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function oo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(_b(r)),[i,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let w=jb(l);await o(w&&w>0?w:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:l,onChange:w=>c(w.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>p(w.target.value),onKeyDown:h,placeholder:b?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:y,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:b?"Quitar":"Clear"})]})]})}function Kb(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function qb(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Bl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Kb(e.health),s=qb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Nn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Xb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Jb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Qb(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Zb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Nn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Nn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Nn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function eh({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Nn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Nn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Nn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Jb(e.status,a),Xb(e.status,a)),children:Qb(e.status,t)})})]})}function Rl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Zb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",i),children:g.map(y=>jsxRuntime.jsx(eh,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Dn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function gh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function np(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function fh(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:C,timeEntries:S=[],isTimerRunning:E=false,timerElapsedSeconds:k=0,onTimeLog:v,onEstimateUpdate:P,onSoldEffortUpdate:L,onTimerStart:M,onTimerStop:J,onTimerDiscard:H,blurFinancials:Y=false}){let T=s==="dark",G={textTertiary:T?"#6B7280":"#9CA3AF",textSecondary:T?"#9CA3AF":"#6B7280",textPrimary:T?"#FFFFFF":"#111827",borderLight:T?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:T?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:T?"#1A1D25":"#FFFFFF",bgSecondary:T?"#0A0A0A":"#F9FAFB",hoverBg:T?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},te=e&&"title"in e&&!("name"in e),Le=e,[B,q]=react.useState(e?np(e,l):null),[be,_e]=react.useState(false),[$,ee]=react.useState(false),[le,ke]=react.useState(false),[xe,Be]=react.useState(null),[He,at]=react.useState(new Date),[ue,je]=react.useState(false),[Xe,he]=react.useState(false),[kt,xt]=react.useState(""),[nt,ze]=react.useState(false),[ct,et]=react.useState(false),[Ee,V]=react.useState(false),[D,U]=react.useState(false),[ae,Ne]=react.useState(""),z=react.useRef(null),oe=react.useRef(null),[Ge,ge]=react.useState(""),Ve=react.useRef(null),[Oe,Ue]=react.useState(""),[lt,ot]=react.useState(false),[st,pt]=react.useState([]),[Tt,Ot]=react.useState(""),[St,Et]=react.useState(false),Ft=react.useRef(null);react.useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let N=np(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:N?.id,taskName:N?.name,soldEffortMinutes:N?.soldEffortMinutes,quotedMinutes:N?.quotedMinutes,effortMinutes:N?.effortMinutes,timeLoggedMinutes:N?.timeLoggedMinutes}),q(N),Ne(N.description||""),ge(N.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ae)return;let N=setTimeout(()=>{let K=oe.current;K&&(K.style.height="auto",K.style.height=`${Math.max(100,K.scrollHeight)}px`);},50);return ()=>clearTimeout(N)},[t,ae]),react.useEffect(()=>()=>{z.current&&clearTimeout(z.current),Ve.current&&clearTimeout(Ve.current);},[]),react.useEffect(()=>{t&&Ft.current&&y.length>0&&setTimeout(()=>{Ft.current&&(Ft.current.scrollTop=Ft.current.scrollHeight);},100);},[t,y.length]);let mt=react.useCallback(N=>{q(N),te&&o&&Le?o(fh(N,Le)):r&&r(N);},[te,Le,o,r]),Vt=react.useCallback(()=>{_e(false),ee(false),ke(false),Be(null),he(false),xt(""),ze(false);},[]),ht=react.useCallback((N,K)=>{if(!B)return;let Te={...B,[N]:K};mt(Te);},[B,mt]),it=react.useCallback(()=>{let N=oe.current;N&&(N.style.height="auto",N.style.height=`${Math.max(100,N.scrollHeight)}px`);},[]),ne=react.useCallback(N=>{Ne(N),setTimeout(it,0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{if(B){let K={...B,description:N};mt(K);}},800);},[B,mt,it]),pe=react.useCallback(N=>{ge(N),Ve.current&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{if(B&&N.trim()){let K={...B,name:N.trim()};mt(K);}},800);},[B,mt]),O=react.useCallback(N=>{let K=N.map(Te=>{let Pe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Te};return Te.type.startsWith("image/")&&(Pe.preview=URL.createObjectURL(Te)),Pe});pt(Te=>[...Te,...K]);},[]),_=react.useCallback(N=>{pt(K=>{let Te=K.find(Pe=>Pe.id===N);return Te?.preview&&URL.revokeObjectURL(Te.preview),K.filter(Pe=>Pe.id!==N)});},[]),De=react.useCallback(async()=>{if(!(!B||!Oe.trim()&&st.length===0||!x)){ot(true);try{let N=Uu(Oe,f),K=[];if(st.length>0&&b){let Te=st.map(Pe=>Pe.file);K=await b(Te);}await x(B.id,Oe.trim(),N.length>0?N:void 0,K.length>0?K:void 0),Ue(""),st.forEach(Te=>{Te.preview&&URL.revokeObjectURL(Te.preview);}),pt([]);}finally{ot(false);}}},[B,Oe,st,x,f,b]),Qe=react.useCallback(()=>{if(!B||!Tt.trim())return;let N=B.subtasks||[],K={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Tt.trim(),progress:0,startDate:new Date,endDate:new Date,position:N.length},Te=[...N,K],Pe={...B,subtasks:Te};mt(Pe),Ot(""),Et(false);},[B,Tt,mt]),bt=react.useCallback(N=>{if(!B?.subtasks)return;let K=B.subtasks.map(Pe=>Pe.id===N?{...Pe,progress:Pe.progress===100?0:100}:Pe),Te={...B,subtasks:K};mt(Te);},[B,mt]),Dt=react.useCallback(N=>{if(!B?.subtasks)return;let K=B.subtasks.filter(Pe=>Pe.id!==N),Te={...B,subtasks:K};mt(Te);},[B,mt]),Pt=react.useCallback(N=>{let K=typeof N=="string"?new Date(N):N,Pe=new Date().getTime()-K.getTime(),$t=Math.floor(Pe/6e4),Ct=Math.floor(Pe/36e5),Jt=Math.floor(Pe/864e5);return $t<1?n==="es"?"Ahora":"Just now":$t<60?n==="es"?`Hace ${$t} min`:`${$t}m ago`:Ct<24?n==="es"?`Hace ${Ct}h`:`${Ct}h ago`:Jt<7?n==="es"?`Hace ${Jt}d`:`${Jt}d ago`:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),At=react.useCallback(N=>{if(!B)return;let K=B.progress||0;N==="completed"?K=100:N==="in-progress"&&K===0?K=10:N==="todo"&&(K=0);let Te={...B,status:N,progress:K};mt(Te),_e(false);},[B,mt]),ta=react.useCallback((N,K)=>{if(!B)return;let Te={...B,startDate:N,endDate:K};mt(Te);},[B,mt]),la=react.useCallback(()=>{let N=He.getFullYear(),K=He.getMonth(),Te=new Date(N,K,1),$t=new Date(N,K+1,0).getDate(),Ct=Te.getDay(),Jt=[],Wa=new Date(N,K,0).getDate();for(let wa=Ct-1;wa>=0;wa--)Jt.push({date:new Date(N,K-1,Wa-wa),isCurrentMonth:false});for(let wa=1;wa<=$t;wa++)Jt.push({date:new Date(N,K,wa),isCurrentMonth:true});let ha=42-Jt.length;for(let wa=1;wa<=ha;wa++)Jt.push({date:new Date(N,K+1,wa),isCurrentMonth:false});return Jt},[He]),Q=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),V(false),!B||!d)return;let K=Array.from(N.dataTransfer.files);if(K.length!==0){U(true);try{await d(B.id,K);}finally{U(false);}}},[B,d]),$e=react.useCallback(async N=>{if(!B||!d||!N.target.files)return;let K=Array.from(N.target.files);if(K.length!==0){U(true);try{await d(B.id,K);}finally{U(false);}N.target.value="";}},[B,d]),Fe=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),V(true);},[]),I=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),V(false);},[]),ye=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),Z=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",T?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",T?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",T?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=B.progress===100?0:100,Te={...B,progress:N,status:N===100?"completed":"todo"};mt(Te);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":T?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ge,onChange:N=>pe(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":T?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Vt(),_e(!be);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":T?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:be&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>At(N.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",B.status===N.id&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:T?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),ke(!le);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((N,K)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},K)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",T?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",T?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ke(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(N=>{let K=B.assignees?.some(Te=>Te.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=B.assignees||[],Pe;K?Pe=Te.filter($t=>$t.name!==N.name):Pe=[...Te,N],ht("assignees",Pe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",K&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",T?"text-white":"text-gray-900"),children:N.name}),K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Be(xe?null:"start"),at(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",T?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",T?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let Te=new Date(N);Te.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Pe=new Date(N);Pe.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let $t=new Date(N);$t.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Ct=new Date(N);Ct.setDate(N.getDate()+14);let Jt=new Date(N);return Jt.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$t,display:$t.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ct,display:Ct.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Jt,display:Jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ha,wa)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",T?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(xe==="start"){let lr=B.endDate&&ha.date>B.endDate?ha.date:B.endDate;ta(ha.date,lr),Be("end");}else {let lr=B.startDate&&ha.date<B.startDate?ha.date:B.startDate;ta(lr,ha.date),Be(null);}},children:[jsxRuntime.jsx("span",{children:ha.label}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:ha.display})]},wa))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ta(void 0,void 0),Be(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",T?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",T?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:xe==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",T?"text-white":"text-gray-900"),children:He.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:u("p-1 rounded text-sm transition-colors",T?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(He.getFullYear(),He.getMonth()-1)),className:u("p-1 rounded",T?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(He.getFullYear(),He.getMonth()+1)),className:u("p-1 rounded",T?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",T?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:la().map((N,K)=>{let Te=N.date.toDateString()===new Date().toDateString(),Pe=B.startDate?.toDateString()===N.date.toDateString(),$t=B.endDate?.toDateString()===N.date.toDateString(),Ct=Pe||$t,Jt=B.startDate&&B.endDate&&N.date>=B.startDate&&N.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Wa=new Date(N.date);if(xe==="start"){let ha=B.endDate&&Wa>B.endDate?Wa:B.endDate;ta(Wa,ha),Be("end");}else {let ha=B.startDate&&Wa<B.startDate?Wa:B.startDate;ta(ha,Wa),Be(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(T?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(T?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#2E94FF]",Pe&&"bg-[#2E94FF] text-white",$t&&!Pe&&"bg-[#7C3AED] text-white",Jt&&!Ct&&(T?"bg-[#7C3AED]/20":"bg-purple-100"),!Ct&&(T?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},K)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Vt(),ee(!$);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":T?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",T?"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(N=>jsxRuntime.jsxs("button",{onClick:()=>{ht("priority",N.id),ee(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",B.priority===N.id&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:T?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",T?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ue?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:N=>{let K=parseInt(N.target.value),Te=B.status;K===100?Te="completed":K>0?Te="in-progress":Te="todo";let Pe={...B,progress:K,status:Te};mt(Pe);},onBlur:()=>je(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",T?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>je(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",T?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",T?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Dn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm px-2 py-0.5 rounded",T?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Dn(C.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm",T?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="estimate"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(oo,{mode:"estimate",locale:n,isDark:T,currentValue:C?.estimateMinutes||null,onSave:async N=>{await P?.(B.id,N),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:Y?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",T?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Dn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm px-2 py-0.5 rounded",T?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Dn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm",T?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="quoted"&&!Y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(oo,{mode:"quoted",locale:n,isDark:T,currentValue:B.quotedMinutes||null,onSave:async N=>{L?(await L(B.id,N),q(K=>K?{...K,quotedMinutes:N}:null)):ht("quotedMinutes",N),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",T?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):E?jsxRuntime.jsxs("button",{type:"button",onClick:()=>J?.(B.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),gh(k||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>M?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",T?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>et("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",T?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":T?"text-white":"text-gray-900"),children:[Dn(C.loggedMinutes),C.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",T?"text-[#6B7280]":"text-gray-400"),children:[" / ",Dn(C.estimateMinutes)]})]}),C.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="log"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(oo,{mode:"log",locale:n,isDark:T,currentValue:null,onSave:async(N,K)=>{N&&await v?.(B.id,{durationMinutes:N,note:K,source:"manual"}),et(false);},onClose:()=>et(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Po,{selectedTags:B.tags||[],availableTags:c,onChange:N=>{ht("tags",N);},onCreateTag:i,theme:G})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(N=>{let K=g.find(Te=>Te.id===N);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",T?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[K?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Te=(B.dependencies||[]).filter(Pe=>Pe!==N);ht("dependencies",Te);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),he(!Xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{he(false),xt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:kt,onChange:N=>xt(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",T?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(N=>N.id!==B.id).filter(N=>kt===""||N.name.toLowerCase().includes(kt.toLowerCase())).map(N=>{let K=B.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=B.dependencies||[],Pe;K?Pe=Te.filter($t=>$t!==N.id):Pe=[...Te,N.id],ht("dependencies",Pe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",K&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",K?"bg-blue-500 border-blue-500":T?"border-white/30":"border-gray-300"),children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:u("block truncate",T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),ze(!nt);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:tn.find(N=>N.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",T?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:tn.map(N=>{let K=B.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{ht("color",N.value),ze(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",K&&"ring-2 ring-offset-2",T?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:K?N.value:void 0},title:N.name,children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:N=>ht("isMilestone",N.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":T?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:oe,value:ae,onChange:N=>ne(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",T?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(N=>N.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((N,K)=>(N.position??0)-(K.position??0)).map(N=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",T?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>bt(N.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",N.progress===100?"bg-green-500 border-green-500":T?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",N.progress===100?"line-through text-[#6B7280]":T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("button",{onClick:()=>Dt(N.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",T?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},N.id))}),St?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Tt,onChange:N=>Ot(N.target.value),onKeyDown:N=>{N.key==="Enter"&&Tt.trim()?Qe():N.key==="Escape"&&(Et(false),Ot(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",T?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:Qe,disabled:!Tt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Tt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":T?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Et(false),Ot("");},className:u("p-2 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>Et(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",T?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(N=>{let K=Z(N.type),Te=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Te&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",T?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(K,{className:u("w-5 h-5",T?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:ye(N.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(N.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",T?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:Fe,onDragLeave:I,onDrop:Q,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ee?T?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":T?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:$e,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",Ee?"text-blue-500":T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:Ee?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",T?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",T?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",T?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=pu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=pu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function pu(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function mu(e,t){switch(t){case "json":return Vf(e);case "csv":return Gf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function gu(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 Tl=react.createContext(null);function fu(){return react.useContext(Tl)}var bu=react.createContext(null);function hu({children:e,themeName:t}){return jsxRuntime.jsx(bu.Provider,{value:{themeName:t},children:e})}function kn(){return react.useContext(bu)}function Zt({children:e,container:t}){let[a,r]=react.useState(false),o=fu(),s=kn();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var ku={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Qf="#BDC3C7",Zf=({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 Qo({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let C=y-g.bottom,S=g.top,E;C>=f+b?E=g.bottom+b:S>=f+b?E=g.top-f-b:E=C>=S?g.bottom+b:Math.max(10,g.top-f-b),n({top:E,left:w}),o(true);};react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let p=g=>{t(g),o(false);},d=e?ku[e]:null,m=d?.color||Qf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(ku).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>p(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color: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(Zf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var eb=[{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 as({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),m=(kn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),C=window.innerHeight,S=window.innerWidth,E=320,k=380,v=4,P=w.left;P+E>S-10&&(P=S-E-10),P<10&&(P=10);let L=C-w.bottom,M=w.top,J;L>=k+v?J=w.bottom+v:M>=k+v?J=w.top-k-v:J=L>=M?w.bottom+v:Math.max(10,w.top-k-v),l({top:J,left:P}),s(true);};react.useEffect(()=>{let w=C=>{c.current&&!c.current.contains(C.target)&&!i.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let C=new Date,S=P=>{let L=P.getFullYear(),M=String(P.getMonth()+1).padStart(2,"0"),J=String(P.getDate()).padStart(2,"0");return `${L}-${M}-${J}`},E=S(C),k=new Date(C);k.setDate(k.getDate()+w);let v=S(k);a(E,v),s(false);},x=()=>{if(!e||!t)return "Set date";let w=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=k.split("-").map(Number);if(v.length!==3||v.some(J=>isNaN(J)))return null;let P=v[0],L=v[1],M=v[2];return P===void 0||L===void 0||M===void 0?null:new Date(P,L-1,M)},C=w(e),S=w(t);if(!C||!S||isNaN(C.getTime())||isNaN(S.getTime()))return "Set date";let E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${E[C.getMonth()]} ${C.getDate()} \u2013 ${E[S.getMonth()]} ${S.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),w<C})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:eb.map(w=>jsxRuntime.jsx("button",{onClick:()=>y(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function en({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,c]=react.useState(""),[i,p]=react.useState({top:0,left:0}),d=react.useRef(null),m=react.useRef(null),g=()=>{if(!m.current)return;let b=m.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,S=300,E=380,k=4,v=b.right-S;v<10&&(v=b.left),v+S>C-10&&(v=C-S-10);let P=w-b.bottom,L=b.top,M;P>=E+k?M=b.bottom+k:L>=E+k?M=b.top-E-k:M=P>=L?b.bottom+k:Math.max(10,b.top-E-k),p({top:M,left:v}),n(true);};react.useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(C=>C.id===b.id);a(w?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.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)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:b=>c(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:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let w=e.some(C=>C.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(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 truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Qs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function os({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),f=react.useRef(null),b=react.useRef(null),w=()=>{if(!b.current)return;let v=b.current.getBoundingClientRect(),P=window.innerHeight,L=window.innerWidth,M=300,J=d?380:120,H=4,Y=v.right-M;Y<10&&(Y=v.left),Y+M>L-10&&(Y=L-M-10);let T=P-v.bottom,G=v.top,te;T>=J+H?te=v.bottom+H:G>=J+H?te=v.top-J-H:te=T>=G?v.bottom+H:Math.max(10,v.top-J-H),y({top:te,left:Y}),c(true);};react.useEffect(()=>{if(!l||!b.current)return;let v=b.current.getBoundingClientRect(),P=window.innerHeight,L=window.innerWidth,M=300,J=d?380:120,H=4,Y=v.right-M;Y<10&&(Y=v.left),Y+M>L-10&&(Y=L-M-10);let T=P-v.bottom,G=v.top,te;T>=J+H?te=v.bottom+H:G>=J+H?te=v.top-J-H:te=T>=G?v.bottom+H:Math.max(10,v.top-J-H),y({top:te,left:Y});},[d,l]),react.useEffect(()=>{let v=P=>{f.current&&!f.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),react.useEffect(()=>{let v=P=>{P.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]);let C=v=>{let P=t.includes(v),L=a.find(M=>M.id===v);if(h(null),P){let M=t.filter(J=>J!==v);r(M),M.length===0&&m(false);}else {if(s&&Qs(a,v,e)){let J=`Cannot add "${L?.title||v}" as dependency - would create circular reference`;h(J),n?.(v,L?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),m(true);}},S=()=>{let v=!d;m(v),v||r([]);},E=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>l?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),l&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:S,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>p(v.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:E.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"}):E.map(v=>{let P=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>C(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:L=>{L.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:L=>{L.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:P?"#3b82f6":"transparent",borderColor:P?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:P&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var fo=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:qs.Transform.toString(m),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=l.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...p,onClick:C=>{C.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,S)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:E=>{E.currentTarget.style.display="none";}}),S===3&&b.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",b.length-4]})})]},C.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Qo,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(as,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(C,S)=>n?.(e.id,{startDate:C,endDate:S})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(en,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(S=>S.id)})})}),jsxRuntime.jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(os,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsxRuntime.jsx("span",{className:"asakaa-label",children:C},C))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));fo.displayName="Card";var Zs={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"}},Au=({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 Lu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),p=[...Object.entries(Zs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Zs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Zs[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Zs.todo,id:"todo"}},m=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,C=280,S=4,E=h.right-w;E<10&&(E=h.left),E+w>b-10&&(E=b-w-10);let k=f-h.bottom,v=h.top,P;k>=C+S?P=h.bottom+S:v>=C+S?P=h.top-C-S:P=k>=v?h.bottom+S:Math.max(10,h.top-C-S),l({top:P,left:E}),s(true);};react.useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsxRuntime.jsx(Au,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.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:h.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(Au,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Iu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Bu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Iu[s]||Iu.en,[l,c]=react.useState(false),[i,p]=react.useState(false),[d,m]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let S=h.current.getBoundingClientRect();y({top:S.bottom+window.scrollY+8,left:S.left+window.scrollX});}},[l]),react.useEffect(()=>{let S=E=>{x.current&&!x.current.contains(E.target)&&!h.current?.contains(E.target)&&(c(false),p(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),react.useEffect(()=>{let S=E=>{E.key==="Escape"&&(c(false),p(false),m(e));};if(l)return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[l,e]),react.useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{p(true),m(e);},w=()=>{let S=d.trim();S&&S!==e&&t(S),p(false),c(false),m(e);},C=S=>{S.key==="Enter"?w():S.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:S=>m(S.target.value),onKeyDown:C,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var Nn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:C,isOver:S}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),E=react.useRef(null),k=p??su(t.length),v=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>E.current,estimateSize:()=>d,enabled:k});if(a)return jsxRuntime.jsx("div",{ref:C,className:f,children:a(e,t)});let L=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),M=L.state==="exceeded",J=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:C,className:u("asakaa-column",S&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(J()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&L.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${L.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[L.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"})]}),L.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"})]}),L.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"})}),L.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"})]})]}),(y||x)&&jsxRuntime.jsx(Bu,{columnTitle:e.title,onRename:H=>y?.(e.id,H),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!m&&jsxRuntime.jsx("div",{ref:E,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(H=>H.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"})}):k?jsxRuntime.jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative"},children:v.getVirtualItems().map(H=>{let Y=t[H.index];return Y?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsxRuntime.jsx(fo,{card:Y,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},Y.id):null})}):t.map(H=>jsxRuntime.jsx(fo,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},H.id))})})]})});Nn.displayName="Column";function Ml({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function vb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Uu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function wb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function kb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Cb=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Wu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=react.useState(false),[w,C]=react.useState([]),[S,E]=react.useState(0),[k,v]=react.useState(null),[P,L]=react.useState(false),M=react.useRef(null),J=react.useRef(null),H=react.useRef(null),Y=react.useRef(null),T=react.useCallback(($,ee)=>{let le=vb($,ee);if(v(le),le){let ke=r.filter(xe=>xe.name.toLowerCase().includes(le.query)||xe.email&&xe.email.toLowerCase().includes(le.query)).slice(0,5);C(ke),b(ke.length>0),E(0);}else b(false),C([]);},[r]),G=$=>{let ee=$.target.value;if(t(ee),T(ee,$.target.selectionStart||0),M.current){M.current.style.height="24px";let le=M.current.scrollHeight,ke=280,xe=Math.min(le,ke);M.current.style.height=`${xe}px`,M.current.style.overflowY=le>ke?"auto":"hidden";}},te=()=>{M.current&&T(e,M.current.selectionStart||0);},Le=react.useCallback($=>{if(!k||!M.current)return;let ee=e.slice(0,k.start),le=e.slice(k.end),ke=`@${$.name.replace(/\s+/g,"")} `,xe=ee+ke+le;t(xe),b(false),v(null),setTimeout(()=>{if(M.current){let Be=k.start+ke.length;M.current.selectionStart=Be,M.current.selectionEnd=Be,M.current.focus();}},0);},[k,e,t]),B=$=>{if(f&&w.length>0)switch($.key){case "ArrowDown":$.preventDefault(),E(ee=>ee<w.length-1?ee+1:0);break;case "ArrowUp":$.preventDefault(),E(ee=>ee>0?ee-1:w.length-1);break;case "Enter":{$.preventDefault();let ee=w[S];ee&&Le(ee);break}case "Tab":{$.preventDefault();let ee=w[S];ee&&Le(ee);break}case "Escape":$.preventDefault(),b(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};react.useEffect(()=>{let $=ee=>{J.current&&!J.current.contains(ee.target)&&M.current&&!M.current.contains(ee.target)&&b(false),Y.current&&!Y.current.contains(ee.target)&&L(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let q=react.useCallback($=>{if(!M.current)return;let ee=M.current.selectionStart||e.length,le=e.slice(0,ee)+$+e.slice(ee);t(le),L(false),setTimeout(()=>{if(M.current){let ke=ee+$.length;M.current.selectionStart=ke,M.current.selectionEnd=ke,M.current.focus();}},0);},[e,t]),be=react.useCallback($=>{if(!g||!$.target.files)return;let ee=Array.from($.target.files),le=x*1024*1024,ke=ee.filter(xe=>xe.size>le?(console.warn(`File ${xe.name} exceeds max size of ${x}MB`),false):true);ke.length>0&&g(ke),$.target.value="";},[g,x]),_e=react.useCallback($=>$.type.startsWith("image/")?lucideReact.Image:$.type.includes("pdf")||$.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&J.current){let $=J.current.children[S];$&&$.scrollIntoView({block:"nearest"});}},[S,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:m.map($=>{let ee=_e($.file),le=$.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[le&&$.preview?jsxRuntime.jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(ee,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:$.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:kb($.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y($.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},$.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(!P),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Cb.map($=>jsxRuntime.jsx("button",{type:"button",onClick:()=>q($),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:be,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:M,value:e,onChange:G,onSelect:te,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map(($,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Le($),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ee===S?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:$.color||"#8B5CF6"},children:wb($.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:$.name}),$.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function Vu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var oi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ao({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=react.useState(false),[i,p]=react.useState(""),[d,m]=react.useState(false),[g,y]=react.useState(oi[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),f=react.useRef(null),b=react.useRef(null),w=react.useRef(null),C=react.useRef(null),S=t.filter(M=>M.name.toLowerCase().includes(i.toLowerCase())),E=t.some(M=>M.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&b.current){let M=b.current.getBoundingClientRect();h({top:M.bottom+6,left:M.left});}},[l]),react.useEffect(()=>{let M=J=>{let H=J.target,Y=f.current?.contains(H),T=w.current?.contains(H);!Y&&!T&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[l]),react.useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=M=>{let J=e.some(H=>H.id===M.id);a(J?e.filter(H=>H.id!==M.id):[...e,M]);},v=async()=>{if(!(!r||!i.trim())){m(true);try{let M=await r(i.trim(),g);M&&(a([...e,M]),p(""),y(oi[Math.floor(Math.random()*oi.length)]||"#2E94FF"));}finally{m(false);}}},P=(M,J)=>{J.stopPropagation(),a(e.filter(H=>H.id!==M));},L={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:L,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${M.color}20`,color:M.color},children:M.name},M.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:C,type:"text",value:i,onChange:M=>p(M.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:M=>{M.key==="Enter"&&i.trim()&&!E&&r&&v();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(M=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${M.color}20`,color:M.color},onClick:J=>P(M.id,J),children:[M.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},M.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:S.length>0?S.map(M=>{let J=e.some(H=>H.id===M.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>k(M),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:J?`${M.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{J||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{J||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:M.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:M.name}),J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:M.color}})]},M.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!E&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:oi.map(M=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(M),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:M,outline:g===M?`2px solid ${M}`:"none",outlineOffset:"2px"}},M))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Pl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function ju({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(Pl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var an=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function _u(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Ab(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Lb({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Al({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Ab(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=_u(e.loggedMinutes),i=e.estimateMinutes?_u(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Lb,{className:l[t]}),jsxRuntime.jsx("span",{children:p})]})}function Ib(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function si(e){let t=Ib(e);return t!==null?String(t):e}function qu(e){let a=si(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ii(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Ob(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function $b({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Hb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Yu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function zb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function Ll({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?ii(t.estimateMinutes):""),[h,f]=react.useState(""),[b,w]=react.useState(false),[C,S]=react.useState(false),E=react.useRef(null);react.useEffect(()=>{E.current?.focus();},[]);let k=async()=>{let L=qu(m);if(!(L<=0||!s)){w(true);try{await s({durationMinutes:L,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},v=async()=>{if(!n)return;let L=y.trim()?qu(y):null;await n(L),S(false);},P=L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),k()),L.key==="Escape"&&p?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Yu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Ob(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Hb,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Yu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx($b,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(zb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:E,type:"text",value:m,onChange:L=>g(L.target.value),onKeyDown:P,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:k,disabled:b||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:L=>f(L.target.value),onKeyDown:P,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ii(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),C?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:L=>x(L.target.value),onKeyDown:L=>{L.key==="Enter"&&v(),L.key==="Escape"&&S(false);},onBlur:v,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>S(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ii(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(L=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:L.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:ii(L.durationMinutes)})]},L.id))})]})]})}function jb(e){let a=si(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function _b(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function no({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=react.useState(_b(r)),[i,p]=react.useState(""),[d,m]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let w=jb(l);await o(w&&w>0?w:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:l,onChange:w=>c(w.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:w=>p(w.target.value),onKeyDown:h,placeholder:b?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:y,disabled:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:b?"Quitar":"Clear"})]})]})}function Kb(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function qb(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Bl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Kb(e.health),s=qb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Dn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Xb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Jb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Qb(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Zb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Dn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Dn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:Dn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function eh({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Dn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Dn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,Dn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Jb(e.status,a),Xb(e.status,a)),children:Qb(e.status,t)})})]})}function Rl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Zb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:m,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",i),children:g.map(y=>jsxRuntime.jsx(eh,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Sn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function gh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function np(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function fh(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function ho({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:C,timeEntries:S=[],isTimerRunning:E=false,timerElapsedSeconds:k=0,onTimeLog:v,onEstimateUpdate:P,onSoldEffortUpdate:L,onTimerStart:M,onTimerStop:J,onTimerDiscard:H,blurFinancials:Y=false}){let T=s==="dark",G={textTertiary:T?"#6B7280":"#9CA3AF",textSecondary:T?"#9CA3AF":"#6B7280",textPrimary:T?"#FFFFFF":"#111827",borderLight:T?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:T?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:T?"#1A1D25":"#FFFFFF",bgSecondary:T?"#0A0A0A":"#F9FAFB",hoverBg:T?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},te=e&&"title"in e&&!("name"in e),Le=e,[B,q]=react.useState(e?np(e,l):null),[be,_e]=react.useState(false),[$,ee]=react.useState(false),[le,ke]=react.useState(false),[xe,Be]=react.useState(null),[He,at]=react.useState(new Date),[ue,je]=react.useState(false),[Xe,he]=react.useState(false),[kt,xt]=react.useState(""),[nt,ze]=react.useState(false),[ct,et]=react.useState(false),[Ee,V]=react.useState(false),[D,U]=react.useState(false),[ae,Ne]=react.useState(""),z=react.useRef(null),oe=react.useRef(null),[Ge,ge]=react.useState(""),Ve=react.useRef(null),[Oe,Ue]=react.useState(""),[lt,ot]=react.useState(false),[st,pt]=react.useState([]),[Tt,Ot]=react.useState(""),[St,Et]=react.useState(false),Ft=react.useRef(null);react.useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let N=np(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:N?.id,taskName:N?.name,soldEffortMinutes:N?.soldEffortMinutes,quotedMinutes:N?.quotedMinutes,effortMinutes:N?.effortMinutes,timeLoggedMinutes:N?.timeLoggedMinutes}),q(N),Ne(N.description||""),ge(N.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!ae)return;let N=setTimeout(()=>{let K=oe.current;K&&(K.style.height="auto",K.style.height=`${Math.max(100,K.scrollHeight)}px`);},50);return ()=>clearTimeout(N)},[t,ae]),react.useEffect(()=>()=>{z.current&&clearTimeout(z.current),Ve.current&&clearTimeout(Ve.current);},[]),react.useEffect(()=>{t&&Ft.current&&y.length>0&&setTimeout(()=>{Ft.current&&(Ft.current.scrollTop=Ft.current.scrollHeight);},100);},[t,y.length]);let mt=react.useCallback(N=>{q(N),te&&o&&Le?o(fh(N,Le)):r&&r(N);},[te,Le,o,r]),Vt=react.useCallback(()=>{_e(false),ee(false),ke(false),Be(null),he(false),xt(""),ze(false);},[]),ht=react.useCallback((N,K)=>{if(!B)return;let Te={...B,[N]:K};mt(Te);},[B,mt]),it=react.useCallback(()=>{let N=oe.current;N&&(N.style.height="auto",N.style.height=`${Math.max(100,N.scrollHeight)}px`);},[]),ne=react.useCallback(N=>{Ne(N),setTimeout(it,0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{if(B){let K={...B,description:N};mt(K);}},800);},[B,mt,it]),pe=react.useCallback(N=>{ge(N),Ve.current&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{if(B&&N.trim()){let K={...B,name:N.trim()};mt(K);}},800);},[B,mt]),O=react.useCallback(N=>{let K=N.map(Te=>{let Pe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Te};return Te.type.startsWith("image/")&&(Pe.preview=URL.createObjectURL(Te)),Pe});pt(Te=>[...Te,...K]);},[]),_=react.useCallback(N=>{pt(K=>{let Te=K.find(Pe=>Pe.id===N);return Te?.preview&&URL.revokeObjectURL(Te.preview),K.filter(Pe=>Pe.id!==N)});},[]),De=react.useCallback(async()=>{if(!(!B||!Oe.trim()&&st.length===0||!x)){ot(true);try{let N=Uu(Oe,f),K=[];if(st.length>0&&b){let Te=st.map(Pe=>Pe.file);K=await b(Te);}await x(B.id,Oe.trim(),N.length>0?N:void 0,K.length>0?K:void 0),Ue(""),st.forEach(Te=>{Te.preview&&URL.revokeObjectURL(Te.preview);}),pt([]);}finally{ot(false);}}},[B,Oe,st,x,f,b]),Qe=react.useCallback(()=>{if(!B||!Tt.trim())return;let N=B.subtasks||[],K={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Tt.trim(),progress:0,startDate:new Date,endDate:new Date,position:N.length},Te=[...N,K],Pe={...B,subtasks:Te};mt(Pe),Ot(""),Et(false);},[B,Tt,mt]),bt=react.useCallback(N=>{if(!B?.subtasks)return;let K=B.subtasks.map(Pe=>Pe.id===N?{...Pe,progress:Pe.progress===100?0:100}:Pe),Te={...B,subtasks:K};mt(Te);},[B,mt]),Dt=react.useCallback(N=>{if(!B?.subtasks)return;let K=B.subtasks.filter(Pe=>Pe.id!==N),Te={...B,subtasks:K};mt(Te);},[B,mt]),Pt=react.useCallback(N=>{let K=typeof N=="string"?new Date(N):N,Pe=new Date().getTime()-K.getTime(),$t=Math.floor(Pe/6e4),Ct=Math.floor(Pe/36e5),Jt=Math.floor(Pe/864e5);return $t<1?n==="es"?"Ahora":"Just now":$t<60?n==="es"?`Hace ${$t} min`:`${$t}m ago`:Ct<24?n==="es"?`Hace ${Ct}h`:`${Ct}h ago`:Jt<7?n==="es"?`Hace ${Jt}d`:`${Jt}d ago`:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),At=react.useCallback(N=>{if(!B)return;let K=B.progress||0;N==="completed"?K=100:N==="in-progress"&&K===0?K=10:N==="todo"&&(K=0);let Te={...B,status:N,progress:K};mt(Te),_e(false);},[B,mt]),ta=react.useCallback((N,K)=>{if(!B)return;let Te={...B,startDate:N,endDate:K};mt(Te);},[B,mt]),la=react.useCallback(()=>{let N=He.getFullYear(),K=He.getMonth(),Te=new Date(N,K,1),$t=new Date(N,K+1,0).getDate(),Ct=Te.getDay(),Jt=[],Wa=new Date(N,K,0).getDate();for(let wa=Ct-1;wa>=0;wa--)Jt.push({date:new Date(N,K-1,Wa-wa),isCurrentMonth:false});for(let wa=1;wa<=$t;wa++)Jt.push({date:new Date(N,K,wa),isCurrentMonth:true});let ya=42-Jt.length;for(let wa=1;wa<=ya;wa++)Jt.push({date:new Date(N,K+1,wa),isCurrentMonth:false});return Jt},[He]),Q=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),V(false),!B||!d)return;let K=Array.from(N.dataTransfer.files);if(K.length!==0){U(true);try{await d(B.id,K);}finally{U(false);}}},[B,d]),$e=react.useCallback(async N=>{if(!B||!d||!N.target.files)return;let K=Array.from(N.target.files);if(K.length!==0){U(true);try{await d(B.id,K);}finally{U(false);}N.target.value="";}},[B,d]),Fe=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),V(true);},[]),I=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),V(false);},[]),ye=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),Z=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",T?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",T?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",T?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=B.progress===100?0:100,Te={...B,progress:N,status:N===100?"completed":"todo"};mt(Te);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":T?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ge,onChange:N=>pe(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":T?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Vt(),_e(!be);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":T?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:be&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>At(N.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",B.status===N.id&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:T?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),ke(!le);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((N,K)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},K)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",T?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",T?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ke(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(N=>{let K=B.assignees?.some(Te=>Te.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=B.assignees||[],Pe;K?Pe=Te.filter($t=>$t.name!==N.name):Pe=[...Te,N],ht("assignees",Pe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",K&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",T?"text-white":"text-gray-900"),children:N.name}),K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Be(xe?null:"start"),at(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",T?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",T?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let Te=new Date(N);Te.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Pe=new Date(N);Pe.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let $t=new Date(N);$t.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Ct=new Date(N);Ct.setDate(N.getDate()+14);let Jt=new Date(N);return Jt.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Te,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Pe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:$t,display:$t.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ct,display:Ct.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Jt,display:Jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ya,wa)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",T?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(xe==="start"){let dr=B.endDate&&ya.date>B.endDate?ya.date:B.endDate;ta(ya.date,dr),Be("end");}else {let dr=B.startDate&&ya.date<B.startDate?ya.date:B.startDate;ta(dr,ya.date),Be(null);}},children:[jsxRuntime.jsx("span",{children:ya.label}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:ya.display})]},wa))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ta(void 0,void 0),Be(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",T?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",T?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:xe==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",T?"text-white":"text-gray-900"),children:He.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>at(new Date),className:u("p-1 rounded text-sm transition-colors",T?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(He.getFullYear(),He.getMonth()-1)),className:u("p-1 rounded",T?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>at(new Date(He.getFullYear(),He.getMonth()+1)),className:u("p-1 rounded",T?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",T?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:la().map((N,K)=>{let Te=N.date.toDateString()===new Date().toDateString(),Pe=B.startDate?.toDateString()===N.date.toDateString(),$t=B.endDate?.toDateString()===N.date.toDateString(),Ct=Pe||$t,Jt=B.startDate&&B.endDate&&N.date>=B.startDate&&N.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Wa=new Date(N.date);if(xe==="start"){let ya=B.endDate&&Wa>B.endDate?Wa:B.endDate;ta(Wa,ya),Be("end");}else {let ya=B.startDate&&Wa<B.startDate?Wa:B.startDate;ta(ya,Wa),Be(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(T?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(T?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#2E94FF]",Pe&&"bg-[#2E94FF] text-white",$t&&!Pe&&"bg-[#7C3AED] text-white",Jt&&!Ct&&(T?"bg-[#7C3AED]/20":"bg-purple-100"),!Ct&&(T?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},K)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Vt(),ee(!$);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":T?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",T?"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(N=>jsxRuntime.jsxs("button",{onClick:()=>{ht("priority",N.id),ee(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",B.priority===N.id&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:T?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",T?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ue?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:N=>{let K=parseInt(N.target.value),Te=B.status;K===100?Te="completed":K>0?Te="in-progress":Te="todo";let Pe={...B,progress:K,status:Te};mt(Pe);},onBlur:()=>je(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",T?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>je(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",T?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",T?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Sn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm px-2 py-0.5 rounded",T?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Sn(C.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("estimate"),className:u("text-sm",T?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="estimate"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(no,{mode:"estimate",locale:n,isDark:T,currentValue:C?.estimateMinutes||null,onSave:async N=>{await P?.(B.id,N),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:Y?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",T?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Sn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm px-2 py-0.5 rounded",T?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Sn(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>et("quoted"),className:u("text-sm",T?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="quoted"&&!Y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(no,{mode:"quoted",locale:n,isDark:T,currentValue:B.quotedMinutes||null,onSave:async N=>{L?(await L(B.id,N),q(K=>K?{...K,quotedMinutes:N}:null)):ht("quotedMinutes",N),et(false);},onClose:()=>et(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",T?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):E?jsxRuntime.jsxs("button",{type:"button",onClick:()=>J?.(B.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),gh(k||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>M?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",T?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",T?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>et("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",T?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":T?"text-white":"text-gray-900"),children:[Sn(C.loggedMinutes),C.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",T?"text-[#6B7280]":"text-gray-400"),children:[" / ",Sn(C.estimateMinutes)]})]}),C.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct==="log"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(no,{mode:"log",locale:n,isDark:T,currentValue:null,onSave:async(N,K)=>{N&&await v?.(B.id,{durationMinutes:N,note:K,source:"manual"}),et(false);},onClose:()=>et(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Ao,{selectedTags:B.tags||[],availableTags:c,onChange:N=>{ht("tags",N);},onCreateTag:i,theme:G})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(N=>{let K=g.find(Te=>Te.id===N);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",T?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[K?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Te=(B.dependencies||[]).filter(Pe=>Pe!==N);ht("dependencies",Te);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),he(!Xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{he(false),xt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:kt,onChange:N=>xt(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",T?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(N=>N.id!==B.id).filter(N=>kt===""||N.name.toLowerCase().includes(kt.toLowerCase())).map(N=>{let K=B.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Te=B.dependencies||[],Pe;K?Pe=Te.filter($t=>$t!==N.id):Pe=[...Te,N.id],ht("dependencies",Pe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",T?"hover:bg-white/5":"hover:bg-gray-50",K&&(T?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",K?"bg-blue-500 border-blue-500":T?"border-white/30":"border-gray-300"),children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:u("block truncate",T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Vt(),ze(!nt);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:an.find(N=>N.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",T?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",T?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:an.map(N=>{let K=B.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{ht("color",N.value),ze(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",K&&"ring-2 ring-offset-2",T?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:K?N.value:void 0},title:N.name,children:K&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:N=>ht("isMilestone",N.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":T?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:oe,value:ae,onChange:N=>ne(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",T?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(N=>N.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((N,K)=>(N.position??0)-(K.position??0)).map(N=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",T?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>bt(N.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",N.progress===100?"bg-green-500 border-green-500":T?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",N.progress===100?"line-through text-[#6B7280]":T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("button",{onClick:()=>Dt(N.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",T?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},N.id))}),St?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Tt,onChange:N=>Ot(N.target.value),onKeyDown:N=>{N.key==="Enter"&&Tt.trim()?Qe():N.key==="Escape"&&(Et(false),Ot(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",T?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:Qe,disabled:!Tt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Tt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":T?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Et(false),Ot("");},className:u("p-2 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>Et(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",T?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",T?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:p.map(N=>{let K=Z(N.type),Te=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Te&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",T?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(K,{className:u("w-5 h-5",T?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",T?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:ye(N.size)})]}),m&&jsxRuntime.jsx("button",{onClick:()=>m(N.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",T?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:Fe,onDragLeave:I,onDrop:Q,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ee?T?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":T?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:$e,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",Ee?"text-blue-500":T?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-500"),children:Ee?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",T?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",T?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",T?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",T?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",T?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",T?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${T?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:Ft,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",T?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((N,K)=>{let Te=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,Pe=typeof K.createdAt=="string"?new Date(K.createdAt):K.createdAt;return Te.getTime()-Pe.getTime()}).map(N=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",T?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:Pt(N.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Vu,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(K=>{let Te=K.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:K.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Te?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",T?"text-white":"text-gray-900"),children:K.name})]},K.id)})})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",T?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Wu,{value:Oe,onChange:Ue,onSubmit:De,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:st,onFilesSelect:O,onRemoveFile:_})})]})]})]})})}function $l(){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 Io({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:C,onUploadCommentAttachments:S,enableTimeTracking:E,timeTrackingSummary:k,timeEntries:v,timerState:P,onLogTime:L,onUpdateEstimate:M,onUpdateSoldEffort:J,onStartTimer:H,onStopTimer:Y,onDiscardTimer:T,blurFinancials:G=false,sidePanel:te,renderColumnMetrics:Le,suppressDetailModal:B=false}){let[q,be]=$l(),[_e,$]=react.useState(null),[ee,le]=react.useState(false),ke=react.useRef(null),xe=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Be=o?.theme||"dark",He=Be==="dark"||Be==="neutral",at=He?"dark":"",ue=react.useCallback((D,U)=>{t.onCardUpdate?.(D,U);},[t]),je=react.useCallback((D,U)=>{t.onColumnUpdate?.(D,{title:U});},[t]),Xe=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),he=["todo","in-progress","completed"],kt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),xt=react.useMemo(()=>{let D=new Map;return e.columns.forEach(U=>{let ae=U.cardIds.map(Ne=>e.cards.find(z=>z.id===Ne)).filter(Ne=>Ne!==void 0).sort((Ne,z)=>Ne.position-z.position);D.set(U.id,ae);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=ke.current;if(!D)return;let U=oe=>{let Ge=oe.target,ge=oe.button===1,Ve=Ge===D||Ge.classList.contains("asakaa-column")&&!Ge.closest(".asakaa-card");(ge||oe.button===0&&Ve&&!q.isDragging)&&(oe.preventDefault(),le(true),xe.current={x:oe.clientX,y:oe.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ae=oe=>{if(!ee)return;let Ge=oe.clientX-xe.current.x,ge=oe.clientY-xe.current.y;D.scrollLeft=xe.current.scrollLeft-Ge,D.scrollTop=xe.current.scrollTop-ge;},Ne=()=>{ee&&(le(false),D.style.cursor="",D.style.userSelect="");},z=()=>{ee&&(le(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",U),document.addEventListener("mousemove",ae),document.addEventListener("mouseup",Ne),D.addEventListener("mouseleave",z),()=>{D.removeEventListener("mousedown",U),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",Ne),D.removeEventListener("mouseleave",z);}},[ee,q.isDragging]);let nt=react.useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(U=>typeof U=="string"?U:U.taskId):[]})),[e.cards]),ze=react.useCallback(D=>{let{active:U}=D,ae=e.cards.find(Ne=>Ne.id===U.id);ae&&be({isDragging:true,draggedCardId:ae.id,sourceColumnId:ae.columnId,targetColumnId:ae.columnId});},[e.cards,be]),ct=react.useCallback(D=>{let{active:U,over:ae}=D;if(!ae||!e.cards.find(oe=>oe.id===U.id))return;let z=null;ae.data.current?.type==="column"?z=ae.id:ae.data.current?.type==="card"&&(z=e.cards.find(Ge=>Ge.id===ae.id)?.columnId||null),z&&z!==q.targetColumnId&&be({...q,targetColumnId:z});},[e.cards,q,be]),et=react.useCallback(async D=>{let{active:U,over:ae}=D;if(be({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ae)return;let Ne=e.cards.find(ge=>ge.id===U.id);if(!Ne)return;let z,oe;if(ae.data.current?.type==="column"){z=ae.id;let ge=xt.get(z)||[];oe=vl(ge,0);}else {let ge=e.cards.find(Ue=>Ue.id===ae.id);if(!ge)return;z=ge.columnId;let Ve=xt.get(z)||[],Oe=Ve.findIndex(Ue=>Ue.id===ae.id);oe=vl(Ve,Oe);}let Ge=e.columns.find(ge=>ge.id===z);if(Ge&&Ge.wipLimit&&Ge.wipLimitType==="hard"){let ge=xt.get(z)||[];if(Ne.columnId!==z&&ge.length>=Ge.wipLimit){t.onWipLimitExceeded?.(Ge,Ne);return}}(Ne.columnId!==z||Ne.position!==oe)&&await t.onCardMove?.(Ne.id,z,oe);},[e.cards,e.columns,xt,t,be]),Ee=react.useCallback(D=>{B||$(D),a?.(D),C?.(D.id);},[a,C,B]),V=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),$(D);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",at,n),style:l,children:jsxRuntime.jsx(Sh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",at,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(hu,{themeName:Be,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",te?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:kt,collisionDetection:core$1.closestCorners,onDragStart:ze,onDragOver:ct,onDragEnd:et,children:[jsxRuntime.jsxs("div",{ref:ke,className:u("asakaa-board",te?"flex-1":"",at,n),style:{...l,cursor:ee?"grabbing":void 0},"data-theme":Be,children:[e.columns.sort((D,U)=>D.position-U.position).map(D=>{let U=xt.get(D.id)||[],ae=!he.includes(D.id),Ne=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Tn,{column:D,cards:U,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Le?(z,oe)=>Le(z,oe):void 0,onCardClick:Ee,onCardUpdate:ue,onColumnRename:t.onColumnUpdate?je:void 0,onColumnDelete:t.onColumnDelete?Xe:void 0,isDeletable:ae,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ne]},D.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:q.draggedCardId?jsxRuntime.jsx(go,{card:e.cards.find(D=>D.id===q.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),te]}),!B&&jsxRuntime.jsx(bo,{task:_e,isOpen:!!_e,onClose:()=>$(null),onCardUpdate:V,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:_e?g?.get(_e.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:nt,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:S,enableTimeTracking:E,timeTrackingSummary:k,timeEntries:v,isTimerRunning:P?.isRunning,timerElapsedSeconds:P?.elapsedSeconds,onTimeLog:L,onEstimateUpdate:M,onSoldEffortUpdate:J,onTimerStart:H,onTimerStop:Y,onTimerDiscard:T,blurFinancials:G})]})}function Sh({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 Ah={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Lh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Ih={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Bh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Rh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.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:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Oh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function $h({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function zl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p,toolbarEndContent:d}){let m=r==="dark"?Ah:Lh,g={...o==="es"?Ih:Bh,...i},y=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Oh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Rh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx($h,{onClick:()=>t(),label:a||g.newTask}))]})})}function Wl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function an({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(false),[b,w]=react.useState(false),[C,S]=react.useState(false),[E,k]=react.useState(s||new Date),v=react.useRef(null),P=o==="es",L=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{v.current?.focus();},[]);let M=react.useCallback(()=>{f(false),w(false),S(false);},[]),J=react.useCallback(()=>{i(""),d(void 0),g(null),x(null),M(),t();},[t,M]),H=react.useCallback(()=>{let G=c.trim();if(!G)return;let te=a.find(B=>B.id===m),Le=y||s;e({name:G,priority:p,assignee:te||void 0,assigneeId:m,startDate:Le,endDate:Le}),i(""),d(void 0),g(null),x(null),M(),v.current?.focus();},[c,p,m,y,s,a,e,M]),Y=react.useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),H()),G.key==="Escape"&&J();},[H,J,c]),T=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>M(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:v,type:"text",value:c,onChange:G=>i(G.target.value),placeholder:P?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:Y})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),f(!h),w(false),S(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:P?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:P?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:P?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:P?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:P?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxRuntime.jsxs("button",{onClick:()=>{d(G.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",G.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),S(!C),f(false),w(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),T.toLocaleDateString(P?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,te=new Date(G);te.setDate(G.getDate()+1);let Le=new Date(G);Le.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let B=new Date(G);B.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let q=new Date(G);q.setDate(G.getDate()+14);let be=new Date(G);be.setDate(G.getDate()+28);let _e=P?"es-ES":"en-US";return [{label:P?"Hoy":"Today",date:G,display:G.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:P?"Ma\xF1ana":"Tomorrow",date:te,display:te.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:P?"Este fin de semana":"This weekend",date:Le,display:P?"s\xE1b.":"sat."},{label:P?"Pr\xF3xima semana":"Next week",date:B,display:P?"lun.":"mon."},{label:P?"2 semanas":"2 weeks",date:q,display:q.toLocaleDateString(_e,{day:"numeric",month:"short"})},{label:P?"4 semanas":"4 weeks",date:be,display:be.toLocaleDateString(_e,{day:"numeric",month:"short"})}].map((ee,le)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(ee.date),S(false);},children:[jsxRuntime.jsx("span",{children:ee.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ee.display})]},le))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:E.toLocaleDateString(P?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:P?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(E.getFullYear(),E.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(E.getFullYear(),E.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(P?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:G},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=E.getFullYear(),te=E.getMonth(),Le=new Date(G,te,1).getDay(),B=new Date(G,te+1,0).getDate(),q=new Date(G,te,0).getDate(),be=new Date().toDateString(),_e=[];for(let ee=Le-1;ee>=0;ee--)_e.push({dayNum:q-ee,isCurrent:false,date:new Date(G,te-1,q-ee)});for(let ee=1;ee<=B;ee++)_e.push({dayNum:ee,isCurrent:true,date:new Date(G,te,ee)});let $=42-_e.length;for(let ee=1;ee<=$;ee++)_e.push({dayNum:ee,isCurrent:false,date:new Date(G,te+1,ee)});return _e.map((ee,le)=>{let ke=ee.date.toDateString()===be,xe=(y||s)?.toDateString()===ee.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ee.isCurrent&&(r?"text-white/20":"text-gray-300"),ee.isCurrent&&(r?"text-white":"text-gray-900"),ke&&"ring-1 ring-[#007FFF]",xe&&"bg-[#007FFF] text-white",!xe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ee.date),S(false);},children:ee.dayNum},le)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),w(!b),f(false),S(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(G=>G.id===m)?.color||"#007FFF"},children:a.find(G=>G.id===m)?.initials||a.find(G=>G.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:P?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(G.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:P?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:H,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:P?"Guardar":"Save"})]})]})}function Kl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let C=90,S=()=>{let E=p.current.getBoundingClientRect(),v=window.innerHeight-E.bottom<C+8;x(v),g({position:"fixed",...v?{bottom:window.innerHeight-E.top+4}:{top:E.bottom+4},left:E.left,width:E.width,zIndex:9999});};return S(),window.addEventListener("scroll",S,true),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,true),window.removeEventListener("resize",S);}},[c]),react.useEffect(()=>{if(!c)return;let C=S=>{let E=S.target;d.current&&!d.current.contains(E)&&p.current&&!p.current.contains(E)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let w=react.useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(an,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var ps=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(Io,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function wp(e={}){return new ps(e)}var Sn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ql(e,t){let a=r=>jsxRuntime.jsx(Sn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Xl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[f,b]=react.useState(""),[w,C]=react.useState("");react.useEffect(()=>{let v=P=>{(P.metaKey||P.ctrlKey)&&P.key===i&&(P.preventDefault(),m(L=>!L)),P.key==="Escape"&&(m(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let S=react.useCallback(()=>{m(false);},[]),E=react.useCallback(v=>{let[P,L]=v.split(":");switch(P){case "create-card":h("create-card");break;case "create-card-in":b(L||"");break;case "navigate":L?(a?.(L),S()):h("navigate");break;case "search":r?.(g),S();break;case "priority":h("priority");break;case "set-priority":w&&L&&(o?.(w,L),S());break;case "assign":h("assign");break;case "assign-user":w&&L&&(s?.(w,L),S());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),S();break;case "ai-predict-risks":l?.(),S();break;case "ai-usage":c?.(),S();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,l,c,S]),k=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),S());},[f,g,t,S]);return d?jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:S,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:E,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:E,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:E,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:E,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:E,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},v.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.id}`,onSelect:E,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:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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(v=>{let P=e.columns.find(L=>L.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:E,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:P?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},v.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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:E,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:E,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:E,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 Tp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsxRuntime.jsx("div",{ref:Ft,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",T?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((N,K)=>{let Te=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,Pe=typeof K.createdAt=="string"?new Date(K.createdAt):K.createdAt;return Te.getTime()-Pe.getTime()}).map(N=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",T?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",T?"text-[#6B7280]":"text-gray-400"),children:Pt(N.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Vu,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(K=>{let Te=K.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:K.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",T?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Te?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",T?"text-white":"text-gray-900"),children:K.name})]},K.id)})})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",T?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",T?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Wu,{value:Oe,onChange:Ue,onSubmit:De,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:st,onFilesSelect:O,onRemoveFile:_})})]})]})]})})}function $l(){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 Bo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:C,onUploadCommentAttachments:S,enableTimeTracking:E,timeTrackingSummary:k,timeEntries:v,timerState:P,onLogTime:L,onUpdateEstimate:M,onUpdateSoldEffort:J,onStartTimer:H,onStopTimer:Y,onDiscardTimer:T,blurFinancials:G=false,sidePanel:te,renderColumnMetrics:Le,suppressDetailModal:B=false}){let[q,be]=$l(),[_e,$]=react.useState(null),[ee,le]=react.useState(false),ke=react.useRef(null),xe=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Be=o?.theme||"dark",He=Be==="dark"||Be==="neutral",at=He?"dark":"",ue=react.useCallback((D,U)=>{t.onCardUpdate?.(D,U);},[t]),je=react.useCallback((D,U)=>{t.onColumnUpdate?.(D,{title:U});},[t]),Xe=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),he=["todo","in-progress","completed"],kt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),xt=react.useMemo(()=>{let D=new Map;return e.columns.forEach(U=>{let ae=U.cardIds.map(Ne=>e.cards.find(z=>z.id===Ne)).filter(Ne=>Ne!==void 0).sort((Ne,z)=>Ne.position-z.position);D.set(U.id,ae);}),D},[e.cards,e.columns]);react.useEffect(()=>{let D=ke.current;if(!D)return;let U=oe=>{let Ge=oe.target,ge=oe.button===1,Ve=Ge===D||Ge.classList.contains("asakaa-column")&&!Ge.closest(".asakaa-card");(ge||oe.button===0&&Ve&&!q.isDragging)&&(oe.preventDefault(),le(true),xe.current={x:oe.clientX,y:oe.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ae=oe=>{if(!ee)return;let Ge=oe.clientX-xe.current.x,ge=oe.clientY-xe.current.y;D.scrollLeft=xe.current.scrollLeft-Ge,D.scrollTop=xe.current.scrollTop-ge;},Ne=()=>{ee&&(le(false),D.style.cursor="",D.style.userSelect="");},z=()=>{ee&&(le(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",U),document.addEventListener("mousemove",ae),document.addEventListener("mouseup",Ne),D.addEventListener("mouseleave",z),()=>{D.removeEventListener("mousedown",U),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",Ne),D.removeEventListener("mouseleave",z);}},[ee,q.isDragging]);let nt=react.useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(U=>typeof U=="string"?U:U.taskId):[]})),[e.cards]),ze=react.useCallback(D=>{let{active:U}=D,ae=e.cards.find(Ne=>Ne.id===U.id);ae&&be({isDragging:true,draggedCardId:ae.id,sourceColumnId:ae.columnId,targetColumnId:ae.columnId});},[e.cards,be]),ct=react.useCallback(D=>{let{active:U,over:ae}=D;if(!ae||!e.cards.find(oe=>oe.id===U.id))return;let z=null;ae.data.current?.type==="column"?z=ae.id:ae.data.current?.type==="card"&&(z=e.cards.find(Ge=>Ge.id===ae.id)?.columnId||null),z&&z!==q.targetColumnId&&be({...q,targetColumnId:z});},[e.cards,q,be]),et=react.useCallback(async D=>{let{active:U,over:ae}=D;if(be({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ae)return;let Ne=e.cards.find(ge=>ge.id===U.id);if(!Ne)return;let z,oe;if(ae.data.current?.type==="column"){z=ae.id;let ge=xt.get(z)||[];oe=vl(ge,0);}else {let ge=e.cards.find(Ue=>Ue.id===ae.id);if(!ge)return;z=ge.columnId;let Ve=xt.get(z)||[],Oe=Ve.findIndex(Ue=>Ue.id===ae.id);oe=vl(Ve,Oe);}let Ge=e.columns.find(ge=>ge.id===z);if(Ge&&Ge.wipLimit&&Ge.wipLimitType==="hard"){let ge=xt.get(z)||[];if(Ne.columnId!==z&&ge.length>=Ge.wipLimit){t.onWipLimitExceeded?.(Ge,Ne);return}}(Ne.columnId!==z||Ne.position!==oe)&&await t.onCardMove?.(Ne.id,z,oe);},[e.cards,e.columns,xt,t,be]),Ee=react.useCallback(D=>{B||$(D),a?.(D),C?.(D.id);},[a,C,B]),V=react.useCallback(D=>{t.onCardUpdate?.(D.id,D),$(D);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",at,n),style:l,children:jsxRuntime.jsx(Sh,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",at,n),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(hu,{themeName:Be,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",te?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:kt,collisionDetection:core$1.closestCorners,onDragStart:ze,onDragOver:ct,onDragEnd:et,children:[jsxRuntime.jsxs("div",{ref:ke,className:u("asakaa-board",te?"flex-1":"",at,n),style:{...l,cursor:ee?"grabbing":void 0},"data-theme":Be,children:[e.columns.sort((D,U)=>D.position-U.position).map(D=>{let U=xt.get(D.id)||[],ae=!he.includes(D.id),Ne=r?.renderColumnFooter?.(D);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Nn,{column:D,cards:U,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Le?(z,oe)=>Le(z,oe):void 0,onCardClick:Ee,onCardUpdate:ue,onColumnRename:t.onColumnUpdate?je:void 0,onColumnDelete:t.onColumnDelete?Xe:void 0,isDeletable:ae,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ne]},D.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:q.draggedCardId?jsxRuntime.jsx(fo,{card:e.cards.find(D=>D.id===q.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),te]}),!B&&jsxRuntime.jsx(ho,{task:_e,isOpen:!!_e,onClose:()=>$(null),onCardUpdate:V,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:_e?g?.get(_e.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:nt,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:S,enableTimeTracking:E,timeTrackingSummary:k,timeEntries:v,isTimerRunning:P?.isRunning,timerElapsedSeconds:P?.elapsedSeconds,onTimeLog:L,onEstimateUpdate:M,onSoldEffortUpdate:J,onTimerStart:H,onTimerStop:Y,onTimerDiscard:T,blurFinancials:G})]})}function Sh({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 Ah={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Lh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Ih={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Bh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Rh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.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:i.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Oh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function $h({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function zl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p,toolbarEndContent:d}){let m=r==="dark"?Ah:Lh,g={...o==="es"?Ih:Bh,...i},y=n||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Oh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Rh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsxRuntime.jsx($h,{onClick:()=>t(),label:a||g.newTask}))]})})}function Wl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),p=react.useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function rn({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[p,d]=react.useState(void 0),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(false),[b,w]=react.useState(false),[C,S]=react.useState(false),[E,k]=react.useState(s||new Date),v=react.useRef(null),P=o==="es",L=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{v.current?.focus();},[]);let M=react.useCallback(()=>{f(false),w(false),S(false);},[]),J=react.useCallback(()=>{i(""),d(void 0),g(null),x(null),M(),t();},[t,M]),H=react.useCallback(()=>{let G=c.trim();if(!G)return;let te=a.find(B=>B.id===m),Le=y||s;e({name:G,priority:p,assignee:te||void 0,assigneeId:m,startDate:Le,endDate:Le}),i(""),d(void 0),g(null),x(null),M(),v.current?.focus();},[c,p,m,y,s,a,e,M]),Y=react.useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),H()),G.key==="Escape"&&J();},[H,J,c]),T=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>M(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:v,type:"text",value:c,onChange:G=>i(G.target.value),placeholder:P?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:Y})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),f(!h),w(false),S(false);},type:"button",className:u("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:P?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:P?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:P?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:P?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:P?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxRuntime.jsxs("button",{onClick:()=>{d(G.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",G.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:G=>{G.stopPropagation(),S(!C),f(false),w(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),T.toLocaleDateString(P?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,te=new Date(G);te.setDate(G.getDate()+1);let Le=new Date(G);Le.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let B=new Date(G);B.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let q=new Date(G);q.setDate(G.getDate()+14);let be=new Date(G);be.setDate(G.getDate()+28);let _e=P?"es-ES":"en-US";return [{label:P?"Hoy":"Today",date:G,display:G.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:P?"Ma\xF1ana":"Tomorrow",date:te,display:te.toLocaleDateString(_e,{weekday:"short"}).slice(0,3)+"."},{label:P?"Este fin de semana":"This weekend",date:Le,display:P?"s\xE1b.":"sat."},{label:P?"Pr\xF3xima semana":"Next week",date:B,display:P?"lun.":"mon."},{label:P?"2 semanas":"2 weeks",date:q,display:q.toLocaleDateString(_e,{day:"numeric",month:"short"})},{label:P?"4 semanas":"4 weeks",date:be,display:be.toLocaleDateString(_e,{day:"numeric",month:"short"})}].map((ee,le)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(ee.date),S(false);},children:[jsxRuntime.jsx("span",{children:ee.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ee.display})]},le))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:E.toLocaleDateString(P?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:P?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(E.getFullYear(),E.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>k(new Date(E.getFullYear(),E.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(P?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:G},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=E.getFullYear(),te=E.getMonth(),Le=new Date(G,te,1).getDay(),B=new Date(G,te+1,0).getDate(),q=new Date(G,te,0).getDate(),be=new Date().toDateString(),_e=[];for(let ee=Le-1;ee>=0;ee--)_e.push({dayNum:q-ee,isCurrent:false,date:new Date(G,te-1,q-ee)});for(let ee=1;ee<=B;ee++)_e.push({dayNum:ee,isCurrent:true,date:new Date(G,te,ee)});let $=42-_e.length;for(let ee=1;ee<=$;ee++)_e.push({dayNum:ee,isCurrent:false,date:new Date(G,te+1,ee)});return _e.map((ee,le)=>{let ke=ee.date.toDateString()===be,xe=(y||s)?.toDateString()===ee.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ee.isCurrent&&(r?"text-white/20":"text-gray-300"),ee.isCurrent&&(r?"text-white":"text-gray-900"),ke&&"ring-1 ring-[#007FFF]",xe&&"bg-[#007FFF] text-white",!xe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ee.date),S(false);},children:ee.dayNum},le)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),w(!b),f(false),S(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(G=>G.id===m)?.color||"#007FFF"},children:a.find(G=>G.id===m)?.initials||a.find(G=>G.id===m)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",L,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:P?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(G.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:P?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:H,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:P?"Guardar":"Save"})]})]})}function Kl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=react.useState(false),p=react.useRef(null),d=react.useRef(null),[m,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!p.current)return;let C=90,S=()=>{let E=p.current.getBoundingClientRect(),v=window.innerHeight-E.bottom<C+8;x(v),g({position:"fixed",...v?{bottom:window.innerHeight-E.top+4}:{top:E.bottom+4},left:E.left,width:E.width,zIndex:9999});};return S(),window.addEventListener("scroll",S,true),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,true),window.removeEventListener("resize",S);}},[c]),react.useEffect(()=>{if(!c)return;let C=S=>{let E=S.target;d.current&&!d.current.contains(E)&&p.current&&!p.current.contains(E)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let w=react.useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:p,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(rn,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var ms=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(Bo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function wp(e={}){return new ms(e)}var En=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function ql(e,t){let a=r=>jsxRuntime.jsx(En,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Xl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[f,b]=react.useState(""),[w,C]=react.useState("");react.useEffect(()=>{let v=P=>{(P.metaKey||P.ctrlKey)&&P.key===i&&(P.preventDefault(),m(L=>!L)),P.key==="Escape"&&(m(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),react.useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let S=react.useCallback(()=>{m(false);},[]),E=react.useCallback(v=>{let[P,L]=v.split(":");switch(P){case "create-card":h("create-card");break;case "create-card-in":b(L||"");break;case "navigate":L?(a?.(L),S()):h("navigate");break;case "search":r?.(g),S();break;case "priority":h("priority");break;case "set-priority":w&&L&&(o?.(w,L),S());break;case "assign":h("assign");break;case "assign-user":w&&L&&(s?.(w,L),S());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),S();break;case "ai-predict-risks":l?.(),S();break;case "ai-usage":c?.(),S();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,l,c,S]),k=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),S());},[f,g,t,S]);return d?jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:S,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:E,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:E,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:E,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:E,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:E,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},v.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.id}`,onSelect:E,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:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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(v=>{let P=e.columns.find(L=>L.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:E,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:P?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},v.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:E,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:E,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:E,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:E,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 Tp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Zh(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 ey(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 Ql(e){return e.startsWith("image/")}function io({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((v,P)=>{P.preventDefault(),P.stopPropagation();let L=g.current.filter(H=>Ql(H.type)),M=L.findIndex(H=>H.id===v.id),J=H=>{let Y=g.current.filter(G=>Ql(G.type)),T=Y[H];T&&Tp(T.url,T.name,Y,H,J);};Tp(v.url,v.name,L,M,J);},[]),x=react.useCallback(v=>{let P=[],L=[];return e.length+v.length>s?(L.push(`Maximum ${s} files allowed`),{valid:P,errors:L}):(v.forEach(M=>{if(M.size/1048576>r){L.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>M.type.match(H))){L.push(`${M.name} has invalid file type`);return}P.push(M);}),{valid:P,errors:L})},[e.length,s,r,o]),h=react.useCallback(async v=>{let{valid:P,errors:L}=x(v);if(L.length>0){d(L.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){i(true),d(null);try{await t?.(P);}catch(M){d(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(true);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);},[]),w=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),C=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);let P=Array.from(v.dataTransfer.files);h(P);},[h]),S=react.useCallback(v=>{let P=v.target.files?Array.from(v.target.files):[];h(P),m.current&&(m.current.value="");},[h]),E=react.useCallback(()=>{m.current?.click();},[]),k=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:C,onClick:E,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:S,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ql(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:P=>y(v,P),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:ey(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Zh(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(v.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"})})})]},v.id))})]})}function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=react.useState("details"),[C,S]=react.useState(false),[E,k]=react.useState({}),[v,P]=react.useState(""),[L,M]=react.useState(false),[J,H]=react.useState({});if(!t||!e)return null;let Y=react.useCallback(()=>{S(false),k({}),w("details"),P(""),H({}),a();},[a]),T=react.useCallback(()=>{r&&Object.keys(E).length>0&&(r(e.id,E),k({}),S(false));},[e.id,E,r]),G=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Y());},[e.id,o,Y]),te=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),P(""));},[e.id,v,p]),Le=react.useCallback(async()=>{if(y){M(true);try{let $=await y(e);H(ee=>({...ee,assignees:$}));}catch($){console.error("Failed to suggest assignee:",$);}finally{M(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){M(true);try{let $=await x(e);H(ee=>({...ee,subtasks:$}));}catch($){console.error("Failed to generate subtasks:",$);}finally{M(false);}}},[e,x]),q=react.useCallback(async()=>{if(h){M(true);try{let $=await h(e);H(ee=>({...ee,effort:$}));}catch($){console.error("Failed to estimate effort:",$);}finally{M(false);}}},[e,h]),be={...e,...E},_e=s.filter($=>be.assignedUserIds?.includes($.id));return jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:Y,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:E.title??be.title,onChange:$=>k({...E,title:$.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:be.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:T,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{S(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>S(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:G,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:Y,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${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:()=>w("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("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:E.description??be.description??"",onChange:$=>k({...E,description:$.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:be.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:E.assignedUserIds??be.assignedUserIds??[],onChange:$=>{let ee=Array.from($.target.selectedOptions,le=>le.value);k({...E,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map($=>jsxRuntime.jsx("option",{value:$.id,children:$.name},$.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:_e.length>0?_e.map($=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:$.color},children:$.initials}),jsxRuntime.jsx("span",{children:$.name})]},$.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxRuntime.jsxs("select",{value:E.priority??be.priority??"",onChange:$=>k({...E,priority:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:be.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:be.labels&&be.labels.length>0?be.labels.map($=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:$},$)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsxRuntime.jsx("input",{type:"date",value:E.startDate?new Date(E.startDate).toISOString().split("T")[0]:be.startDate?new Date(be.startDate).toISOString().split("T")[0]:"",onChange:$=>k({...E,startDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.startDate?new Date(be.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:E.endDate?new Date(E.endDate).toISOString().split("T")[0]:be.endDate?new Date(be.endDate).toISOString().split("T")[0]:"",onChange:$=>k({...E,endDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.endDate?new Date(be.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:E.estimatedTime??be.estimatedTime??"",onChange:$=>k({...E,estimatedTime:$.target.value?parseFloat($.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.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:be.dependencies&&be.dependencies.length>0?be.dependencies.map($=>{let ee=typeof $=="string"?$:$.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:be.createdAt?new Date(be.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:v,onChange:$=>P($.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:te,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map($=>{let ee=s.find(le=>le.id===$.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date($.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d($.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:$.content})]},$.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map($=>{let ee=s.find(le=>le.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("COMMENT")&&"\u{1F4AC}",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",$.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:ee?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(io,{cardId:e.id,attachments:i,onUpload:m?$=>m(e.id,$):void 0,onDelete:g,currentUserId:f,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:L||!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("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:L||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q,disabled:L||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),J.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),J.assignees.map(($,ee)=>{let le=s.find(ke=>ke.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[le&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:le.color},children:le.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:le?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:$.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",($.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),J.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),J.subtasks.map(($,ee)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:$.title}),$.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:$.description}),$.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",$.estimatedTime,"h"]})]},ee))]}),J.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:[J.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(J.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map($=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${$.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:$.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:$.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:$.description}),$.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",$.suggestedAction]})]},$.id))]}),!J.assignees&&!J.subtasks&&!J.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function gs({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=m-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var gt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var ly=["LOW","MEDIUM","HIGH","URGENT"],dy=["todo","in-progress","review","done"];function ad({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:C,onSubtasksChange:S,attachments:E=[],onUploadAttachments:k,onDeleteAttachment:v}){let P=wn(),L=C||P?.themeName||"dark",[M,J]=react.useState(e),[H,Y]=react.useState(false),[T,G]=react.useState(()=>[...e?.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0))),[te,Le]=react.useState(false),[B,q]=react.useState(""),[be,_e]=react.useState(""),[$,ee]=react.useState("all"),[le,ke]=react.useState(false),[xe,Be]=react.useState(false),[He,at]=react.useState(false),[ue,je]=react.useState(false),[Xe,he]=react.useState(false),[kt,xt]=react.useState(false),nt=react.useRef(null),ze=react.useRef(null),ct=react.useRef(null),et=react.useRef(null),Ee=react.useRef(null),V=react.useRef(null),D=react.useRef(null),U=react.useRef(null),ae=react.useRef(null),Ne=react.useRef(null),z=react.useRef(null),oe=react.useRef(null);react.useEffect(()=>{if(e&&!M){J({...e});let O=[...e.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0));G(O);}else if(e&&M&&e.id!==M.id){J({...e});let O=[...e.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0));G(O);}},[e,M]),react.useEffect(()=>{let O=_=>{let De=_.target;et.current&&!et.current.contains(De)&&ke(false),Ee.current&&!Ee.current.contains(De)&&Be(false),V.current&&!V.current.contains(De)&&at(false),D.current&&!D.current.contains(De)&&je(false);};if(le||xe||He||ue)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[le,xe,He,ue]),react.useEffect(()=>{if(!t)return;let O=_=>{let De=_.target,Qe=De.tagName==="INPUT"||De.tagName==="TEXTAREA"||De.isContentEditable;if(_.key==="Escape"){_.preventDefault(),le||xe||He||ue||Xe||kt?(ke(false),Be(false),at(false),je(false),he(false),xt(false)):Qe||a();return}if(Qe&&_.key!=="Escape")return;let bt=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),ke(true);break;case "a":_.preventDefault(),at(true);break;case "p":_.preventDefault(),Be(true);break;case "l":_.preventDefault(),je(true);break;case "d":bt||(_.preventDefault(),he(true),setTimeout(()=>U.current?.focus(),0));break;case "e":bt||(_.preventDefault(),xt(true));break;case "i":_.preventDefault(),Y(true),setTimeout(()=>ze.current?.focus(),0);break;case "t":_.preventDefault(),Le(true);break;case "c":_.preventDefault(),ct.current?.focus();break}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[t,a,le,xe,He,ue,Xe,kt]);let Ge=react.useCallback(O=>{let _=O.currentTarget.textContent?.trim()||"";if(M&&_!==M.title){let De={...M,title:_};J(De),r?.(M.id,{title:_});}},[M,r]),ge=react.useCallback(O=>{O.key==="Enter"&&(O.preventDefault(),O.currentTarget.blur()),O.key==="Escape"&&(O.preventDefault(),O.currentTarget.textContent=M?.title||"",O.currentTarget.blur());},[M]),Ve=react.useCallback(()=>{M&&e&&M.description!==e.description&&r?.(M.id,{description:M.description}),Y(false);},[M,e,r]),Oe=react.useCallback(O=>{if(M){let _={...M,columnId:O};J(_),r?.(M.id,{columnId:O}),ke(false);}},[M,r]),Ue=react.useCallback(O=>{if(M){let _={...M,priority:O};J(_),r?.(M.id,{priority:O}),Be(false);}},[M,r]),lt=react.useCallback(O=>{if(M){let _=M.assignedUserIds||[],De=_.includes(O)?_.filter(bt=>bt!==O):[..._,O],Qe={...M,assignedUserIds:De};J(Qe),r?.(M.id,{assignedUserIds:De});}},[M,r]),ot=react.useCallback(O=>{if(M){let _=M.labels||[],De=_.includes(O)?_.filter(bt=>bt!==O):[..._,O],Qe={...M,labels:De};J(Qe),r?.(M.id,{labels:De});}},[M,r]),st=react.useCallback(O=>{if(M){let _={...M,tags:O};J(_),r?.(M.id,{tags:O});}},[M,r]),pt=react.useCallback(O=>{if(M){let _=O.target.value,De={...M,endDate:_};J(De),r?.(M.id,{endDate:_}),he(false);}},[M,r]),Tt=react.useCallback(O=>{if(M){let _={...M,estimatedTime:parseFloat(O)||0};J(_),r?.(M.id,{estimatedTime:parseFloat(O)||0});}},[M,r]),Ot=react.useCallback(()=>{if(B.trim()&&M){let O={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:T.length,createdAt:new Date},_=[...T,O];G(_),q(""),Le(false),S?.(M.id,_);}},[B,T,M,S]),St=react.useCallback(O=>{let _=T.map(De=>De.id===O?{...De,completed:!De.completed,updatedAt:new Date}:De);G(_),M&&S?.(M.id,_);},[T,M,S]),Et=react.useCallback(O=>{let _=T.filter(De=>De.id!==O);G(_),M&&S?.(M.id,_);},[T,M,S]),Ft=react.useCallback(()=>{be.trim()&&M&&c&&(c(M.id,be.trim()),_e(""));},[be,M,c]),mt=react.useCallback(O=>{(O.metaKey||O.ctrlKey)&&O.key==="Enter"&&(O.preventDefault(),Ft());},[Ft]),Vt=O=>jsxRuntime.jsx(ny__default.default,{remarkPlugins:[sy__default.default],rehypePlugins:[iy__default.default],components:{a:({node:_,...De})=>jsxRuntime.jsx("a",{...De,target:"_blank",rel:"noopener noreferrer"})},children:O}),ht=l.filter(O=>$==="comments"?O.type.includes("COMMENT"):$==="history"?!O.type.includes("COMMENT"):true);if(!t||!e)return null;let it=M||e,ne=s.filter(O=>it.assignedUserIds?.includes(O.id)),pe=T.filter(O=>O.completed).length;return jsxRuntime.jsx(Zt,{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:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":L,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:nt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ge,onKeyDown:ge,children:it.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:et,children:[jsxRuntime.jsxs("button",{ref:ae,className:"modal-v2-field",onClick:()=>ke(!le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.columnId||"No status"})]}),jsxRuntime.jsx(gs,{triggerRef:ae,isOpen:le,onClose:()=>ke(false),width:250,estimatedHeight:200,children:(y.length>0?y:dy.map(O=>({id:O,title:O}))).map(O=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${it.columnId===O.id?"active":""}`,onClick:()=>Oe(O.id),children:O.title},O.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:V,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>at(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ne.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ne.map(O=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:O.color},title:O.name,children:O.initials},O.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(gs,{triggerRef:Ne,isOpen:He,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(O=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${it.assignedUserIds?.includes(O.id)?"active":""}`,onClick:()=>lt(O.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:O.color},children:O.initials}),O.name,it.assignedUserIds?.includes(O.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"})})]},O.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:z,className:"modal-v2-field",onClick:()=>Be(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.priority||"None"})]}),jsxRuntime.jsxs(gs,{triggerRef:z,isOpen:xe,onClose:()=>Be(false),width:180,estimatedHeight:220,children:[ly.map(O=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${O.toLowerCase()} ${it.priority===O?"active":""}`,onClick:()=>Ue(O),children:O},O)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),h.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Po,{selectedTags:it.tags||[],availableTags:h,onChange:st,onCreateTag:f,theme:gt[L]||gt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:oe,className:"modal-v2-field",onClick:()=>je(!ue),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.labels&&it.labels.length>0?jsxRuntime.jsx("span",{children:it.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(gs,{triggerRef:oe,isOpen:ue,onClose:()=>je(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(O=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${it.labels?.includes(O)?"active":""}`,onClick:()=>ot(O),children:[O,it.labels?.includes(O)&&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"})})]},O))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{he(!Xe),setTimeout(()=>U.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:it.endDate?new Date(it.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:U,type:"date",value:typeof it.endDate=="string"?it.endDate.split("T")[0]:it.endDate?(()=>{let O=new Date(it.endDate),_=O.getUTCFullYear(),De=String(O.getUTCMonth()+1).padStart(2,"0"),Qe=String(O.getUTCDate()).padStart(2,"0");return `${_}-${De}-${Qe}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>xt(!kt),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:it.estimatedTime?`${it.estimatedTime}h`:"Not set"})]}),kt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:it.estimatedTime||"",onChange:O=>Tt(O.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>xt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),H?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:it.description||"",onChange:O=>{if(M){let _={...M,description:O.target.value};J(_);}},onBlur:Ve,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>Y(true),children:it.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Vt(it.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:[pe,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Le(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[T.map(O=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${O.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>St(O.id),children:O.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:O.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Et(O.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"})]})})]},O.id)),te&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:O=>q(O.target.value),onKeyDown:O=>{O.key==="Enter"&&Ot(),O.key==="Escape"&&(Le(false),q(""));},onBlur:Ot,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||E.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),E.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:E.length})]}),jsxRuntime.jsx(io,{cardId:it.id,attachments:E,onUpload:k?O=>k(it.id,O):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="all"?"active":""}`,onClick:()=>ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="comments"?"active":""}`,onClick:()=>ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="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:ct,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:O=>_e(O.target.value),onKeyDown:mt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Ft,disabled:!be.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ht.map(O=>{let _=s.find(Qe=>Qe.id===O.userId);if(O.type.includes("COMMENT")){let Qe=n.find(bt=>bt.id===O.metadata?.commentId);return Qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(O.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Qe.content})]})]},O.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.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:_?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:O.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.id)}),ht.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 yy({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 od({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Sy({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 nd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ry={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Lp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Oy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ip({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 sd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ry[c.name]||Lp[e.indexOf(c)%Lp.length]})),l=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Oy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ip,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ip,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var xi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let S=new Set;e.forEach(k=>{k.labels?.forEach(v=>S.add(v));});let E=Array.from(new Set([...S,...C]));r.onBulkUpdate?.(y,{labels:E}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(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:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});xi.displayName="BulkOperationsToolbar";function Wy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function id({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Wy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Io,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Io,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ld=[{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 dd({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=ld.find(i=>i.value===e)||ld[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:ld.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var fs=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function jy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Hp(e={}){let{shortcuts:t=fs,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),l=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(jy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Ky(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function qy(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 Yy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=qy(e),r=t?Ky(t):"";return a?`${a} + ${r}`:r}function Xy(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 cd({shortcuts:e=fs,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Xy(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Yy(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ud=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Zh(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 ey(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 Ql(e){return e.startsWith("image/")}function lo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(null),m=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((v,P)=>{P.preventDefault(),P.stopPropagation();let L=g.current.filter(H=>Ql(H.type)),M=L.findIndex(H=>H.id===v.id),J=H=>{let Y=g.current.filter(G=>Ql(G.type)),T=Y[H];T&&Tp(T.url,T.name,Y,H,J);};Tp(v.url,v.name,L,M,J);},[]),x=react.useCallback(v=>{let P=[],L=[];return e.length+v.length>s?(L.push(`Maximum ${s} files allowed`),{valid:P,errors:L}):(v.forEach(M=>{if(M.size/1048576>r){L.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>M.type.match(H))){L.push(`${M.name} has invalid file type`);return}P.push(M);}),{valid:P,errors:L})},[e.length,s,r,o]),h=react.useCallback(async v=>{let{valid:P,errors:L}=x(v);if(L.length>0){d(L.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){i(true),d(null);try{await t?.(P);}catch(M){d(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(true);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);},[]),w=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),C=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);let P=Array.from(v.dataTransfer.files);h(P);},[h]),S=react.useCallback(v=>{let P=v.target.files?Array.from(v.target.files):[];h(P),m.current&&(m.current.value="");},[h]),E=react.useCallback(()=>{m.current?.click();},[]),k=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:C,onClick:E,children:[jsxRuntime.jsx("input",{ref:m,type:"file",multiple:true,onChange:S,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ql(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:P=>y(v,P),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:ey(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Zh(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>k(v.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"})})})]},v.id))})]})}function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=react.useState("details"),[C,S]=react.useState(false),[E,k]=react.useState({}),[v,P]=react.useState(""),[L,M]=react.useState(false),[J,H]=react.useState({});if(!t||!e)return null;let Y=react.useCallback(()=>{S(false),k({}),w("details"),P(""),H({}),a();},[a]),T=react.useCallback(()=>{r&&Object.keys(E).length>0&&(r(e.id,E),k({}),S(false));},[e.id,E,r]),G=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Y());},[e.id,o,Y]),te=react.useCallback(()=>{p&&v.trim()&&(p(e.id,v.trim()),P(""));},[e.id,v,p]),Le=react.useCallback(async()=>{if(y){M(true);try{let $=await y(e);H(ee=>({...ee,assignees:$}));}catch($){console.error("Failed to suggest assignee:",$);}finally{M(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){M(true);try{let $=await x(e);H(ee=>({...ee,subtasks:$}));}catch($){console.error("Failed to generate subtasks:",$);}finally{M(false);}}},[e,x]),q=react.useCallback(async()=>{if(h){M(true);try{let $=await h(e);H(ee=>({...ee,effort:$}));}catch($){console.error("Failed to estimate effort:",$);}finally{M(false);}}},[e,h]),be={...e,...E},_e=s.filter($=>be.assignedUserIds?.includes($.id));return jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:Y,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsxRuntime.jsx("input",{type:"text",value:E.title??be.title,onChange:$=>k({...E,title:$.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:be.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[C?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:T,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{S(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>S(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:G,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:Y,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${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:()=>w("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("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:E.description??be.description??"",onChange:$=>k({...E,description:$.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:be.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:E.assignedUserIds??be.assignedUserIds??[],onChange:$=>{let ee=Array.from($.target.selectedOptions,le=>le.value);k({...E,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map($=>jsxRuntime.jsx("option",{value:$.id,children:$.name},$.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:_e.length>0?_e.map($=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:$.color},children:$.initials}),jsxRuntime.jsx("span",{children:$.name})]},$.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxRuntime.jsxs("select",{value:E.priority??be.priority??"",onChange:$=>k({...E,priority:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:be.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:be.labels&&be.labels.length>0?be.labels.map($=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:$},$)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsxRuntime.jsx("input",{type:"date",value:E.startDate?new Date(E.startDate).toISOString().split("T")[0]:be.startDate?new Date(be.startDate).toISOString().split("T")[0]:"",onChange:$=>k({...E,startDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.startDate?new Date(be.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:E.endDate?new Date(E.endDate).toISOString().split("T")[0]:be.endDate?new Date(be.endDate).toISOString().split("T")[0]:"",onChange:$=>k({...E,endDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.endDate?new Date(be.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:E.estimatedTime??be.estimatedTime??"",onChange:$=>k({...E,estimatedTime:$.target.value?parseFloat($.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:be.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:be.dependencies&&be.dependencies.length>0?be.dependencies.map($=>{let ee=typeof $=="string"?$:$.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:be.createdAt?new Date(be.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:v,onChange:$=>P($.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:te,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map($=>{let ee=s.find(le=>le.id===$.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date($.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d($.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:$.content})]},$.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map($=>{let ee=s.find(le=>le.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("COMMENT")&&"\u{1F4AC}",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",$.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:ee?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(lo,{cardId:e.id,attachments:i,onUpload:m?$=>m(e.id,$):void 0,onDelete:g,currentUserId:f,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:L||!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("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:L||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:q,disabled:L||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),J.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),J.assignees.map(($,ee)=>{let le=s.find(ke=>ke.id===$.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[le&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:le.color},children:le.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:le?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:$.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",($.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),J.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),J.subtasks.map(($,ee)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:$.title}),$.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:$.description}),$.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",$.estimatedTime,"h"]})]},ee))]}),J.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:[J.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(J.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map($=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${$.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:$.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:$.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:$.description}),$.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",$.suggestedAction]})]},$.id))]}),!J.assignees&&!J.subtasks&&!J.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function fs({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=react.useState({top:0,left:0}),i=react.useRef(null),p=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=m-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(p());},[t,p]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var gt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var ly=["LOW","MEDIUM","HIGH","URGENT"],dy=["todo","in-progress","review","done"];function ad({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:C,onSubtasksChange:S,attachments:E=[],onUploadAttachments:k,onDeleteAttachment:v}){let P=kn(),L=C||P?.themeName||"dark",[M,J]=react.useState(e),[H,Y]=react.useState(false),[T,G]=react.useState(()=>[...e?.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0))),[te,Le]=react.useState(false),[B,q]=react.useState(""),[be,_e]=react.useState(""),[$,ee]=react.useState("all"),[le,ke]=react.useState(false),[xe,Be]=react.useState(false),[He,at]=react.useState(false),[ue,je]=react.useState(false),[Xe,he]=react.useState(false),[kt,xt]=react.useState(false),nt=react.useRef(null),ze=react.useRef(null),ct=react.useRef(null),et=react.useRef(null),Ee=react.useRef(null),V=react.useRef(null),D=react.useRef(null),U=react.useRef(null),ae=react.useRef(null),Ne=react.useRef(null),z=react.useRef(null),oe=react.useRef(null);react.useEffect(()=>{if(e&&!M){J({...e});let O=[...e.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0));G(O);}else if(e&&M&&e.id!==M.id){J({...e});let O=[...e.subtasks||[]].sort((_,De)=>(_.position??0)-(De.position??0));G(O);}},[e,M]),react.useEffect(()=>{let O=_=>{let De=_.target;et.current&&!et.current.contains(De)&&ke(false),Ee.current&&!Ee.current.contains(De)&&Be(false),V.current&&!V.current.contains(De)&&at(false),D.current&&!D.current.contains(De)&&je(false);};if(le||xe||He||ue)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[le,xe,He,ue]),react.useEffect(()=>{if(!t)return;let O=_=>{let De=_.target,Qe=De.tagName==="INPUT"||De.tagName==="TEXTAREA"||De.isContentEditable;if(_.key==="Escape"){_.preventDefault(),le||xe||He||ue||Xe||kt?(ke(false),Be(false),at(false),je(false),he(false),xt(false)):Qe||a();return}if(Qe&&_.key!=="Escape")return;let bt=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),ke(true);break;case "a":_.preventDefault(),at(true);break;case "p":_.preventDefault(),Be(true);break;case "l":_.preventDefault(),je(true);break;case "d":bt||(_.preventDefault(),he(true),setTimeout(()=>U.current?.focus(),0));break;case "e":bt||(_.preventDefault(),xt(true));break;case "i":_.preventDefault(),Y(true),setTimeout(()=>ze.current?.focus(),0);break;case "t":_.preventDefault(),Le(true);break;case "c":_.preventDefault(),ct.current?.focus();break}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[t,a,le,xe,He,ue,Xe,kt]);let Ge=react.useCallback(O=>{let _=O.currentTarget.textContent?.trim()||"";if(M&&_!==M.title){let De={...M,title:_};J(De),r?.(M.id,{title:_});}},[M,r]),ge=react.useCallback(O=>{O.key==="Enter"&&(O.preventDefault(),O.currentTarget.blur()),O.key==="Escape"&&(O.preventDefault(),O.currentTarget.textContent=M?.title||"",O.currentTarget.blur());},[M]),Ve=react.useCallback(()=>{M&&e&&M.description!==e.description&&r?.(M.id,{description:M.description}),Y(false);},[M,e,r]),Oe=react.useCallback(O=>{if(M){let _={...M,columnId:O};J(_),r?.(M.id,{columnId:O}),ke(false);}},[M,r]),Ue=react.useCallback(O=>{if(M){let _={...M,priority:O};J(_),r?.(M.id,{priority:O}),Be(false);}},[M,r]),lt=react.useCallback(O=>{if(M){let _=M.assignedUserIds||[],De=_.includes(O)?_.filter(bt=>bt!==O):[..._,O],Qe={...M,assignedUserIds:De};J(Qe),r?.(M.id,{assignedUserIds:De});}},[M,r]),ot=react.useCallback(O=>{if(M){let _=M.labels||[],De=_.includes(O)?_.filter(bt=>bt!==O):[..._,O],Qe={...M,labels:De};J(Qe),r?.(M.id,{labels:De});}},[M,r]),st=react.useCallback(O=>{if(M){let _={...M,tags:O};J(_),r?.(M.id,{tags:O});}},[M,r]),pt=react.useCallback(O=>{if(M){let _=O.target.value,De={...M,endDate:_};J(De),r?.(M.id,{endDate:_}),he(false);}},[M,r]),Tt=react.useCallback(O=>{if(M){let _={...M,estimatedTime:parseFloat(O)||0};J(_),r?.(M.id,{estimatedTime:parseFloat(O)||0});}},[M,r]),Ot=react.useCallback(()=>{if(B.trim()&&M){let O={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:T.length,createdAt:new Date},_=[...T,O];G(_),q(""),Le(false),S?.(M.id,_);}},[B,T,M,S]),St=react.useCallback(O=>{let _=T.map(De=>De.id===O?{...De,completed:!De.completed,updatedAt:new Date}:De);G(_),M&&S?.(M.id,_);},[T,M,S]),Et=react.useCallback(O=>{let _=T.filter(De=>De.id!==O);G(_),M&&S?.(M.id,_);},[T,M,S]),Ft=react.useCallback(()=>{be.trim()&&M&&c&&(c(M.id,be.trim()),_e(""));},[be,M,c]),mt=react.useCallback(O=>{(O.metaKey||O.ctrlKey)&&O.key==="Enter"&&(O.preventDefault(),Ft());},[Ft]),Vt=O=>jsxRuntime.jsx(ny__default.default,{remarkPlugins:[sy__default.default],rehypePlugins:[iy__default.default],components:{a:({node:_,...De})=>jsxRuntime.jsx("a",{...De,target:"_blank",rel:"noopener noreferrer"})},children:O}),ht=l.filter(O=>$==="comments"?O.type.includes("COMMENT"):$==="history"?!O.type.includes("COMMENT"):true);if(!t||!e)return null;let it=M||e,ne=s.filter(O=>it.assignedUserIds?.includes(O.id)),pe=T.filter(O=>O.completed).length;return jsxRuntime.jsx(Zt,{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:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":L,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:nt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ge,onKeyDown:ge,children:it.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:et,children:[jsxRuntime.jsxs("button",{ref:ae,className:"modal-v2-field",onClick:()=>ke(!le),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.columnId||"No status"})]}),jsxRuntime.jsx(fs,{triggerRef:ae,isOpen:le,onClose:()=>ke(false),width:250,estimatedHeight:200,children:(y.length>0?y:dy.map(O=>({id:O,title:O}))).map(O=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${it.columnId===O.id?"active":""}`,onClick:()=>Oe(O.id),children:O.title},O.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:V,children:[jsxRuntime.jsxs("button",{ref:Ne,className:"modal-v2-field",onClick:()=>at(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ne.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:ne.map(O=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:O.color},title:O.name,children:O.initials},O.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(fs,{triggerRef:Ne,isOpen:He,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(O=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${it.assignedUserIds?.includes(O.id)?"active":""}`,onClick:()=>lt(O.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:O.color},children:O.initials}),O.name,it.assignedUserIds?.includes(O.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"})})]},O.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:z,className:"modal-v2-field",onClick:()=>Be(!xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.priority||"None"})]}),jsxRuntime.jsxs(fs,{triggerRef:z,isOpen:xe,onClose:()=>Be(false),width:180,estimatedHeight:220,children:[ly.map(O=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${O.toLowerCase()} ${it.priority===O?"active":""}`,onClick:()=>Ue(O),children:O},O)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ue(""),children:"None"})]})]}),h.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Ao,{selectedTags:it.tags||[],availableTags:h,onChange:st,onCreateTag:f,theme:gt[L]||gt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxRuntime.jsxs("button",{ref:oe,className:"modal-v2-field",onClick:()=>je(!ue),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:it.labels&&it.labels.length>0?jsxRuntime.jsx("span",{children:it.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(fs,{triggerRef:oe,isOpen:ue,onClose:()=>je(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(O=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${it.labels?.includes(O)?"active":""}`,onClick:()=>ot(O),children:[O,it.labels?.includes(O)&&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"})})]},O))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{he(!Xe),setTimeout(()=>U.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:it.endDate?new Date(it.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:U,type:"date",value:typeof it.endDate=="string"?it.endDate.split("T")[0]:it.endDate?(()=>{let O=new Date(it.endDate),_=O.getUTCFullYear(),De=String(O.getUTCMonth()+1).padStart(2,"0"),Qe=String(O.getUTCDate()).padStart(2,"0");return `${_}-${De}-${Qe}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>xt(!kt),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:it.estimatedTime?`${it.estimatedTime}h`:"Not set"})]}),kt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:it.estimatedTime||"",onChange:O=>Tt(O.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>xt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),H?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:it.description||"",onChange:O=>{if(M){let _={...M,description:O.target.value};J(_);}},onBlur:Ve,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>Y(true),children:it.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Vt(it.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:[pe,"/",T.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Le(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[T.map(O=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${O.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>St(O.id),children:O.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:O.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Et(O.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"})]})})]},O.id)),te&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:O=>q(O.target.value),onKeyDown:O=>{O.key==="Enter"&&Ot(),O.key==="Escape"&&(Le(false),q(""));},onBlur:Ot,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||E.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),E.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:E.length})]}),jsxRuntime.jsx(lo,{cardId:it.id,attachments:E,onUpload:k?O=>k(it.id,O):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="all"?"active":""}`,onClick:()=>ee("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="comments"?"active":""}`,onClick:()=>ee("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${$==="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:ct,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:O=>_e(O.target.value),onKeyDown:mt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Ft,disabled:!be.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ht.map(O=>{let _=s.find(Qe=>Qe.id===O.userId);if(O.type.includes("COMMENT")){let Qe=n.find(bt=>bt.id===O.metadata?.commentId);return Qe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(O.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Qe.content})]})]},O.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.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:_?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:O.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.id)}),ht.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 yy({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 od({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Sy({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 nd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Sy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ry={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Lp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Oy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ip({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 sd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ry[c.name]||Lp[e.indexOf(c)%Lp.length]})),l=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Oy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ip,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ip,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var xi=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[c,i]=react.useState(false),[p,d]=react.useState(false),[m,g]=react.useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let S=new Set;e.forEach(k=>{k.labels?.forEach(v=>S.add(v));});let E=Array.from(new Set([...S,...C]));r.onBulkUpdate?.(y,{labels:E}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(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:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});xi.displayName="BulkOperationsToolbar";function Wy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function id({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>Wy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Bo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Bo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ld=[{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 dd({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=ld.find(i=>i.value===e)||ld[0];react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:ld.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var bs=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function jy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Hp(e={}){let{shortcuts:t=bs,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),l=react.useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(jy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Ky(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function qy(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 Yy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=qy(e),r=t?Ky(t):"";return a?`${a} + ${r}`:r}function Xy(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 cd({shortcuts:e=bs,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Xy(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Yy(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var ud=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,12 +122,12 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function pd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,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:i})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function gd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await cu(e,c,x);uu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await gu(h),b=h.name.endsWith(".json")?"json":"csv",w=mu(f,b);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var tx=["URGENT","HIGH","MEDIUM","LOW"],ax=[{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"}],rx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function fd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),f=react.useCallback(E=>{a({search:E.target.value});},[a]),b=react.useCallback(E=>{a({dateFilter:E.target.value});},[a]),w=react.useCallback(E=>{r({by:E.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),S=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),S&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,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:E=>{let k=E.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),tx.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let k=E.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let k=E.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:ax.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.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"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:E=>y(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:rx.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))})}),S&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function bd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var hd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},xd={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"}},nn={dark:hd,light:yd,neutral:xd},wi="dark";var ki=react.createContext(void 0),mx="asakaa-theme";function Wp({children:e,defaultTheme:t=wi,storageKey:a=mx}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=nn[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${gx(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:nn};return jsxRuntime.jsx(ki.Provider,{value:n,children:e})}function Pn(){let e=react.useContext(ki);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function vd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Pn();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(nn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Vp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return gt[e]||gt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",gt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",gt[e].bgSecondary),bgGrid:r("--theme-bg-card",gt[e].bgGrid),bgWeekend:r("--theme-bg-hover",gt[e].bgWeekend),border:r("--theme-border-primary",gt[e].border),borderLight:r("--theme-border-subtle",gt[e].borderLight),textPrimary:r("--theme-text-primary",gt[e].textPrimary),textSecondary:r("--theme-text-secondary",gt[e].textSecondary),textTertiary:r("--theme-text-tertiary",gt[e].textTertiary),accent:r("--theme-accent-primary",gt[e].accent),accentHover:r("--theme-accent-hover",gt[e].accentHover),accentLight:r("--theme-accent-primary",gt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",gt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",gt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",gt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",gt[e].dependency),dependencyHover:r("--theme-border-secondary",gt[e].dependencyHover),criticalPath:r("--theme-error",gt[e].criticalPath),criticalPathLight:r("--theme-error",gt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",gt[e].today):e==="neutral"?r("--theme-text-primary",gt[e].today):r("--theme-error",gt[e].today),todayLight:e==="light"?r("--theme-accent-primary",gt[e].todayLight):e==="neutral"?r("--theme-text-primary",gt[e].todayLight):r("--theme-error",gt[e].todayLight),milestone:r("--theme-warning",gt[e].milestone),milestoneLight:r("--theme-warning",gt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",gt[e].statusTodo),statusInProgress:r("--theme-accent-primary",gt[e].statusInProgress),statusCompleted:r("--theme-success",gt[e].statusCompleted),hoverBg:r("--theme-bg-hover",gt[e].hoverBg),focusRing:r("--theme-accent-primary",gt[e].focusRing),...gt[e].dotGrid&&{dotGrid:gt[e].dotGrid},...gt[e].glassHeader&&{glassHeader:gt[e].glassHeader},...gt[e].glassToolbar&&{glassToolbar:gt[e].glassToolbar},...gt[e].forecastHud&&{forecastHud:gt[e].forecastHud},...gt[e].neonRedGlow&&{neonRedGlow:gt[e].neonRedGlow},...gt[e].executionBarBg&&{executionBarBg:gt[e].executionBarBg}}}var Ci={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Gp={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},wd={en:Ci,es:Gp};function jp(e){return wd[e]||wd.en}function kd(e,t){let a=jp(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 Ln=react.createContext(Ci);function Or(){return react.useContext(Ln)}function ys(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function em({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),m=react.useRef(null),g=Or(),y=ys(d,l,"right",176);if(react.useEffect(()=>{if(!l)return;let b=w=>{let C=w.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){p(b);try{await w();}catch(C){console.error(`Export ${b} failed:`,C);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((b,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Kp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[c,i]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),y=Or(),x=ys(m,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let S=E=>{let k=E.target;m.current&&!m.current.contains(k)&&g.current&&!g.current.contains(k)&&l(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(S=>S.handler),w=async(S,E)=>{if(E){i(S);try{await E();}catch(k){console.error(`Export ${S} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:b.map((S,E)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(S.id,S.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:E*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===S.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):S.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.label})]},S.id))})]}),b.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:p?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ox({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function $x({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function qp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=Or(),i=ys(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let y=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:m.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Yp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=Or(),p=ys(l,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Hx({value:e,onChange:t,theme:a}){let r=Or(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function zx({theme:e,forecast:t}){let a=Or(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,p=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Ux({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=Or(),f=ys(y,m,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let E=k=>{let v=k.target;y.current&&!y.current.contains(v)&&x.current&&!x.current.contains(v)&&g(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]);let w=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],S=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:C.map((E,k)=>{let v=E.icon,P=E.disabled,L=E.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!P&&E.onChange?.(!E.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:P?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:P?"not-allowed":"pointer"},whileHover:P?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:L,children:[jsxRuntime.jsx(v,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:P?b?"rgba(255,255,255,0.2)":"#D1D5DB":E.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:E.label}),E.active&&!P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},E.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),S.map((E,k)=>{let v=i===E.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(E.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:v?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:E.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},E.value)})]})]})}),document.body)]})}function Ti({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:S="execution",onViewModeChange:E,projectForecast:k,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportCSV:M,onExportJSON:J,onExportMSProject:H,showCriticalPath:Y=true,onShowCriticalPathChange:T,showDependencies:G=true,onShowDependenciesChange:te,highlightWeekends:Le=true,onHighlightWeekendsChange:B,showBaseline:q=false,onShowBaselineChange:be,onCopySnapshotLink:_e,hasDependencies:$=true}){let ee=Or(),le=v||P||L||M||J||H,ke=!!e.glassToolbar,[xe,Be]=react.useState(false),He=react.useRef(null);react.useEffect(()=>{xe&&He.current&&He.current.focus();},[xe]);let at=[{value:"day",label:ee.toolbar.day},{value:"week",label:ee.toolbar.week},{value:"month",label:ee.toolbar.month}],ue=[{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"})}],je=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(ke){let Xe=je?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:je?"#1A1A1A":e.bgSecondary,border:`1px solid ${je?"rgba(255,255,255,0.08)":e.border}`},animate:{width:xe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Be(!xe),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),xe&&jsxRuntime.jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Be(false),onKeyDown:he=>{he.key==="Escape"&&Be(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),E&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:je?"#000000":e.bgSecondary,border:`1px solid ${je?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>E("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:S==="execution"?je?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:S==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:S!=="execution"?{color:e.textSecondary}:{},children:ee.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>E("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:S==="oracle"?je?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:S==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:S!=="oracle"?{color:e.textSecondary}:{},children:ee.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Hx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),w&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),jsxRuntime.jsx(Ux,{theme:e,showCriticalPath:Y,onShowCriticalPathChange:T,showBaseline:q,onShowBaselineChange:be,highlightWeekends:Le,onHighlightWeekendsChange:B,showDependencies:G,onShowDependenciesChange:te,rowDensity:l,onRowDensityChange:c,hasDependencies:$}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportMSProject:H,onCopySnapshotLink:_e}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${je?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${je?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||ee.toolbar.createTask})]})]})]}),k&&jsxRuntime.jsx(zx,{theme:e,forecast:k})]})}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($x,{options:at,value:t,onChange:Xe=>a(Xe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||ee.toolbar.createTask})]}),(le||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportMSProject:H,onCopySnapshotLink:_e}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Ox,{options:ue,value:s,onChange:Xe=>n(Xe),theme:e})]})]})}function Ni({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Bn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+p+m>g&&(x=t-p,x<m&&(x=m)),a+d+m>y&&(h=y-d-m,h<m&&(h=m)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ma={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function im({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),y=react.useCallback(w=>{g.current=w;},[]),x=react.useCallback(w=>{let C=[],S=E=>{for(let k of E)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&S(k.subtasks);};return S(w),C},[]),h=react.useCallback(()=>{let w=x(e);for(let C of w)if(t.has(C.id))return C;return null},[e,t,x]),f=react.useCallback((w,C)=>{let S=x(e);if(S.length===0)return;let E=h();if(!E){a(S[0].id,false);return}let k=S.findIndex(L=>L.id===E.id);if(k===-1)return;let v=w==="up"?k-1:k+1;if(v<0||v>=S.length)return;let P=S[v];a(P.id,C);},[e,h,x,a]),b=react.useCallback(w=>{if(!m)return;let C=w.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){w.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,v=Array.from(t),P=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(P&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){P.subtasks&&P.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!P.isExpanded||w.key==="ArrowLeft"&&P.isExpanded)&&p(P.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){v.length>0&&(w.preventDefault(),n(v,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){v.length>0&&(w.preventDefault(),l(v));return}if(w.key==="Tab"&&w.shiftKey){v.length>0&&(w.preventDefault(),c(v));return}if(w.key==="Enter"&&!w.shiftKey&&!k){P&&(w.preventDefault(),r(P.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!k){P&&(w.preventDefault(),r(P.id,"above"));return}if(w.key==="Enter"&&k){P&&(w.preventDefault(),d(P.id));return}if(w.key==="F2"){P&&(w.preventDefault(),i(P.id));return}if(w.key==="Delete"||w.key==="Backspace"&&k){v.length>0&&(w.preventDefault(),o(v));return}if(w.key==="d"&&k&&!w.shiftKey){v.length>0&&(w.preventDefault(),s(v));return}},[m,t,h,f,r,o,s,n,l,c,i,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[m,b]),{setIsEditing:y}}function dm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),y=m.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=m.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,y)=>{y?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function Sd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Sd(t.subtasks):t.subtasks}))}function Rn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function On(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=On(a.subtasks,t);if(r)return r}}return null}function Dd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Dd(a.subtasks,t);if(r)return r}return null}function Ed(e,t){if(t.length===0)return e;let a=Rn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},l=(m,g,y)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return Sd(d)}function Md(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Dd(a,r);if(!o)continue;let s=Dd(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,p,d);if(y)return y}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Sd(a)}function Fd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Pd(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 vs(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function cm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function Ad(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ad(r.subtasks,t,a)}:r)}function Ld(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ld(a.subtasks,t)}:a)}function Id(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function um(e,t,a,r){if(t===a)return e;let o=On(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function $r(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=$r(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Si({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:C,onCreateSubtask:S,onOpenTaskModal:E,onDeleteRequest:k,onTaskReparent:v,scrollContainerRef:P,showCriticalPath:L=false}){let M=react.useContext(Ln),[J,H]=react.useState(null),[Y,T]=react.useState(null),[G,te]=react.useState(""),Le=react.useRef(null),[B,q]=react.useState(null),[be,_e]=react.useState(0),[$,ee]=react.useState(0),[le,ke]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[xe,Be]=react.useState(null),[He,at]=react.useState(null),[ue,je]=react.useState(null),Xe=react.useRef(0),he=5,kt=react.useRef(false),[xt,nt]=react.useState(null),[ze,ct]=react.useState(false),et=react.useRef(null),[Ee,V]=react.useState(null),[D,U]=react.useState(false),ae=react.useRef(null);react.useEffect(()=>{function ne(pe){ae.current&&!ae.current.contains(pe.target)&&U(false);}if(D)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[D]),react.useEffect(()=>{Y&&Le.current&&(Le.current.focus(),Le.current.select());},[Y]),react.useEffect(()=>{if(!B)return;let ne=O=>{let _=O.clientX-be,De=$+_;m?.(B,De);},pe=()=>{q(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",pe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[B,be,$,m]);let{selectedTaskIds:Ne,handleTaskClick:z,isTaskSelected:oe}=dm(),{setIsEditing:Ge}=im({tasks:e,selectedTaskIds:Ne,onTaskSelect:(ne,pe)=>{let _=Rn(e).map(De=>De.id);z(ne,_,pe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ne=>{let pe=Rn(e).find(O=>O.id===ne);pe&&ot(pe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ne=>{let pe=Rn(e).find(O=>O.id===ne);pe&&E&&E(pe);},enableKeyboard:true}),ge=(ne,pe=0,O="")=>{let _=[],De=[...ne].sort((Qe,bt)=>(Qe.position??0)-(bt.position??0));for(let Qe=0;Qe<De.length;Qe++){let bt=De[Qe],Dt=Qe+1,Pt=O?`${O}.${Dt}`:`${Dt}.0`;if(bt.wbsCode=Pt,_.push({task:bt,level:pe}),bt.subtasks&&bt.subtasks.length>0&&bt.isExpanded){let At=O?`${O}.${Dt}`:`${Dt}`;_.push(...ge(bt.subtasks,pe+1,At));}}return _},Ve=ge(e),Oe=48,Ue=Math.max(Ve.length*a,600-Oe),lt=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,ot=ne=>{T(ne.id),te(ne.name),Ge(true);},st=ne=>{G.trim()&&G!==e.find(pe=>pe.id===ne)?.name&&C?.(ne,G.trim()),T(null),te(""),Ge(false);},pt=()=>{T(null),te(""),Ge(false);},Tt=(ne,pe)=>{pe.stopPropagation(),S?.(ne.id);},Ot=(ne,pe)=>{pe.preventDefault(),Xe.current=pe.clientY,Be(ne),kt.current=false,ct(false),nt({x:pe.clientX,y:pe.clientY});},St=ne=>{if(!xe||(Math.abs(ne.clientY-Xe.current)>he&&!kt.current&&(kt.current=true,ct(true)),nt({x:ne.clientX,y:ne.clientY}),!kt.current))return;if(P?.current){let Qe=P.current,bt=Qe.getBoundingClientRect(),Dt=60,Pt=12;et.current&&(cancelAnimationFrame(et.current),et.current=null);let At=ne.clientY-bt.top,ta=bt.bottom-ne.clientY;if(At<Dt&&Qe.scrollTop>0){let la=Math.round(Pt*(1-At/Dt)),Q=()=>{Qe.scrollTop-=la,kt.current&&Qe.scrollTop>0&&(et.current=requestAnimationFrame(Q));};et.current=requestAnimationFrame(Q);}else if(ta<Dt&&Qe.scrollTop<Qe.scrollHeight-Qe.clientHeight){let la=Math.round(Pt*(1-ta/Dt)),Q=()=>{Qe.scrollTop+=la,kt.current&&Qe.scrollTop<Qe.scrollHeight-Qe.clientHeight&&(et.current=requestAnimationFrame(Q));};et.current=requestAnimationFrame(Q);}}let O=document.querySelectorAll("[data-task-row]"),_=null,De=null;O.forEach(Qe=>{let bt=Qe.getBoundingClientRect(),Dt=Qe.getAttribute("data-task-row");if(Dt&&Dt!==xe&&ne.clientY>=bt.top&&ne.clientY<=bt.bottom){_=Dt;let Pt=ne.clientY-bt.top,At=bt.height;Pt<At*.25?De="above":Pt>At*.75?De="below":De="child";}}),at(_),je(De);},Et=()=>{if(kt.current&&xe&&He&&ue){if(ue==="child")v?.(xe,He);else if(ue==="above"||ue==="below"){let ne=(De,Qe,bt=null)=>{for(let Dt of De){if(Dt.id===Qe)return bt;if(Dt.subtasks){let Pt=ne(Dt.subtasks,Qe,Dt.id);if(Pt!==void 0)return Pt}}},pe=ne(e,xe,null),O=ne(e,He,null),_=(De,Qe,bt,Dt)=>{let Pt=De.findIndex(la=>la.id===Qe),At=Dt?De.findIndex(la=>la.id===bt):-1,ta=ue==="below"?Pt+1:Pt;return Dt&&At!==-1&&At<Pt&&(ta-=1),Math.max(0,ta)};if(O===null){let Qe=_(e,He,xe,pe===null);v?.(xe,null,Qe);}else {let De=On(e,O);if(De?.subtasks){let Qe=pe===O,bt=_(De.subtasks,He,xe,Qe);v?.(xe,O,bt);}}}}et.current&&(cancelAnimationFrame(et.current),et.current=null),Be(null),at(null),je(null),nt(null),kt.current=false,ct(false);};react.useEffect(()=>{if(xe)return document.addEventListener("mousemove",St),document.addEventListener("mouseup",Et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",Et),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,He,ue]);let Ft=(ne,pe,O)=>{let _=pe.subtasks&&pe.subtasks.length>0;switch(ne.id){case "name":let De=Y===pe.id,Qe=J===pe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${O*20}px`},children:[v&&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:Qe?1:.3},onMouseDown:I=>Ot(pe.id,I),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),pe.subtasks&&pe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),c?.(pe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:pe.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"}),De?jsxRuntime.jsx("input",{ref:Le,type:"text",value:G,onChange:I=>te(I.target.value),onKeyDown:I=>{I.key==="Enter"?st(pe.id):I.key==="Escape"&&pt();},onBlur:()=>st(pe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:I=>I.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:pe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:pe.parentId?"13px":"14px",fontWeight:pe.isMilestone?600:pe.parentId?400:600,letterSpacing:pe.parentId?"0":"-0.01em"},title:pe.name,children:[pe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:pe.wbsCode}),pe.isHighlighted&&pe.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe.name}),pe.subtasks&&pe.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(pe.progress||0),"%"]}),L&&pe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),L&&pe.cpmData&&jsxRuntime.jsxs("span",{style:{color:pe.cpmData.totalFloat<=0?"#EF4444":pe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(pe.cpmData.totalFloat),"d"]})]}),Qe&&!De&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>Tt(pe,I),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),ot(pe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Dt=ne.id==="startDate"?"startDate":"endDate",Pt=pe[Dt],At=Ee?.taskId===pe.id&&Ee?.field===Dt,ta=I=>I?(typeof I=="string"?new Date(I):I).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!_)if(At)V(null);else {let ye=I.currentTarget.getBoundingClientRect();V({taskId:pe.id,field:Dt,month:Pt?typeof Pt=="string"?new Date(Pt):Pt:new Date,position:{top:ye.bottom+4,left:ye.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ta(Pt)}),_&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),At&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>V(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ee?.position.top,left:Ee?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,ye=new Date(I);ye.setDate(I.getDate()+1);let Z=new Date(I);Z.setDate(I.getDate()+7);let N=new Date(I);return N.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:ye},{label:"Pr\xF3xima semana",date:Z},{label:"2 semanas",date:N}].map((Te,Pe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:$t=>$t.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:$t=>$t.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(pe.id,{[Dt]:Te.date}),V(null);},children:Te.label},Pe))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(pe.id,{[Dt]:void 0}),V(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>V(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ee?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>V(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((I,ye)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},ye))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=Ee?.month||new Date,ye=I.getFullYear(),Z=I.getMonth(),N=new Date(ye,Z,1).getDay(),K=new Date(ye,Z+1,0).getDate(),Te=new Date,Pe=[];for(let Ct=N-1;Ct>=0;Ct--)Pe.push({day:new Date(ye,Z,-Ct).getDate(),date:new Date(ye,Z-1,new Date(ye,Z,-Ct).getDate()),isCurrentMonth:false});for(let Ct=1;Ct<=K;Ct++)Pe.push({day:Ct,date:new Date(ye,Z,Ct),isCurrentMonth:true});let $t=42-Pe.length;for(let Ct=1;Ct<=$t;Ct++)Pe.push({day:Ct,date:new Date(ye,Z+1,Ct),isCurrentMonth:false});return Pe.map((Ct,Jt)=>{let Wa=Ct.date.toDateString()===Te.toDateString(),wa=(Pt?typeof Pt=="string"?new Date(Pt):Pt:null)?.toDateString()===Ct.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ct.isCurrentMonth?wa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:wa?"#2E94FF":"transparent",boxShadow:Wa&&!wa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(pe.id,{[Dt]:Ct.date}),V(null);},children:Ct.day},Jt)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:lt(pe)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let la=r.filter(I=>pe.assignees?.some(ye=>ye.name===I.name||ye.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Zo,{assignedUsers:la,availableUsers:r,onChange:I=>{let ye=I.map(Z=>({id:Z.id,name:Z.name,initials:Z.initials,color:Z.color}));g?.(pe.id,{assignees:ye.length>0?ye:void 0});}})});case "status":if(_){let I=pe.progress===100?"\u2713":pe.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Lu,{status:pe.status||"todo",onChange:I=>{g?.(pe.id,{status:I,progress:I==="completed"?100:pe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${pe.progress}%`,backgroundColor:pe.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:[pe.progress,"%"]})]});case "priority":let Q={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},$e={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Fe=Q[pe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Jo,{priority:Fe,onChange:I=>{I&&g?.(pe.id,{priority:$e[I]||"medium"});}})});default:return null}},mt=ne=>[{id:"hide",label:"Hide Column",icon:ma.Hide,onClick:()=>d(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ma.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ma.SortDesc,onClick:()=>{}}],Vt=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{S?.(ne.id);}},{id:"duplicate",label:M?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{S?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:M?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}],ht=p.filter(ne=>ne.visible),it=ht.reduce((ne,pe)=>ne+pe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:it},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Oe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:ht.map((ne,pe)=>{let O=pe===ht.length-1,_=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(_?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:_&&ht.length===1?1:0,flexGrow:_&&ht.length===1?1:0,borderRight:O?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:De=>{De.preventDefault(),ke({isOpen:true,x:De.clientX,y:De.clientY,type:"header",columnId:ne.id});},onMouseEnter:De=>{De.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:De=>{De.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:De=>{De.preventDefault(),De.stopPropagation(),q(ne.id),_e(De.clientX),ee(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:B===ne.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Ni,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>U(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),D&&jsxRuntime.jsxs("div",{ref:ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>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",style:{minHeight:Ue},children:Ve.map(({task:ne,level:pe},O)=>{let _=oe(ne.id),De=He===ne.id,Qe=De&&ue==="above",bt=De&&ue==="below",Dt=De&&ue==="child",Pt={};return Dt&&(Pt.backgroundColor=`${t.accent}15`,Pt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${xe===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Dt?`${t.accent}15`:O%2===0?t.bgPrimary:t.bgGrid,opacity:L?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Pt},onMouseEnter:()=>H(ne.id),onMouseLeave:()=>H(null),onClick:At=>{let la=Rn(e).map(Fe=>Fe.id),$e=navigator.platform.toUpperCase().indexOf("MAC")>=0?At.metaKey:At.ctrlKey;z(ne.id,la,$e,At.shiftKey),s?.(ne);},onDoubleClick:At=>{At.stopPropagation(),n?.(ne);},onContextMenu:At=>{At.preventDefault(),ke({isOpen:true,x:At.clientX,y:At.clientY,type:"task",task:ne}),l?.(ne,At);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[Qe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),bt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ht.map((At,ta)=>{let la=ta===ht.length-1,Q=At.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Q?"justify-start":"justify-center"}`,style:{width:`${At.width}px`,minWidth:`${At.minWidth??(Q?200:60)}px`,maxWidth:`${At.maxWidth??2e3}px`,flexShrink:Q&&ht.length===1?1:0,flexGrow:Q&&ht.length===1?1:0,borderRight:la?"none":`1px solid ${J===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ft(At,ne,Q?pe:0)},`${ne.id}-${At.id}`)})]},ne.id)})}),jsxRuntime.jsx(Bn,{isOpen:le.isOpen,x:le.x,y:le.y,items:le.type==="header"&&le.columnId?mt(le.columnId):le.type==="task"&&le.task?Vt(le.task):[],onClose:()=>ke({...le,isOpen:false}),theme:t}),ze&&xt&&xe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:xt.x+12,top:xt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=Ve.find(pe=>pe.task.id===xe)?.task;return ne?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function bm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(0),[C,S]=react.useState(0),[E,k]=react.useState(null),[v,P]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:C,setSegmentDragOffsetX:S,hoveredSegmentIndex:E,setHoveredSegmentIndex:k,isHovered:v,setIsHovered:P,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,T)=>{r("none"),d(null),g(null),l(Y),i(T),S(0),f(null),w(0);}}}function Ei({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false,onProgressChange:C}){let S=bm(t,r),E=react.useRef(null),k=react.useRef(false),v=react.useRef(null),P=react.useRef(null),{dragMode:L,setDragMode:M,dragOffset:J,setDragOffset:H,ghostX:Y,setGhostX:T,ghostWidth:G,setGhostWidth:te,connectionLine:Le,setConnectionLine:B,hoveredTaskId:q,setHoveredTaskId:be,activeZone:_e,setActiveZone:$,draggedSegmentIndex:ee,setDraggedSegmentIndex:le,draggedSegmentStartX:ke,setDraggedSegmentStartX:xe,segmentDragOffsetX:Be,setSegmentDragOffsetX:He,hoveredSegmentIndex:at,setHoveredSegmentIndex:ue,isHovered:je,setIsHovered:Xe,isDragging:he,isResizing:kt,isConnecting:xt,resetDragState:nt}=S,ze=18,ct=!!o.executionBarBg,et=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ee=ct?3:6,V=e.subtasks&&e.subtasks.length>0,D=react.useRef(null),[U,ae]=(()=>{let Q=react.useRef(null),[,$e]=react.useState(0);return [Q.current,Fe=>{Q.current=Fe,$e(I=>I+1);}]})(),Ne=!!C&&!w&&!V&&!e.segments&&!!e.startDate&&!!e.endDate,z=e.endDate&&(()=>{let Q=new Date;Q.setHours(0,0,0,0);let $e=new Date(e.endDate);return $e.setHours(0,0,0,0),$e<Q})()&&e.progress<100,oe=b&&e.isCriticalPath,Ge=o.name==="neutral"||o.today==="#1C1917",ge=e.status==="completed"||e.progress===100,Ve={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ue=b&&e.isCriticalPath||z?"#EF4444":e.color?e.color:e.priority&&Ve[e.priority]?Ve[e.priority]:o.taskBarPrimary,lt=w?"default":he?xt?"crosshair":kt?"ew-resize":"grabbing":"grab",ot=w?"default":"ew-resize",pt=(Q=>Q>=80?20:Q>=60?15:Q>=50?12:10)(r),Tt=r<50,Ot=r<40;react.useEffect(()=>{x&&(!je||he||e.segments)&&x(null);},[je,he,e.segments,x]);let St=Q=>Q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Et=()=>{let Q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Q} day${Q!==1?"s":""}`},Ft=Q=>Math.round(Q/s)*s,mt=Q=>{let $e=Math.round(Q/s),Fe=new Date(n);return Fe.setDate(Fe.getDate()+$e),Fe},Vt=(Q,$e)=>{for(let Fe of g){if(Fe.id===e.id)continue;let I=5;if(Q>=Fe.x-I&&Q<=Fe.x+Fe.width+I&&$e>=Fe.y-I&&$e<=Fe.y+Fe.height+I)return Fe.id}return null},ht=react.useCallback((Q,$e,Fe)=>{if(w)return;Q.preventDefault(),Q.stopPropagation();let I=E.current?.ownerSVGElement;if(!I)return;let ye=I.createSVGPoint();ye.x=Q.clientX,ye.y=Q.clientY;let Z=ye.matrixTransform(I.getScreenCTM()?.inverse()),N=Fe!==void 0?Fe:t,K=$e;if(!K){let Te=Z.x-N;Q.shiftKey?(K="connect",B({x:t+r,y:a+ze/2})):Q.ctrlKey||Q.metaKey?K="move":Q.altKey?K=Te<r/2?"resize-start":"resize-end":Ot?Te<r/2?K="move":K="resize-end":Tt?Te<=pt/2?K="resize-start":Te>=r-pt/2?K="resize-end":K="move":Te<=pt?K="resize-start":Te>=r-pt?K="resize-end":K="move";}k.current=false,M(K),Xe(false),$(null),K==="move"?H(Z.x-N):K==="connect"?B({x:t+r,y:a+ze/2}):H(0),T(N),te(r);},[t,r,a,ze,w]),it=react.useCallback(Q=>{let $e=E.current?.ownerSVGElement;if(!$e)return;let Fe=$e.closest(".gantt-timeline-scroll");if(!Fe)return;let I=Fe.getBoundingClientRect(),ye=60,Z=15,N=0;if(Q.clientX<I.left+ye){let K=I.left+ye-Q.clientX;N=-Math.min(Z,K/2);}else if(Q.clientX>I.right-ye){let K=Q.clientX-(I.right-ye);N=Math.min(Z,K/2);}return N!==0&&(Fe.scrollLeft+=N),N!==0},[]),ne=react.useCallback(Q=>{if(L==="none")return;k.current=true,P.current=Q;let $e=E.current?.ownerSVGElement;if(!$e)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let ye=it(Q);ye&&!v.current?v.current=window.setInterval(()=>{P.current&&(it(P.current),ne(P.current));},16):!ye&&v.current&&(window.clearInterval(v.current),v.current=null);}let Fe=$e.createSVGPoint();Fe.x=Q.clientX,Fe.y=Q.clientY;let I=Fe.matrixTransform($e.getScreenCTM()?.inverse());if(L==="connect"){B({x:I.x,y:I.y});let ye=Vt(I.x,I.y);be(ye);}else if(L==="move"){let ye=I.x-J,Z=Ft(ye);T(Z),te(r);let N=Math.round((Z-t)/s);if(y?.(e.id,N,true),e.segments&&e.segments.length>0&&ee!==null){let K=Z-ke;He(K);}}else if(L==="resize-start"){let ye=I.x,Z=Ft(ye),N=t+r-Z;N>=s&&(T(Z),te(N));}else if(L==="resize-end"){let ye=I.x,N=Ft(ye)-t;N>=s&&te(N);}},[L,t,r,s,J,e,Ft,ee,ke,Vt,be,B,T,te,He,y,it]),pe=react.useCallback(()=>{if(v.current&&(window.clearInterval(v.current),v.current=null),P.current=null,L!=="none"){if(L==="connect")q&&m&&m(e,q),B(null),be(null);else {let Q=e.endDate.getTime()-e.startDate.getTime(),$e,Fe,I=true;if(L==="move"){if($e=mt(Y),Fe=new Date($e.getTime()+Q),e.segments&&e.segments.length>0&&ee!==null){let ye=Math.round(Be/s),Z=e.segments.map((Pe,$t)=>{if($t===ee){let Ct=new Date(Pe.startDate),Jt=new Date(Pe.endDate);return Ct.setDate(Ct.getDate()+ye),Jt.setDate(Jt.getDate()+ye),{startDate:Ct,endDate:Jt}}return Pe}),N=Z.flatMap(Pe=>[Pe.startDate,Pe.endDate]),K=new Date(Math.min(...N.map(Pe=>Pe.getTime()))),Te=new Date(Math.max(...N.map(Pe=>Pe.getTime())));d?.({...e,segments:Z},K,Te),nt(t,r);return}}else L==="resize-start"?($e=mt(Y),Fe=e.endDate,$e>Fe&&(console.warn("Invalid date range: start date must be before or equal to end date"),I=false)):L==="resize-end"?($e=e.startDate,Fe=mt(Y+G),Fe.setDate(Fe.getDate()-1),Fe<$e&&(console.warn("Invalid date range: end date must be after or equal to start date"),I=false)):I=false;I&&$e&&Fe&&(Fe.getTime()<$e.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,$e,Fe));}y?.(e.id,0,false),nt(t,r);}},[L,Y,G,e,d,q,m,t,r,s,mt,Be,ee,nt,y]);react.useEffect(()=>{if(L==="none")return;let Q=Fe=>{ne(Fe);},$e=()=>{pe();};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",$e),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",$e),v.current&&(window.clearInterval(v.current),v.current=null);}},[L,ne,pe]);let O=he&&!xt?Y:t,_=he&&!xt?G:r,De=l.taskClass(e),Qe=24,bt=b?e.isCriticalPath?1:.25:1,Dt=react.useCallback(Q=>{if(!Ne)return;Q.stopPropagation(),Q.preventDefault();let Fe=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;D.current={barRect:Fe,initialPct:e.progress||0},Q.currentTarget.setPointerCapture(Q.pointerId),ae(e.progress||0);},[Ne,e.progress,ae]),Pt=react.useCallback(Q=>{let $e=D.current;if(!$e)return;let I=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??$e.barRect;if(!I||I.width<=0)return;let ye=(Q.clientX-I.left)/I.width,Z=Math.round(Math.max(0,Math.min(1,ye))*100);Q.shiftKey&&(Z=Math.round(Z/25)*25),ae(Z);},[ae]),At=react.useCallback(Q=>{let $e=D.current;if(!$e)return;Q.stopPropagation(),Q.preventDefault();try{Q.currentTarget.releasePointerCapture(Q.pointerId);}catch{}let Fe=U;D.current=null,ae(null),Fe!=null&&Fe!==$e.initialPct&&C&&C(e,Fe);},[U,C,e,ae]),ta=react.useCallback(Q=>{Q.stopPropagation(),Q.preventDefault();},[]),la=U??(e.progress||0);return jsxRuntime.jsxs("g",{ref:E,"data-task-bar":"true",style:{opacity:bt,transition:"opacity 300ms ease"},onClick:()=>{!he&&!k.current&&c?.(e),k.current=false;},onDoubleClick:Q=>{!he&&!k.current&&(Q.stopPropagation(),i?.(e));},onContextMenu:Q=>{Q.preventDefault(),p?.(e,Q);},onMouseEnter:()=>!he&&Xe(true),onMouseMove:Q=>{x&&je&&!he&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ze,showBelow:false,mouseX:Q.clientX,mouseY:Q.clientY});},onMouseLeave:()=>{he||(Xe(false),$(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Qe,height:ze,fill:"transparent",style:{pointerEvents:"all"}}),je&&!he&&!Tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:ze,fill:_e==="resize-start"?o.accent:"transparent",opacity:_e==="resize-start"?.15:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:Q=>ht(Q,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:ze,fill:_e==="move"?o.accent:"transparent",opacity:_e==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:Q=>ht(Q,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:ze,fill:_e==="resize-end"?o.accent:"transparent",opacity:_e==="resize-end"?.15:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:Q=>ht(Q,"resize-end")})]}),je&&!he&&Ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ze,fill:_e==="move"?o.accent:"transparent",opacity:_e==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:Q=>ht(Q,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ze,fill:_e==="resize-end"?o.accent:"transparent",opacity:_e==="resize-end"?.2:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:Q=>ht(Q,"resize-end")}),je&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ze-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),he&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:a,width:G,height:ze,rx:Ee,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!he&&(()=>{let Q=e.baselineStartDate.getTime(),$e=e.baselineEndDate.getTime(),Fe=n.getTime(),I=864e5,ye=(Q-Fe)/I,Z=($e-Q)/I,N=ye*s,K=Math.max(Z*s,s),Te=O+_,Pe=N+K,$t=e.endDate?.getTime()??0,Ct=Math.ceil(($t-$e)/I),Jt=Ct>0,Wa=Ct<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:N,y:a,width:K,height:ze,rx:Ee,fill:"none",stroke:et?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Jt&&Te>Pe&&jsxRuntime.jsx("rect",{x:Pe,y:a,width:Te-Pe,height:ze,rx:0,fill:"#EF4444",opacity:.2}),Jt&&jsxRuntime.jsxs("text",{x:Math.max(Te,Pe)+6,y:a+ze/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ct,"d"]}),Wa&&jsxRuntime.jsxs("text",{x:Te+6,y:a+ze/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ct,"d"]})]})})(),!e.segments&&ct&&V&&(()=>{let $e=a+(ze-8)/2,Fe=4,I=e.progress||0,ye=new Date;ye.setHours(0,0,0,0);let Z=e.startDate&&ye>=e.startDate,N=e.endDate&&(()=>{let Jt=new Date(e.endDate);return Jt.setHours(0,0,0,0),ye>Jt})(),K=e.startDate&&ye<e.startDate,Te=1;if(Z&&e.startDate&&e.endDate&&!K){let Jt=new Date(e.startDate);Jt.setHours(0,0,0,0);let Wa=new Date(e.endDate);Wa.setHours(0,0,0,0);let ha=Math.max(1,(Wa.getTime()-Jt.getTime())/(1e3*60*60*24)),lr=Math.min((ye.getTime()-Jt.getTime())/(1e3*60*60*24),ha)/ha*100;Te=lr>0?I/lr:1;}let Pe;I>=100?Pe="#00E5CC":K?Pe="#4B5563":N&&I<100?Pe="#EF4444":Te>=.95?Pe="#22C55E":Te>=.8?Pe="#F59E0B":Pe="#EF4444";let $t=Math.max(I/100*_,I>0?Fe*2:0),Ct=_>100&&I>0;return jsxRuntime.jsxs("g",{"data-task-class":De,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:O,y:$e,width:_,height:8,rx:Fe,fill:"rgba(255,255,255,0.10)"}),I>0&&jsxRuntime.jsx("rect",{x:O,y:$e,width:$t,height:8,rx:Fe,fill:Pe}),Ct&&jsxRuntime.jsxs("text",{x:O+$t+6,y:$e+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(I),"%"]})]})})(),!e.segments&&ct&&!V&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:_,height:ze,rx:Ee,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":De,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:he&&!xt?.15:e.parentId?.6:1,scale:je&&!he?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Q=>ht(Q),style:{cursor:lt,pointerEvents:"all"}}),!e.segments&&!ct&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:_,height:ze,rx:Ee,fill:Ue,"data-task-class":De,initial:{opacity:0,scale:.95},animate:{opacity:he&&!xt?.15:e.parentId?.6:je?.9:.8,scale:je&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V?void 0:Q=>ht(Q),style:{cursor:V?"default":lt,pointerEvents:"all"}}),ct&&(z||oe)&&!e.segments&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&la>0&&!V&&jsxRuntime.jsx("rect",{x:O,y:a,width:Math.max(_*(la/100),Ee*2),height:ze,rx:Ee,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!V&&e.progress<100&&(()=>{let Q=e.progress>0?_*(e.progress/100):0,$e=O+Q,Fe=_-Q,I=e.progress===0?Ee:0,ye=e.progress===0?O:$e,Z=e.progress===0?_:Fe;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:ye,y:a,width:Z,height:ze,rx:I,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:ye,y:a,width:Z,height:ze,rx:I,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ct&&!e.segments&&e.progress>0&&e.progress<100&&!V&&!he&&U===null&&(()=>{let Q=O+_*(e.progress/100),$e=8,Fe=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:Q,cy:a+ze/2,r:$e,fill:Fe?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:Q,y:a+ze/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Fe?.initials||Fe?.name?.charAt(0)?.toUpperCase()||""})]})})(),Ne&&!he&&_>=40&&(U!==null||la<88)&&(()=>{let Q=O+_*(la/100),$e=a+ze/2,Fe=U!==null,I=Fe?7:je?6:5,ye=Fe||je?1:.35,Z=O+_-Q,N=Math.max(4,Math.min(12,Z-10)),K=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Q-K,y:$e-12,width:K+N,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Dt,onPointerMove:Pt,onPointerUp:At,onPointerCancel:At,onClick:ta,onDoubleClick:ta,onMouseDown:Te=>Te.stopPropagation()}),jsxRuntime.jsx("circle",{cx:Q,cy:$e,r:I,fill:"#FFFFFF",stroke:Ue,strokeWidth:2,opacity:ye,style:{pointerEvents:"none",filter:Fe?`drop-shadow(0 0 4px ${Ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Fe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Q-20,y:$e-28,width:40,height:18,rx:4,fill:et?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ue,strokeWidth:1}),jsxRuntime.jsxs("text",{x:Q,y:$e-16,textAnchor:"middle",dominantBaseline:"central",fill:et?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[U,"%"]})]})]})})(),e.segments&&e.segments.map((Q,$e)=>{let Fe=(Q.startDate.getTime()-n.getTime())/864e5*s,ye=(Q.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Fe+s,Z=he&&L==="move"&&ee===$e,N=at===$e,K=Z?Fe+Be:Fe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!he&&ue($e),onMouseLeave:()=>!he&&ue(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:ye,height:ze,rx:Ee,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:Z||e.parentId?.6:N?.9:.8,scale:N&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Te=>{Te.stopPropagation(),le($e),xe(Fe),ht(Te,void 0,Fe);},style:{cursor:lt,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:ye*(e.progress/100),height:ze,rx:Ee,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${$e}`)}),Ge&&(z||oe)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[oe&&!z&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),z&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&_>60&&!e.segments&&!(ct&&V)&&(()=>{let Q=l.taskLabel(e),$e=typeof Q=="string"?Q:e.name,Fe=$e.length>Math.floor(_/8)?`${$e.substring(0,Math.floor(_/8))}...`:$e;return jsxRuntime.jsx("text",{x:O+8,y:a+ze/2,dominantBaseline:"middle",fill:ge?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ge?"line-through":"none"},children:Fe})})(),!he&&!e.segments&&!V&&e.progress>0&&e.progress<100&&(ct?jsxRuntime.jsxs("text",{x:O+_+6,y:a+ze/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):_>100?jsxRuntime.jsxs("text",{x:O+_-12,y:a+ze/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&_>80&&!he&&!e.segments&&!(ct&&V)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:O+_-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:O+_-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(je||kt)&&!xt&&!e.segments&&!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:O-2,y:a,width:16,height:ze,fill:"transparent",style:{cursor:ot},onMouseEnter:()=>$("resize-start"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:O+4,y:a+8,width:3,height:ze-16,rx:1.5,fill:_e==="resize-start"||L==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:O+_-14,y:a,width:16,height:ze,fill:"transparent",style:{cursor:ot},onMouseEnter:()=>$("resize-end"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:O+_-7,y:a+8,width:3,height:ze-16,rx:1.5,fill:_e==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&!he&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ze/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>$("connect"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ze/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),xt&&Le&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ze/2,x2:Le.x,y2:Le.y,stroke:q?o.statusCompleted:o.accent,strokeWidth:q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:q?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Le.x,cy:Le.y,r:q?8:6,fill:q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),q&&jsxRuntime.jsx(framerMotion.motion.text,{x:Le.x+15,y:Le.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Le.x+10},animate:{opacity:1,x:Le.x+15},transition:{duration:.2},children:"Connect"})]}),(je||he)&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O-1,y:a-1,width:_+2,height:ze+2,rx:Ee+1,fill:"none",stroke:he?o.accent:ct?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ct?1:2,opacity:he||ct?.6:.4,initial:{opacity:0},animate:{opacity:he||ct?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),kt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:Y,y1:0,x2:Y,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Y+G,y1:0,x2:Y+G,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&!he&&!e.segments&&!x&&(()=>{let Fe=a<100,I=Fe?a+ze+13:a-82-13,ye=Fe?`M ${O+_/2-6} ${a+ze+3} L ${O+_/2} ${a+ze+13} L ${O+_/2+6} ${a+ze+3}`:`M ${O+_/2-6} ${a-13} L ${O+_/2} ${a-3} L ${O+_/2+6} ${a-13}`,Z=I+22,N=I+40,K=I+55,Te=I+70,Pe=Fe?I+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Fe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Fe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ye,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:O+_/2-120,y:I,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:O+_/2,y:Z,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:O+_/2-110,y:N,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:O+_/2-70,y:N,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St(e.startDate)}),jsxRuntime.jsx("text",{x:O+_/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:O+_/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St(e.endDate)}),jsxRuntime.jsx("text",{x:O+_/2+10,y:N,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:O+_/2+65,y:N,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et()}),jsxRuntime.jsx("text",{x:O+_/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:O+_/2+65,y:K,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:O+_/2-110,y:Te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:O+_/2-50,y:Te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($t=>$t.name).join(", ").substring(0,30),e.assignees.map($t=>$t.name).join(", ").length>30?"...":""]})]}),!Fe&&jsxRuntime.jsx("text",{x:O+_/2,y:Pe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ot?"Left: move \u2022 Right: resize":Tt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Bd=260,Hn=8,xm=16,Mv=-12;function vm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:C}=e,S=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,E=b.lastActivity!=null,k=(S?155:105)+(E?28:0),v=w+xm,P=C+Mv-k;v+Bd>window.innerWidth-Hn&&(v=w-Bd-xm),v<Hn&&(v=Hn);let L=P<Hn;L&&(P=C+20),P+k>window.innerHeight-Hn&&(P=window.innerHeight-Hn-k),o({left:v,top:P,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},p=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),C=b%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Bd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(Mi,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]}),s.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:m},children:s.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:s.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function pd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,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:i})}),jsxRuntime.jsx("div",{children:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function gd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[c,i]=react.useState("json"),[p,d]=react.useState(null),m=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await cu(e,c,x);uu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await gu(h),b=h.name.endsWith(".json")?"json":"csv",w=mu(f,b);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var tx=["URGENT","HIGH","MEDIUM","LOW"],ax=[{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"}],rx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function fd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),f=react.useCallback(E=>{a({search:E.target.value});},[a]),b=react.useCallback(E=>{a({dateFilter:E.target.value});},[a]),w=react.useCallback(E=>{r({by:E.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),S=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),S&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,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:E=>{let k=E.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),tx.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let k=E.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let k=E.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:ax.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.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"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:E=>y(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:rx.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))})}),S&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function bd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>m(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var hd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},yd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},xd={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"}},sn={dark:hd,light:yd,neutral:xd},wi="dark";var ki=react.createContext(void 0),mx="asakaa-theme";function Wp({children:e,defaultTheme:t=wi,storageKey:a=mx}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=sn[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${gx(p)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,d])=>{let m=c.colors[p];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:sn};return jsxRuntime.jsx(ki.Provider,{value:n,children:e})}function An(){let e=react.useContext(ki);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function vd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=An();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(sn).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Vp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return gt[e]||gt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",gt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",gt[e].bgSecondary),bgGrid:r("--theme-bg-card",gt[e].bgGrid),bgWeekend:r("--theme-bg-hover",gt[e].bgWeekend),border:r("--theme-border-primary",gt[e].border),borderLight:r("--theme-border-subtle",gt[e].borderLight),textPrimary:r("--theme-text-primary",gt[e].textPrimary),textSecondary:r("--theme-text-secondary",gt[e].textSecondary),textTertiary:r("--theme-text-tertiary",gt[e].textTertiary),accent:r("--theme-accent-primary",gt[e].accent),accentHover:r("--theme-accent-hover",gt[e].accentHover),accentLight:r("--theme-accent-primary",gt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",gt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",gt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",gt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",gt[e].dependency),dependencyHover:r("--theme-border-secondary",gt[e].dependencyHover),criticalPath:r("--theme-error",gt[e].criticalPath),criticalPathLight:r("--theme-error",gt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",gt[e].today):e==="neutral"?r("--theme-text-primary",gt[e].today):r("--theme-error",gt[e].today),todayLight:e==="light"?r("--theme-accent-primary",gt[e].todayLight):e==="neutral"?r("--theme-text-primary",gt[e].todayLight):r("--theme-error",gt[e].todayLight),milestone:r("--theme-warning",gt[e].milestone),milestoneLight:r("--theme-warning",gt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",gt[e].statusTodo),statusInProgress:r("--theme-accent-primary",gt[e].statusInProgress),statusCompleted:r("--theme-success",gt[e].statusCompleted),hoverBg:r("--theme-bg-hover",gt[e].hoverBg),focusRing:r("--theme-accent-primary",gt[e].focusRing),...gt[e].dotGrid&&{dotGrid:gt[e].dotGrid},...gt[e].glassHeader&&{glassHeader:gt[e].glassHeader},...gt[e].glassToolbar&&{glassToolbar:gt[e].glassToolbar},...gt[e].forecastHud&&{forecastHud:gt[e].forecastHud},...gt[e].neonRedGlow&&{neonRedGlow:gt[e].neonRedGlow},...gt[e].executionBarBg&&{executionBarBg:gt[e].executionBarBg}}}var Ci={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Gp={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},wd={en:Ci,es:Gp};function jp(e){return wd[e]||wd.en}function kd(e,t){let a=jp(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 In=react.createContext(Ci);function $r(){return react.useContext(In)}function xs(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function em({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=react.useState(false),[i,p]=react.useState(null),d=react.useRef(null),m=react.useRef(null),g=$r(),y=xs(d,l,"right",176);if(react.useEffect(()=>{if(!l)return;let b=w=>{let C=w.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){p(b);try{await w();}catch(C){console.error(`Export ${b} failed:`,C);}finally{p(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((b,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Kp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=react.useState(false),[c,i]=react.useState(null),[p,d]=react.useState(false),m=react.useRef(null),g=react.useRef(null),y=$r(),x=xs(m,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let S=E=>{let k=E.target;m.current&&!m.current.contains(k)&&g.current&&!g.current.contains(k)&&l(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(S=>S.handler),w=async(S,E)=>{if(E){i(S);try{await E();}catch(k){console.error(`Export ${S} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:b.map((S,E)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(S.id,S.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:E*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===S.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):S.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:S.label})]},S.id))})]}),b.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:p?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ox({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function $x({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function qp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=$r(),i=xs(n,o,"left");react.useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((m,g)=>{let y=t===m.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:m.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Yp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=$r(),p=xs(l,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Hx({value:e,onChange:t,theme:a}){let r=$r(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function zx({theme:e,forecast:t}){let a=$r(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,p=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Ux({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=$r(),f=xs(y,m,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!m)return;let E=k=>{let v=k.target;y.current&&!y.current.contains(v)&&x.current&&!x.current.contains(v)&&g(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]);let w=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],S=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:C.map((E,k)=>{let v=E.icon,P=E.disabled,L=E.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!P&&E.onChange?.(!E.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:P?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:P?"not-allowed":"pointer"},whileHover:P?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:L,children:[jsxRuntime.jsx(v,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:P?b?"rgba(255,255,255,0.2)":"#D1D5DB":E.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:E.label}),E.active&&!P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},E.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),S.map((E,k)=>{let v=i===E.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(E.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsxRuntime.jsx("span",{style:{color:v?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:E.label}),v&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},E.value)})]})]})}),document.body)]})}function Ti({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:S="execution",onViewModeChange:E,projectForecast:k,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportCSV:M,onExportJSON:J,onExportMSProject:H,showCriticalPath:Y=true,onShowCriticalPathChange:T,showDependencies:G=true,onShowDependenciesChange:te,highlightWeekends:Le=true,onHighlightWeekendsChange:B,showBaseline:q=false,onShowBaselineChange:be,onCopySnapshotLink:_e,hasDependencies:$=true}){let ee=$r(),le=v||P||L||M||J||H,ke=!!e.glassToolbar,[xe,Be]=react.useState(false),He=react.useRef(null);react.useEffect(()=>{xe&&He.current&&He.current.focus();},[xe]);let at=[{value:"day",label:ee.toolbar.day},{value:"week",label:ee.toolbar.week},{value:"month",label:ee.toolbar.month}],ue=[{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"})}],je=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(ke){let Xe=je?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:je?"#1A1A1A":e.bgSecondary,border:`1px solid ${je?"rgba(255,255,255,0.08)":e.border}`},animate:{width:xe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Be(!xe),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),xe&&jsxRuntime.jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Be(false),onKeyDown:he=>{he.key==="Escape"&&Be(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),E&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:je?"#000000":e.bgSecondary,border:`1px solid ${je?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>E("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:S==="execution"?je?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:S==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:S!=="execution"?{color:e.textSecondary}:{},children:ee.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>E("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:S==="oracle"?je?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:S==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:S!=="oracle"?{color:e.textSecondary}:{},children:ee.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Hx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),w&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Xe}}),jsxRuntime.jsx(Ux,{theme:e,showCriticalPath:Y,onShowCriticalPathChange:T,showBaseline:q,onShowBaselineChange:be,highlightWeekends:Le,onHighlightWeekendsChange:B,showDependencies:G,onShowDependenciesChange:te,rowDensity:l,onRowDensityChange:c,hasDependencies:$}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportMSProject:H,onCopySnapshotLink:_e}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${je?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${je?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||ee.toolbar.createTask})]})]})]}),k&&jsxRuntime.jsx(zx,{theme:e,forecast:k})]})}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($x,{options:at,value:t,onChange:Xe=>a(Xe),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(qp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Yp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||ee.toolbar.createTask})]}),(le||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Kp,{theme:e,onExportPNG:v,onExportPDF:P,onExportExcel:L,onExportMSProject:H,onCopySnapshotLink:_e}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(Ox,{options:ue,value:s,onChange:Xe=>n(Xe),theme:e})]})]})}function Ni({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Zt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Rn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+p+m>g&&(x=t-p,x<m&&(x=m)),a+d+m>y&&(h=y-d-m,h<m&&(h=m)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ma={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function im({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=true}){let g=react.useRef(false),y=react.useCallback(w=>{g.current=w;},[]),x=react.useCallback(w=>{let C=[],S=E=>{for(let k of E)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&S(k.subtasks);};return S(w),C},[]),h=react.useCallback(()=>{let w=x(e);for(let C of w)if(t.has(C.id))return C;return null},[e,t,x]),f=react.useCallback((w,C)=>{let S=x(e);if(S.length===0)return;let E=h();if(!E){a(S[0].id,false);return}let k=S.findIndex(L=>L.id===E.id);if(k===-1)return;let v=w==="up"?k-1:k+1;if(v<0||v>=S.length)return;let P=S[v];a(P.id,C);},[e,h,x,a]),b=react.useCallback(w=>{if(!m)return;let C=w.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){w.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,v=Array.from(t),P=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(P&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){P.subtasks&&P.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!P.isExpanded||w.key==="ArrowLeft"&&P.isExpanded)&&p(P.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){v.length>0&&(w.preventDefault(),n(v,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){v.length>0&&(w.preventDefault(),l(v));return}if(w.key==="Tab"&&w.shiftKey){v.length>0&&(w.preventDefault(),c(v));return}if(w.key==="Enter"&&!w.shiftKey&&!k){P&&(w.preventDefault(),r(P.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!k){P&&(w.preventDefault(),r(P.id,"above"));return}if(w.key==="Enter"&&k){P&&(w.preventDefault(),d(P.id));return}if(w.key==="F2"){P&&(w.preventDefault(),i(P.id));return}if(w.key==="Delete"||w.key==="Backspace"&&k){v.length>0&&(w.preventDefault(),o(v));return}if(w.key==="d"&&k&&!w.shiftKey){v.length>0&&(w.preventDefault(),s(v));return}},[m,t,h,f,r,o,s,n,l,c,i,p,d]);return react.useEffect(()=>{if(m)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[m,b]),{setIsEditing:y}}function dm(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),y=m.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=m.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=react.useCallback((d,m,g,y)=>{y?n(d,m):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,m)=>{m?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function Sd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Sd(t.subtasks):t.subtasks}))}function On(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function $n(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=$n(a.subtasks,t);if(r)return r}}return null}function Dd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Dd(a.subtasks,t);if(r)return r}return null}function Ed(e,t){if(t.length===0)return e;let a=On(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},l=(m,g,y)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return Sd(d)}function Md(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Dd(a,r);if(!o)continue;let s=Dd(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,p,d);if(y)return y}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Sd(a)}function Fd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Pd(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 ws(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function cm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function Ad(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ad(r.subtasks,t,a)}:r)}function Ld(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ld(a.subtasks,t)}:a)}function Id(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function um(e,t,a,r){if(t===a)return e;let o=$n(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Hr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Hr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function Si({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:C,onCreateSubtask:S,onOpenTaskModal:E,onDeleteRequest:k,onTaskReparent:v,scrollContainerRef:P,showCriticalPath:L=false}){let M=react.useContext(In),[J,H]=react.useState(null),[Y,T]=react.useState(null),[G,te]=react.useState(""),Le=react.useRef(null),[B,q]=react.useState(null),[be,_e]=react.useState(0),[$,ee]=react.useState(0),[le,ke]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[xe,Be]=react.useState(null),[He,at]=react.useState(null),[ue,je]=react.useState(null),Xe=react.useRef(0),he=5,kt=react.useRef(false),[xt,nt]=react.useState(null),[ze,ct]=react.useState(false),et=react.useRef(null),[Ee,V]=react.useState(null),[D,U]=react.useState(false),ae=react.useRef(null);react.useEffect(()=>{function ne(pe){ae.current&&!ae.current.contains(pe.target)&&U(false);}if(D)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[D]),react.useEffect(()=>{Y&&Le.current&&(Le.current.focus(),Le.current.select());},[Y]),react.useEffect(()=>{if(!B)return;let ne=O=>{let _=O.clientX-be,De=$+_;m?.(B,De);},pe=()=>{q(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",pe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[B,be,$,m]);let{selectedTaskIds:Ne,handleTaskClick:z,isTaskSelected:oe}=dm(),{setIsEditing:Ge}=im({tasks:e,selectedTaskIds:Ne,onTaskSelect:(ne,pe)=>{let _=On(e).map(De=>De.id);z(ne,_,pe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ne=>{let pe=On(e).find(O=>O.id===ne);pe&&ot(pe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ne=>{let pe=On(e).find(O=>O.id===ne);pe&&E&&E(pe);},enableKeyboard:true}),ge=(ne,pe=0,O="")=>{let _=[],De=[...ne].sort((Qe,bt)=>(Qe.position??0)-(bt.position??0));for(let Qe=0;Qe<De.length;Qe++){let bt=De[Qe],Dt=Qe+1,Pt=O?`${O}.${Dt}`:`${Dt}.0`;if(bt.wbsCode=Pt,_.push({task:bt,level:pe}),bt.subtasks&&bt.subtasks.length>0&&bt.isExpanded){let At=O?`${O}.${Dt}`:`${Dt}`;_.push(...ge(bt.subtasks,pe+1,At));}}return _},Ve=ge(e),Oe=48,Ue=Math.max(Ve.length*a,600-Oe),lt=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,ot=ne=>{T(ne.id),te(ne.name),Ge(true);},st=ne=>{G.trim()&&G!==e.find(pe=>pe.id===ne)?.name&&C?.(ne,G.trim()),T(null),te(""),Ge(false);},pt=()=>{T(null),te(""),Ge(false);},Tt=(ne,pe)=>{pe.stopPropagation(),S?.(ne.id);},Ot=(ne,pe)=>{pe.preventDefault(),Xe.current=pe.clientY,Be(ne),kt.current=false,ct(false),nt({x:pe.clientX,y:pe.clientY});},St=ne=>{if(!xe||(Math.abs(ne.clientY-Xe.current)>he&&!kt.current&&(kt.current=true,ct(true)),nt({x:ne.clientX,y:ne.clientY}),!kt.current))return;if(P?.current){let Qe=P.current,bt=Qe.getBoundingClientRect(),Dt=60,Pt=12;et.current&&(cancelAnimationFrame(et.current),et.current=null);let At=ne.clientY-bt.top,ta=bt.bottom-ne.clientY;if(At<Dt&&Qe.scrollTop>0){let la=Math.round(Pt*(1-At/Dt)),Q=()=>{Qe.scrollTop-=la,kt.current&&Qe.scrollTop>0&&(et.current=requestAnimationFrame(Q));};et.current=requestAnimationFrame(Q);}else if(ta<Dt&&Qe.scrollTop<Qe.scrollHeight-Qe.clientHeight){let la=Math.round(Pt*(1-ta/Dt)),Q=()=>{Qe.scrollTop+=la,kt.current&&Qe.scrollTop<Qe.scrollHeight-Qe.clientHeight&&(et.current=requestAnimationFrame(Q));};et.current=requestAnimationFrame(Q);}}let O=document.querySelectorAll("[data-task-row]"),_=null,De=null;O.forEach(Qe=>{let bt=Qe.getBoundingClientRect(),Dt=Qe.getAttribute("data-task-row");if(Dt&&Dt!==xe&&ne.clientY>=bt.top&&ne.clientY<=bt.bottom){_=Dt;let Pt=ne.clientY-bt.top,At=bt.height;Pt<At*.25?De="above":Pt>At*.75?De="below":De="child";}}),at(_),je(De);},Et=()=>{if(kt.current&&xe&&He&&ue){if(ue==="child")v?.(xe,He);else if(ue==="above"||ue==="below"){let ne=(De,Qe,bt=null)=>{for(let Dt of De){if(Dt.id===Qe)return bt;if(Dt.subtasks){let Pt=ne(Dt.subtasks,Qe,Dt.id);if(Pt!==void 0)return Pt}}},pe=ne(e,xe,null),O=ne(e,He,null),_=(De,Qe,bt,Dt)=>{let Pt=De.findIndex(la=>la.id===Qe),At=Dt?De.findIndex(la=>la.id===bt):-1,ta=ue==="below"?Pt+1:Pt;return Dt&&At!==-1&&At<Pt&&(ta-=1),Math.max(0,ta)};if(O===null){let Qe=_(e,He,xe,pe===null);v?.(xe,null,Qe);}else {let De=$n(e,O);if(De?.subtasks){let Qe=pe===O,bt=_(De.subtasks,He,xe,Qe);v?.(xe,O,bt);}}}}et.current&&(cancelAnimationFrame(et.current),et.current=null),Be(null),at(null),je(null),nt(null),kt.current=false,ct(false);};react.useEffect(()=>{if(xe)return document.addEventListener("mousemove",St),document.addEventListener("mouseup",Et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",Et),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,He,ue]);let Ft=(ne,pe,O)=>{let _=pe.subtasks&&pe.subtasks.length>0;switch(ne.id){case "name":let De=Y===pe.id,Qe=J===pe.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${O*20}px`},children:[v&&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:Qe?1:.3},onMouseDown:I=>Ot(pe.id,I),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),pe.subtasks&&pe.subtasks.length>0?jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),c?.(pe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:pe.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"}),De?jsxRuntime.jsx("input",{ref:Le,type:"text",value:G,onChange:I=>te(I.target.value),onKeyDown:I=>{I.key==="Enter"?st(pe.id):I.key==="Escape"&&pt();},onBlur:()=>st(pe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:I=>I.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:pe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:pe.parentId?"13px":"14px",fontWeight:pe.isMilestone?600:pe.parentId?400:600,letterSpacing:pe.parentId?"0":"-0.01em"},title:pe.name,children:[pe.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:pe.wbsCode}),pe.isHighlighted&&pe.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe.name}),pe.subtasks&&pe.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(pe.progress||0),"%"]}),L&&pe.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),L&&pe.cpmData&&jsxRuntime.jsxs("span",{style:{color:pe.cpmData.totalFloat<=0?"#EF4444":pe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(pe.cpmData.totalFloat),"d"]})]}),Qe&&!De&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>Tt(pe,I),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),ot(pe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Dt=ne.id==="startDate"?"startDate":"endDate",Pt=pe[Dt],At=Ee?.taskId===pe.id&&Ee?.field===Dt,ta=I=>I?(typeof I=="string"?new Date(I):I).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!_)if(At)V(null);else {let ye=I.currentTarget.getBoundingClientRect();V({taskId:pe.id,field:Dt,month:Pt?typeof Pt=="string"?new Date(Pt):Pt:new Date,position:{top:ye.bottom+4,left:ye.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ta(Pt)}),_&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),At&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>V(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ee?.position.top,left:Ee?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,ye=new Date(I);ye.setDate(I.getDate()+1);let Z=new Date(I);Z.setDate(I.getDate()+7);let N=new Date(I);return N.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:ye},{label:"Pr\xF3xima semana",date:Z},{label:"2 semanas",date:N}].map((Te,Pe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:$t=>$t.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:$t=>$t.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(pe.id,{[Dt]:Te.date}),V(null);},children:Te.label},Pe))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(pe.id,{[Dt]:void 0}),V(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>V(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ee?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>V(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((I,ye)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},ye))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=Ee?.month||new Date,ye=I.getFullYear(),Z=I.getMonth(),N=new Date(ye,Z,1).getDay(),K=new Date(ye,Z+1,0).getDate(),Te=new Date,Pe=[];for(let Ct=N-1;Ct>=0;Ct--)Pe.push({day:new Date(ye,Z,-Ct).getDate(),date:new Date(ye,Z-1,new Date(ye,Z,-Ct).getDate()),isCurrentMonth:false});for(let Ct=1;Ct<=K;Ct++)Pe.push({day:Ct,date:new Date(ye,Z,Ct),isCurrentMonth:true});let $t=42-Pe.length;for(let Ct=1;Ct<=$t;Ct++)Pe.push({day:Ct,date:new Date(ye,Z+1,Ct),isCurrentMonth:false});return Pe.map((Ct,Jt)=>{let Wa=Ct.date.toDateString()===Te.toDateString(),wa=(Pt?typeof Pt=="string"?new Date(Pt):Pt:null)?.toDateString()===Ct.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ct.isCurrentMonth?wa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:wa?"#2E94FF":"transparent",boxShadow:Wa&&!wa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(pe.id,{[Dt]:Ct.date}),V(null);},children:Ct.day},Jt)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:lt(pe)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let la=r.filter(I=>pe.assignees?.some(ye=>ye.name===I.name||ye.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(en,{assignedUsers:la,availableUsers:r,onChange:I=>{let ye=I.map(Z=>({id:Z.id,name:Z.name,initials:Z.initials,color:Z.color}));g?.(pe.id,{assignees:ye.length>0?ye:void 0});}})});case "status":if(_){let I=pe.progress===100?"\u2713":pe.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Lu,{status:pe.status||"todo",onChange:I=>{g?.(pe.id,{status:I,progress:I==="completed"?100:pe.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${pe.progress}%`,backgroundColor:pe.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:[pe.progress,"%"]})]});case "priority":let Q={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},$e={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Fe=Q[pe.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Qo,{priority:Fe,onChange:I=>{I&&g?.(pe.id,{priority:$e[I]||"medium"});}})});default:return null}},mt=ne=>[{id:"hide",label:"Hide Column",icon:ma.Hide,onClick:()=>d(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ma.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ma.SortDesc,onClick:()=>{}}],Vt=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{S?.(ne.id);}},{id:"duplicate",label:M?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{S?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:M?.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}],ht=p.filter(ne=>ne.visible),it=ht.reduce((ne,pe)=>ne+pe.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:it},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Oe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:ht.map((ne,pe)=>{let O=pe===ht.length-1,_=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(_?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:_&&ht.length===1?1:0,flexGrow:_&&ht.length===1?1:0,borderRight:O?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:De=>{De.preventDefault(),ke({isOpen:true,x:De.clientX,y:De.clientY,type:"header",columnId:ne.id});},onMouseEnter:De=>{De.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:De=>{De.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:De=>{De.preventDefault(),De.stopPropagation(),q(ne.id),_e(De.clientX),ee(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:B===ne.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Ni,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>U(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),D&&jsxRuntime.jsxs("div",{ref:ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>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",style:{minHeight:Ue},children:Ve.map(({task:ne,level:pe},O)=>{let _=oe(ne.id),De=He===ne.id,Qe=De&&ue==="above",bt=De&&ue==="below",Dt=De&&ue==="child",Pt={};return Dt&&(Pt.backgroundColor=`${t.accent}15`,Pt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${xe===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Dt?`${t.accent}15`:O%2===0?t.bgPrimary:t.bgGrid,opacity:L?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Pt},onMouseEnter:()=>H(ne.id),onMouseLeave:()=>H(null),onClick:At=>{let la=On(e).map(Fe=>Fe.id),$e=navigator.platform.toUpperCase().indexOf("MAC")>=0?At.metaKey:At.ctrlKey;z(ne.id,la,$e,At.shiftKey),s?.(ne);},onDoubleClick:At=>{At.stopPropagation(),n?.(ne);},onContextMenu:At=>{At.preventDefault(),ke({isOpen:true,x:At.clientX,y:At.clientY,type:"task",task:ne}),l?.(ne,At);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[Qe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),bt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ht.map((At,ta)=>{let la=ta===ht.length-1,Q=At.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Q?"justify-start":"justify-center"}`,style:{width:`${At.width}px`,minWidth:`${At.minWidth??(Q?200:60)}px`,maxWidth:`${At.maxWidth??2e3}px`,flexShrink:Q&&ht.length===1?1:0,flexGrow:Q&&ht.length===1?1:0,borderRight:la?"none":`1px solid ${J===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ft(At,ne,Q?pe:0)},`${ne.id}-${At.id}`)})]},ne.id)})}),jsxRuntime.jsx(Rn,{isOpen:le.isOpen,x:le.x,y:le.y,items:le.type==="header"&&le.columnId?mt(le.columnId):le.type==="task"&&le.task?Vt(le.task):[],onClose:()=>ke({...le,isOpen:false}),theme:t}),ze&&xt&&xe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:xt.x+12,top:xt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=Ve.find(pe=>pe.task.id===xe)?.task;return ne?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function bm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[c,i]=react.useState(t),[p,d]=react.useState(null),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(0),[C,S]=react.useState(0),[E,k]=react.useState(null),[v,P]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:C,setSegmentDragOffsetX:S,hoveredSegmentIndex:E,setHoveredSegmentIndex:k,isHovered:v,setIsHovered:P,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,T)=>{r("none"),d(null),g(null),l(Y),i(T),S(0),f(null),w(0);}}}function Ei({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false,onProgressChange:C}){let S=bm(t,r),E=react.useRef(null),k=react.useRef(false),v=react.useRef(null),P=react.useRef(null),{dragMode:L,setDragMode:M,dragOffset:J,setDragOffset:H,ghostX:Y,setGhostX:T,ghostWidth:G,setGhostWidth:te,connectionLine:Le,setConnectionLine:B,hoveredTaskId:q,setHoveredTaskId:be,activeZone:_e,setActiveZone:$,draggedSegmentIndex:ee,setDraggedSegmentIndex:le,draggedSegmentStartX:ke,setDraggedSegmentStartX:xe,segmentDragOffsetX:Be,setSegmentDragOffsetX:He,hoveredSegmentIndex:at,setHoveredSegmentIndex:ue,isHovered:je,setIsHovered:Xe,isDragging:he,isResizing:kt,isConnecting:xt,resetDragState:nt}=S,ze=18,ct=!!o.executionBarBg,et=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Ee=ct?3:6,V=e.subtasks&&e.subtasks.length>0,D=react.useRef(null),[U,ae]=(()=>{let Q=react.useRef(null),[,$e]=react.useState(0);return [Q.current,Fe=>{Q.current=Fe,$e(I=>I+1);}]})(),Ne=!!C&&!w&&!V&&!e.segments&&!!e.startDate&&!!e.endDate,z=e.endDate&&(()=>{let Q=new Date;Q.setHours(0,0,0,0);let $e=new Date(e.endDate);return $e.setHours(0,0,0,0),$e<Q})()&&e.progress<100,oe=b&&e.isCriticalPath,Ge=o.name==="neutral"||o.today==="#1C1917",ge=e.status==="completed"||e.progress===100,Ve={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ue=b&&e.isCriticalPath||z?"#EF4444":e.color?e.color:e.priority&&Ve[e.priority]?Ve[e.priority]:o.taskBarPrimary,lt=w?"default":he?xt?"crosshair":kt?"ew-resize":"grabbing":"grab",ot=w?"default":"ew-resize",pt=(Q=>Q>=80?20:Q>=60?15:Q>=50?12:10)(r),Tt=r<50,Ot=r<40;react.useEffect(()=>{x&&(!je||he||e.segments)&&x(null);},[je,he,e.segments,x]);let St=Q=>Q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Et=()=>{let Q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Q} day${Q!==1?"s":""}`},Ft=Q=>Math.round(Q/s)*s,mt=Q=>{let $e=Math.round(Q/s),Fe=new Date(n);return Fe.setDate(Fe.getDate()+$e),Fe},Vt=(Q,$e)=>{for(let Fe of g){if(Fe.id===e.id)continue;let I=5;if(Q>=Fe.x-I&&Q<=Fe.x+Fe.width+I&&$e>=Fe.y-I&&$e<=Fe.y+Fe.height+I)return Fe.id}return null},ht=react.useCallback((Q,$e,Fe)=>{if(w)return;Q.preventDefault(),Q.stopPropagation();let I=E.current?.ownerSVGElement;if(!I)return;let ye=I.createSVGPoint();ye.x=Q.clientX,ye.y=Q.clientY;let Z=ye.matrixTransform(I.getScreenCTM()?.inverse()),N=Fe!==void 0?Fe:t,K=$e;if(!K){let Te=Z.x-N;Q.shiftKey?(K="connect",B({x:t+r,y:a+ze/2})):Q.ctrlKey||Q.metaKey?K="move":Q.altKey?K=Te<r/2?"resize-start":"resize-end":Ot?Te<r/2?K="move":K="resize-end":Tt?Te<=pt/2?K="resize-start":Te>=r-pt/2?K="resize-end":K="move":Te<=pt?K="resize-start":Te>=r-pt?K="resize-end":K="move";}k.current=false,M(K),Xe(false),$(null),K==="move"?H(Z.x-N):K==="connect"?B({x:t+r,y:a+ze/2}):H(0),T(N),te(r);},[t,r,a,ze,w]),it=react.useCallback(Q=>{let $e=E.current?.ownerSVGElement;if(!$e)return;let Fe=$e.closest(".gantt-timeline-scroll");if(!Fe)return;let I=Fe.getBoundingClientRect(),ye=60,Z=15,N=0;if(Q.clientX<I.left+ye){let K=I.left+ye-Q.clientX;N=-Math.min(Z,K/2);}else if(Q.clientX>I.right-ye){let K=Q.clientX-(I.right-ye);N=Math.min(Z,K/2);}return N!==0&&(Fe.scrollLeft+=N),N!==0},[]),ne=react.useCallback(Q=>{if(L==="none")return;k.current=true,P.current=Q;let $e=E.current?.ownerSVGElement;if(!$e)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let ye=it(Q);ye&&!v.current?v.current=window.setInterval(()=>{P.current&&(it(P.current),ne(P.current));},16):!ye&&v.current&&(window.clearInterval(v.current),v.current=null);}let Fe=$e.createSVGPoint();Fe.x=Q.clientX,Fe.y=Q.clientY;let I=Fe.matrixTransform($e.getScreenCTM()?.inverse());if(L==="connect"){B({x:I.x,y:I.y});let ye=Vt(I.x,I.y);be(ye);}else if(L==="move"){let ye=I.x-J,Z=Ft(ye);T(Z),te(r);let N=Math.round((Z-t)/s);if(y?.(e.id,N,true),e.segments&&e.segments.length>0&&ee!==null){let K=Z-ke;He(K);}}else if(L==="resize-start"){let ye=I.x,Z=Ft(ye),N=t+r-Z;N>=s&&(T(Z),te(N));}else if(L==="resize-end"){let ye=I.x,N=Ft(ye)-t;N>=s&&te(N);}},[L,t,r,s,J,e,Ft,ee,ke,Vt,be,B,T,te,He,y,it]),pe=react.useCallback(()=>{if(v.current&&(window.clearInterval(v.current),v.current=null),P.current=null,L!=="none"){if(L==="connect")q&&m&&m(e,q),B(null),be(null);else {let Q=e.endDate.getTime()-e.startDate.getTime(),$e,Fe,I=true;if(L==="move"){if($e=mt(Y),Fe=new Date($e.getTime()+Q),e.segments&&e.segments.length>0&&ee!==null){let ye=Math.round(Be/s),Z=e.segments.map((Pe,$t)=>{if($t===ee){let Ct=new Date(Pe.startDate),Jt=new Date(Pe.endDate);return Ct.setDate(Ct.getDate()+ye),Jt.setDate(Jt.getDate()+ye),{startDate:Ct,endDate:Jt}}return Pe}),N=Z.flatMap(Pe=>[Pe.startDate,Pe.endDate]),K=new Date(Math.min(...N.map(Pe=>Pe.getTime()))),Te=new Date(Math.max(...N.map(Pe=>Pe.getTime())));d?.({...e,segments:Z},K,Te),nt(t,r);return}}else L==="resize-start"?($e=mt(Y),Fe=e.endDate,$e>Fe&&(console.warn("Invalid date range: start date must be before or equal to end date"),I=false)):L==="resize-end"?($e=e.startDate,Fe=mt(Y+G),Fe.setDate(Fe.getDate()-1),Fe<$e&&(console.warn("Invalid date range: end date must be after or equal to start date"),I=false)):I=false;I&&$e&&Fe&&(Fe.getTime()<$e.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,$e,Fe));}y?.(e.id,0,false),nt(t,r);}},[L,Y,G,e,d,q,m,t,r,s,mt,Be,ee,nt,y]);react.useEffect(()=>{if(L==="none")return;let Q=Fe=>{ne(Fe);},$e=()=>{pe();};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",$e),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",$e),v.current&&(window.clearInterval(v.current),v.current=null);}},[L,ne,pe]);let O=he&&!xt?Y:t,_=he&&!xt?G:r,De=l.taskClass(e),Qe=24,bt=b?e.isCriticalPath?1:.25:1,Dt=react.useCallback(Q=>{if(!Ne)return;Q.stopPropagation(),Q.preventDefault();let Fe=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;D.current={barRect:Fe,initialPct:e.progress||0},Q.currentTarget.setPointerCapture(Q.pointerId),ae(e.progress||0);},[Ne,e.progress,ae]),Pt=react.useCallback(Q=>{let $e=D.current;if(!$e)return;let I=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??$e.barRect;if(!I||I.width<=0)return;let ye=(Q.clientX-I.left)/I.width,Z=Math.round(Math.max(0,Math.min(1,ye))*100);Q.shiftKey&&(Z=Math.round(Z/25)*25),ae(Z);},[ae]),At=react.useCallback(Q=>{let $e=D.current;if(!$e)return;Q.stopPropagation(),Q.preventDefault();try{Q.currentTarget.releasePointerCapture(Q.pointerId);}catch{}let Fe=U;D.current=null,ae(null),Fe!=null&&Fe!==$e.initialPct&&C&&C(e,Fe);},[U,C,e,ae]),ta=react.useCallback(Q=>{Q.stopPropagation(),Q.preventDefault();},[]),la=U??(e.progress||0);return jsxRuntime.jsxs("g",{ref:E,"data-task-bar":"true",style:{opacity:bt,transition:"opacity 300ms ease"},onClick:()=>{!he&&!k.current&&c?.(e),k.current=false;},onDoubleClick:Q=>{!he&&!k.current&&(Q.stopPropagation(),i?.(e));},onContextMenu:Q=>{Q.preventDefault(),p?.(e,Q);},onMouseEnter:()=>!he&&Xe(true),onMouseMove:Q=>{x&&je&&!he&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ze,showBelow:false,mouseX:Q.clientX,mouseY:Q.clientY});},onMouseLeave:()=>{he||(Xe(false),$(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+Qe,height:ze,fill:"transparent",style:{pointerEvents:"all"}}),je&&!he&&!Tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:pt,height:ze,fill:_e==="resize-start"?o.accent:"transparent",opacity:_e==="resize-start"?.15:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:Q=>ht(Q,"resize-start")}),jsxRuntime.jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:ze,fill:_e==="move"?o.accent:"transparent",opacity:_e==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:Q=>ht(Q,"move")}),jsxRuntime.jsx("rect",{x:t+r-pt,y:a,width:pt,height:ze,fill:_e==="resize-end"?o.accent:"transparent",opacity:_e==="resize-end"?.15:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:Q=>ht(Q,"resize-end")})]}),je&&!he&&Ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ze,fill:_e==="move"?o.accent:"transparent",opacity:_e==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:Q=>ht(Q,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ze,fill:_e==="resize-end"?o.accent:"transparent",opacity:_e==="resize-end"?.2:0,style:{cursor:ot,pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:Q=>ht(Q,"resize-end")}),je&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ze-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),he&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:a,width:G,height:ze,rx:Ee,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!he&&(()=>{let Q=e.baselineStartDate.getTime(),$e=e.baselineEndDate.getTime(),Fe=n.getTime(),I=864e5,ye=(Q-Fe)/I,Z=($e-Q)/I,N=ye*s,K=Math.max(Z*s,s),Te=O+_,Pe=N+K,$t=e.endDate?.getTime()??0,Ct=Math.ceil(($t-$e)/I),Jt=Ct>0,Wa=Ct<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:N,y:a,width:K,height:ze,rx:Ee,fill:"none",stroke:et?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Jt&&Te>Pe&&jsxRuntime.jsx("rect",{x:Pe,y:a,width:Te-Pe,height:ze,rx:0,fill:"#EF4444",opacity:.2}),Jt&&jsxRuntime.jsxs("text",{x:Math.max(Te,Pe)+6,y:a+ze/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ct,"d"]}),Wa&&jsxRuntime.jsxs("text",{x:Te+6,y:a+ze/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ct,"d"]})]})})(),!e.segments&&ct&&V&&(()=>{let $e=a+(ze-8)/2,Fe=4,I=e.progress||0,ye=new Date;ye.setHours(0,0,0,0);let Z=e.startDate&&ye>=e.startDate,N=e.endDate&&(()=>{let Jt=new Date(e.endDate);return Jt.setHours(0,0,0,0),ye>Jt})(),K=e.startDate&&ye<e.startDate,Te=1;if(Z&&e.startDate&&e.endDate&&!K){let Jt=new Date(e.startDate);Jt.setHours(0,0,0,0);let Wa=new Date(e.endDate);Wa.setHours(0,0,0,0);let ya=Math.max(1,(Wa.getTime()-Jt.getTime())/(1e3*60*60*24)),dr=Math.min((ye.getTime()-Jt.getTime())/(1e3*60*60*24),ya)/ya*100;Te=dr>0?I/dr:1;}let Pe;I>=100?Pe="#00E5CC":K?Pe="#4B5563":N&&I<100?Pe="#EF4444":Te>=.95?Pe="#22C55E":Te>=.8?Pe="#F59E0B":Pe="#EF4444";let $t=Math.max(I/100*_,I>0?Fe*2:0),Ct=_>100&&I>0;return jsxRuntime.jsxs("g",{"data-task-class":De,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:O,y:$e,width:_,height:8,rx:Fe,fill:"rgba(255,255,255,0.10)"}),I>0&&jsxRuntime.jsx("rect",{x:O,y:$e,width:$t,height:8,rx:Fe,fill:Pe}),Ct&&jsxRuntime.jsxs("text",{x:O+$t+6,y:$e+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(I),"%"]})]})})(),!e.segments&&ct&&!V&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:_,height:ze,rx:Ee,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":De,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:he&&!xt?.15:e.parentId?.6:1,scale:je&&!he?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Q=>ht(Q),style:{cursor:lt,pointerEvents:"all"}}),!e.segments&&!ct&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:_,height:ze,rx:Ee,fill:Ue,"data-task-class":De,initial:{opacity:0,scale:.95},animate:{opacity:he&&!xt?.15:e.parentId?.6:je?.9:.8,scale:je&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V?void 0:Q=>ht(Q),style:{cursor:V?"default":lt,pointerEvents:"all"}}),ct&&(z||oe)&&!e.segments&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&la>0&&!V&&jsxRuntime.jsx("rect",{x:O,y:a,width:Math.max(_*(la/100),Ee*2),height:ze,rx:Ee,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!V&&e.progress<100&&(()=>{let Q=e.progress>0?_*(e.progress/100):0,$e=O+Q,Fe=_-Q,I=e.progress===0?Ee:0,ye=e.progress===0?O:$e,Z=e.progress===0?_:Fe;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:ye,y:a,width:Z,height:ze,rx:I,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:ye,y:a,width:Z,height:ze,rx:I,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ct&&!e.segments&&e.progress>0&&e.progress<100&&!V&&!he&&U===null&&(()=>{let Q=O+_*(e.progress/100),$e=8,Fe=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:Q,cy:a+ze/2,r:$e,fill:Fe?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:Q,y:a+ze/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Fe?.initials||Fe?.name?.charAt(0)?.toUpperCase()||""})]})})(),Ne&&!he&&_>=40&&(U!==null||la<88)&&(()=>{let Q=O+_*(la/100),$e=a+ze/2,Fe=U!==null,I=Fe?7:je?6:5,ye=Fe||je?1:.35,Z=O+_-Q,N=Math.max(4,Math.min(12,Z-10)),K=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Q-K,y:$e-12,width:K+N,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Dt,onPointerMove:Pt,onPointerUp:At,onPointerCancel:At,onClick:ta,onDoubleClick:ta,onMouseDown:Te=>Te.stopPropagation()}),jsxRuntime.jsx("circle",{cx:Q,cy:$e,r:I,fill:"#FFFFFF",stroke:Ue,strokeWidth:2,opacity:ye,style:{pointerEvents:"none",filter:Fe?`drop-shadow(0 0 4px ${Ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Fe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Q-20,y:$e-28,width:40,height:18,rx:4,fill:et?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ue,strokeWidth:1}),jsxRuntime.jsxs("text",{x:Q,y:$e-16,textAnchor:"middle",dominantBaseline:"central",fill:et?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[U,"%"]})]})]})})(),e.segments&&e.segments.map((Q,$e)=>{let Fe=(Q.startDate.getTime()-n.getTime())/864e5*s,ye=(Q.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Fe+s,Z=he&&L==="move"&&ee===$e,N=at===$e,K=Z?Fe+Be:Fe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!he&&ue($e),onMouseLeave:()=>!he&&ue(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:K,y:a,width:ye,height:ze,rx:Ee,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:Z||e.parentId?.6:N?.9:.8,scale:N&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Te=>{Te.stopPropagation(),le($e),xe(Fe),ht(Te,void 0,Fe);},style:{cursor:lt,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:K,y:a,width:ye*(e.progress/100),height:ze,rx:Ee,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${$e}`)}),Ge&&(z||oe)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[oe&&!z&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),z&&jsxRuntime.jsx("rect",{x:O,y:a,width:_,height:ze,rx:Ee,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&_>60&&!e.segments&&!(ct&&V)&&(()=>{let Q=l.taskLabel(e),$e=typeof Q=="string"?Q:e.name,Fe=$e.length>Math.floor(_/8)?`${$e.substring(0,Math.floor(_/8))}...`:$e;return jsxRuntime.jsx("text",{x:O+8,y:a+ze/2,dominantBaseline:"middle",fill:ge?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ge?"line-through":"none"},children:Fe})})(),!he&&!e.segments&&!V&&e.progress>0&&e.progress<100&&(ct?jsxRuntime.jsxs("text",{x:O+_+6,y:a+ze/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):_>100?jsxRuntime.jsxs("text",{x:O+_-12,y:a+ze/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&_>80&&!he&&!e.segments&&!(ct&&V)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:O+_-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:O+_-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(je||kt)&&!xt&&!e.segments&&!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:O-2,y:a,width:16,height:ze,fill:"transparent",style:{cursor:ot},onMouseEnter:()=>$("resize-start"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:O+4,y:a+8,width:3,height:ze-16,rx:1.5,fill:_e==="resize-start"||L==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:O+_-14,y:a,width:16,height:ze,fill:"transparent",style:{cursor:ot},onMouseEnter:()=>$("resize-end"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:O+_-7,y:a+8,width:3,height:ze-16,rx:1.5,fill:_e==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&!he&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ze/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>$("connect"),onMouseLeave:()=>$(null),onMouseDown:Q=>{Q.stopPropagation(),ht(Q,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ze/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),xt&&Le&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ze/2,x2:Le.x,y2:Le.y,stroke:q?o.statusCompleted:o.accent,strokeWidth:q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:q?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Le.x,cy:Le.y,r:q?8:6,fill:q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),q&&jsxRuntime.jsx(framerMotion.motion.text,{x:Le.x+15,y:Le.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Le.x+10},animate:{opacity:1,x:Le.x+15},transition:{duration:.2},children:"Connect"})]}),(je||he)&&!xt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O-1,y:a-1,width:_+2,height:ze+2,rx:Ee+1,fill:"none",stroke:he?o.accent:ct?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ct?1:2,opacity:he||ct?.6:.4,initial:{opacity:0},animate:{opacity:he||ct?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),kt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:Y,y1:0,x2:Y,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Y+G,y1:0,x2:Y+G,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&!he&&!e.segments&&!x&&(()=>{let Fe=a<100,I=Fe?a+ze+13:a-82-13,ye=Fe?`M ${O+_/2-6} ${a+ze+3} L ${O+_/2} ${a+ze+13} L ${O+_/2+6} ${a+ze+3}`:`M ${O+_/2-6} ${a-13} L ${O+_/2} ${a-3} L ${O+_/2+6} ${a-13}`,Z=I+22,N=I+40,K=I+55,Te=I+70,Pe=Fe?I+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Fe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Fe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ye,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:O+_/2-120,y:I,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:O+_/2,y:Z,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:O+_/2-110,y:N,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:O+_/2-70,y:N,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St(e.startDate)}),jsxRuntime.jsx("text",{x:O+_/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:O+_/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:St(e.endDate)}),jsxRuntime.jsx("text",{x:O+_/2+10,y:N,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:O+_/2+65,y:N,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et()}),jsxRuntime.jsx("text",{x:O+_/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:O+_/2+65,y:K,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:O+_/2-110,y:Te,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:O+_/2-50,y:Te,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($t=>$t.name).join(", ").substring(0,30),e.assignees.map($t=>$t.name).join(", ").length>30?"...":""]})]}),!Fe&&jsxRuntime.jsx("text",{x:O+_/2,y:Pe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ot?"Left: move \u2022 Right: resize":Tt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Bd=260,zn=8,xm=16,Mv=-12;function vm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:C}=e,S=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,E=b.lastActivity!=null,k=(S?155:105)+(E?28:0),v=w+xm,P=C+Mv-k;v+Bd>window.innerWidth-zn&&(v=w-Bd-xm),v<zn&&(v=zn);let L=P<zn;L&&(P=C+20),P+k>window.innerHeight-zn&&(P=window.innerHeight-zn-k),o({left:v,top:P,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},p=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),C=b%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Bd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(Mi,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(Mi,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]}),s.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:m},children:s.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:s.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return reactDom.createPortal(f,document.body)}function Mi({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ks({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,w=20,C=!b&&a<=e,S,E,k=a-e,v=e+k/2;E=v;let P=8;if(n==="squared")if(b)S=`M ${e} ${t} L ${a} ${r}`;else if(C){let xe=e+15,Be=a-w,He=f?t+20:t-20;E=Be;let at=f?1:-1;S=`M ${e} ${t} L ${xe-P} ${t} Q ${xe} ${t} ${xe} ${t+at*P} L ${xe} ${He-at*P} Q ${xe} ${He} ${xe-P} ${He} L ${Be+P} ${He} Q ${Be} ${He} ${Be} ${He+at*P} L ${Be} ${r-at*P} Q ${Be} ${r} ${Be+P} ${r} L ${a} ${r}`;}else {E=a-w;let ke=f?1:-1;S=`M ${e} ${t} L ${E-P} ${t} Q ${E} ${t} ${E} ${t+ke*P} L ${E} ${r-ke*P} Q ${E} ${r} ${E+P} ${r} L ${a} ${r}`;}else S=`M ${e} ${t} C ${v} ${t}, ${v} ${r}, ${a} ${r}`;let L=6,M=5,J=`M ${a} ${r} L ${a-L} ${r-M/2} L ${a-L} ${r+M/2} Z`,H=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),Y=p||(H?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),T=d||1,G=o.dependencyHover||(H?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),te="#f87171",Le="rgba(248, 113, 113, 0.15)",B=E,q=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),q=t;else if(C){let ke=e+15,xe=a-w,Be=f?t+20:t-20,He=[[e,t,ke,t],[ke,t,ke,Be],[ke,Be,xe,Be],[xe,Be,xe,r],[xe,r,a,r]],at=1/0,ue={x:B,y:q};for(let je of He){let Xe=be(y.x,y.y,je[0],je[1],je[2],je[3]),he=Math.hypot(y.x-Xe.x,y.y-Xe.y);he<at&&(at=he,ue=Xe);}B=ue.x,q=ue.y;}else {let ke=[[e,t,E,t],[E,t,E,r],[E,r,a,r]],xe=1/0,Be={x:B,y:q};for(let He of ke){let at=be(y.x,y.y,He[0],He[1],He[2],He[3]),ue=Math.hypot(y.x-at.x,y.y-at.y);ue<xe&&(xe=ue,Be=at);}B=Be.x,q=Be.y;}else {let ke=v,xe=t,Be=v,He=r,at=1/0,ue=B,je=q;for(let Xe=0;Xe<=1;Xe+=.02){let he=1-Xe,kt=he*he*he*e+3*he*he*Xe*ke+3*he*Xe*Xe*Be+Xe*Xe*Xe*a,xt=he*he*he*t+3*he*he*Xe*xe+3*he*Xe*Xe*He+Xe*Xe*Xe*r,nt=Math.hypot(y.x-kt,y.y-xt);nt<at&&(at=nt,ue=kt,je=xt);}B=ue,q=je;}function be(ke,xe,Be,He,at,ue){let je=at-Be,Xe=ue-He,he=je*je+Xe*Xe;if(he===0)return {x:Be,y:He};let kt=((ke-Be)*je+(xe-He)*Xe)/he;return kt=Math.max(0,Math.min(1,kt)),{x:Be+kt*je,y:He+kt*Xe}}let _e=ke=>{let xe=ke.currentTarget.ownerSVGElement;if(!xe)return;let Be=xe.getScreenCTM();if(!Be)return;let He=Be.inverse();x({x:He.a*ke.clientX+He.c*ke.clientY+He.e,y:He.b*ke.clientX+He.d*ke.clientY+He.f});},$=()=>{g(false),x(null),c?.(false);},ee=()=>{g(true),c?.(true);},le=ke=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:ke,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:q,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:q,r:9,fill:Le,stroke:te,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:q-3,x2:B+3,y2:q+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:q-3,x2:B-3,y2:q+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:$,onMouseMove:_e,children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:J,fill:G,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:G,opacity:.9,style:{pointerEvents:"none"}}),le({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ee,onMouseLeave:$,onMouseMove:_e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:J,fill:G,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:G,style:{pointerEvents:"none"}}),le({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ee,onMouseLeave:$,onMouseMove:_e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:Y,strokeWidth:T,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:J,fill:Y,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:Y,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Li({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.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=Se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
130
|
+
`})]});return reactDom.createPortal(f,document.body)}function Mi({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function Cs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,w=20,C=!b&&a<=e,S,E,k=a-e,v=e+k/2;E=v;let P=8;if(n==="squared")if(b)S=`M ${e} ${t} L ${a} ${r}`;else if(C){let xe=e+15,Be=a-w,He=f?t+20:t-20;E=Be;let at=f?1:-1;S=`M ${e} ${t} L ${xe-P} ${t} Q ${xe} ${t} ${xe} ${t+at*P} L ${xe} ${He-at*P} Q ${xe} ${He} ${xe-P} ${He} L ${Be+P} ${He} Q ${Be} ${He} ${Be} ${He+at*P} L ${Be} ${r-at*P} Q ${Be} ${r} ${Be+P} ${r} L ${a} ${r}`;}else {E=a-w;let ke=f?1:-1;S=`M ${e} ${t} L ${E-P} ${t} Q ${E} ${t} ${E} ${t+ke*P} L ${E} ${r-ke*P} Q ${E} ${r} ${E+P} ${r} L ${a} ${r}`;}else S=`M ${e} ${t} C ${v} ${t}, ${v} ${r}, ${a} ${r}`;let L=6,M=5,J=`M ${a} ${r} L ${a-L} ${r-M/2} L ${a-L} ${r+M/2} Z`,H=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),Y=p||(H?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),T=d||1,G=o.dependencyHover||(H?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),te="#f87171",Le="rgba(248, 113, 113, 0.15)",B=E,q=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),q=t;else if(C){let ke=e+15,xe=a-w,Be=f?t+20:t-20,He=[[e,t,ke,t],[ke,t,ke,Be],[ke,Be,xe,Be],[xe,Be,xe,r],[xe,r,a,r]],at=1/0,ue={x:B,y:q};for(let je of He){let Xe=be(y.x,y.y,je[0],je[1],je[2],je[3]),he=Math.hypot(y.x-Xe.x,y.y-Xe.y);he<at&&(at=he,ue=Xe);}B=ue.x,q=ue.y;}else {let ke=[[e,t,E,t],[E,t,E,r],[E,r,a,r]],xe=1/0,Be={x:B,y:q};for(let He of ke){let at=be(y.x,y.y,He[0],He[1],He[2],He[3]),ue=Math.hypot(y.x-at.x,y.y-at.y);ue<xe&&(xe=ue,Be=at);}B=Be.x,q=Be.y;}else {let ke=v,xe=t,Be=v,He=r,at=1/0,ue=B,je=q;for(let Xe=0;Xe<=1;Xe+=.02){let he=1-Xe,kt=he*he*he*e+3*he*he*Xe*ke+3*he*Xe*Xe*Be+Xe*Xe*Xe*a,xt=he*he*he*t+3*he*he*Xe*xe+3*he*Xe*Xe*He+Xe*Xe*Xe*r,nt=Math.hypot(y.x-kt,y.y-xt);nt<at&&(at=nt,ue=kt,je=xt);}B=ue,q=je;}function be(ke,xe,Be,He,at,ue){let je=at-Be,Xe=ue-He,he=je*je+Xe*Xe;if(he===0)return {x:Be,y:He};let kt=((ke-Be)*je+(xe-He)*Xe)/he;return kt=Math.max(0,Math.min(1,kt)),{x:Be+kt*je,y:He+kt*Xe}}let _e=ke=>{let xe=ke.currentTarget.ownerSVGElement;if(!xe)return;let Be=xe.getScreenCTM();if(!Be)return;let He=Be.inverse();x({x:He.a*ke.clientX+He.c*ke.clientY+He.e,y:He.b*ke.clientX+He.d*ke.clientY+He.f});},$=()=>{g(false),x(null),c?.(false);},ee=()=>{g(true),c?.(true);},le=ke=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:ke,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:q,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:q,r:9,fill:Le,stroke:te,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:q-3,x2:B+3,y2:q+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:q-3,x2:B-3,y2:q+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:$,onMouseMove:_e,children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:J,fill:G,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:G,opacity:.9,style:{pointerEvents:"none"}}),le({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ee,onMouseLeave:$,onMouseMove:_e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:J,fill:G,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:G,style:{pointerEvents:"none"}}),le({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:ee,onMouseLeave:$,onMouseMove:_e,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:S,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:Y,strokeWidth:T,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:m||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:J,fill:Y,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:Y,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Li({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.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=Se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
131
|
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Se.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=Se.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)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.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=Se.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=>Se.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=Se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,w)=>b+w,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((w,C)=>(w.position??0)-(C.position??0)).forEach((w,C)=>{let S=f?`${f}.${C+1}`:`${C+1}`;c.set(w.id,S),w.subtasks?.length&&i(w.subtasks,S);});};i(e);let p=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?Se.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,w=h.timeLoggedMinutes,C=h.soldEffortMinutes,S=typeof b=="number"?+(b/60).toFixed(1):0,E=typeof w=="number"?+(w/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,v=h._costRate>0?h._costRate:l(h),P={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Se.formatDate(h.startDate):"","End Date":h.endDate?Se.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(M=>M.name).join(", ")||"","Estimated (h)":S||"","Logged (h)":E||"","Quoted (h)":k||""};p&&(P["$ Estimated"]=S>0&&v>0?Math.round(S*v):"",P["$ Executed"]=E>0&&v>0?Math.round(E*v):"",P["$ Quoted"]=k>0&&v>0?Math.round(k*v):"",P["Rate ($/h)"]=v>0?v:"");let L=h.weight;return P["Weight (%)"]=typeof L=="number"&&L>0?L:"",P["Is Milestone"]=h.isMilestone?"Yes":"No",P}),m=a?.projectName||"";if(m||d.length>0){let h=0,f=0,b=0,w=0,C=0,S=0,E=0,k=0,v=o.filter(M=>M.startDate).map(M=>M.startDate.getTime()),P=o.filter(M=>M.endDate).map(M=>M.endDate.getTime());for(let M of d)typeof M["Estimated (h)"]=="number"&&(h+=M["Estimated (h)"]),typeof M["Logged (h)"]=="number"&&(f+=M["Logged (h)"]),typeof M["Quoted (h)"]=="number"&&(b+=M["Quoted (h)"]),p&&(typeof M["$ Estimated"]=="number"&&(w+=M["$ Estimated"]),typeof M["$ Executed"]=="number"&&(C+=M["$ Executed"]),typeof M["$ Quoted"]=="number"&&(S+=M["$ Quoted"])),typeof M["Progress (%)"]=="number"&&(E+=M["Progress (%)"],k++);let L={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":v.length>0?Se.formatDate(new Date(Math.min(...v))):"","End Date":P.length>0?Se.formatDate(new Date(Math.max(...P))):"","Duration (days)":v.length>0&&P.length>0?Se.calculateDuration(new Date(Math.min(...v)),new Date(Math.max(...P))):"","Progress (%)":k>0?Math.round(E/k):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+f.toFixed(1)||"","Quoted (h)":+b.toFixed(1)||""};p&&(L["$ Estimated"]=w||"",L["$ Executed"]=C||"",L["$ Quoted"]=S||"",L["Rate ($/h)"]=""),L["Is Milestone"]="No",d.unshift(L);}let g=r.utils.json_to_sheet(d),y=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...p?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,f=w=>String(w).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${f(h.getMonth()+1)}-${f(h.getDate())}_${f(h.getHours())}${f(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Se.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Se.getEarliestStartDate(e)||new Date,l=Se.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let y=o.get(m.id),x=m.startDate&&m.endDate?Se.calculateDuration(m.startDate,m.endDate):0,h=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
@@ -358,14 +358,14 @@
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let m=d+p;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;m=Math.min(m,x);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(m,{es:x,ef:x+y});let h=s.get(m)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=p;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let m of c){let g=l.get(m),y=d.get(m),x=y.ls-g.es,h=s.get(m)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let l=Se.getLatestEndDate(e);if(!l)return null;let c=Se.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Se.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),p<y&&(p=y);}let d=Se.calculateEndDate(p,i),m=g=>g.map(y=>y.id===c.id?{...y,startDate:p,endDate:d}:y.subtasks?{...y,subtasks:m(y.subtasks)}:y);l=m(l),l=Se.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(M=>M.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),S=(f.endDate.getTime()-w)/p,k=(w-i)/p*s,v=k+y*s,P=Math.max(S*s,s),L=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:v,width:P,y:L,rowIndex:b,daysDelta:y,color:f.color}),m(f.id,y,x);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Bi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:C=true,canEditTask:S,onTaskProgressDrag:E}){let v=Or(),P=react.useRef(null),[L,M]=react.useState([]),[J,H]=react.useState(null),[Y,T]=react.useState(null),[G,te]=react.useState(null),Le=react.useRef(false),[B,q]=react.useState(new Set),[be,_e]=react.useState(null),$=react.useCallback(V=>{if(G&&!Le.current){let D=V.target,U=false;for(;D&&D!==V.currentTarget;){if(D.getAttribute?.("data-dependency-line")==="true"||D.getAttribute?.("data-dependency-hover-overlay")==="true"){U=true;break}D=D.parentElement;}U||te(null);}},[G]),ee=react.useCallback(V=>{T(V);},[]),le=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ke=r==="day"?60:r==="week"?20:8,xe=le*ke*n,Be=V=>{let D=new Date(Date.UTC(V.getFullYear(),V.getMonth(),V.getDate())),U=D.getUTCDay()||7;D.setUTCDate(D.getUTCDate()+4-U);let ae=new Date(Date.UTC(D.getUTCFullYear(),0,1));return Math.ceil(((D.getTime()-ae.getTime())/864e5+1)/7)},He=V=>{let D=V.getDay();return D===0||D===6},at=react.useCallback(V=>{let D=Math.round(V/(ke*n)),U=new Date(o);return U.setDate(U.getDate()+D),U},[o,ke,n]),ue=react.useCallback((V,D)=>{if(D.startDate&&D.endDate)return;let U=V.currentTarget.ownerSVGElement;if(!U)return;let ae=U.createSVGPoint();ae.x=V.clientX,ae.y=V.clientY;let Ne=ae.matrixTransform(U.getScreenCTM()?.inverse()),z=at(Ne.x),oe=new Date(z);oe.setDate(oe.getDate()+1),_e(null),y?.(D,z,oe);},[at,y]),je=react.useCallback((V,D,U)=>{let ae=V.currentTarget.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=V.clientX,Ne.y=V.clientY;let z=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),oe=at(z.x),ge=Math.round(z.x/(ke*n))*ke*n;_e({taskId:D.id,x:ge,y:U*a+a/2,date:oe});},[at,ke,n,a]),Xe=react.useCallback(()=>{_e(null);},[]),he=react.useMemo(()=>{let V=Ne=>Ne.map(z=>{if(z.subtasks&&z.subtasks.length>0){let oe=V(z.subtasks),Ge=oe.filter(ge=>ge.startDate&&ge.endDate);if(Ge.length>0){let ge=Ge.map(lt=>lt.startDate.getTime()),Ve=Ge.map(lt=>lt.endDate.getTime()),Oe=new Date(Math.min(...ge)),Ue=new Date(Math.max(...Ve));return {...z,subtasks:oe,startDate:Oe,endDate:Ue}}return {...z,subtasks:oe}}return z}),D=(Ne,z=[])=>{let oe=[...Ne].sort((Ge,ge)=>(Ge.position??0)-(ge.position??0));for(let Ge of oe)z.push(Ge),Ge.subtasks&&Ge.subtasks.length>0&&(Ge.isExpanded===void 0||Ge.isExpanded)&&D(Ge.subtasks,z);return z},U=V(e);return D(U)},[e]),kt=react.useCallback(V=>{if(!V.startDate||!V.endDate)return {x:0,width:0};let D=V.startDate.getTime(),U=V.endDate.getTime(),ae=o.getTime(),Ne=(D-ae)/(1e3*60*60*24),z=(U-D)/(1e3*60*60*24)+1,oe=Ne*ke*n,Ge=Math.max(ke*n,40),ge=Math.max(z*ke*n,Ge);return {x:oe,width:ge}},[o,ke,n]),xt=react.useMemo(()=>he.filter(V=>V.startDate&&V.endDate).map(V=>{let{x:D,width:U}=kt(V),Ne=he.findIndex(z=>z.id===V.id)*a+(a-18)/2;return {id:V.id,x:D,y:Ne,width:U,height:18}}),[he,kt]),nt=react.useCallback((V,D,U)=>{if(!U){M([]),H(null);return}if(H({taskId:V,daysDelta:D}),D===0){M([]);return}let ae=Se.calculateCascadePreview(e,V,D,he,o,ke*n,a,48);M(ae);},[e,he,o,ke,n,a,48]),ze=react.useCallback((V,D)=>{if(!J)return D;let U=ke*n,ae=J.daysDelta*U;if(V===J.taskId)return {x:D.x+ae,width:D.width};let Ne=L.find(z=>z.taskId===V);return Ne?{x:Ne.previewX,width:Ne.width}:D},[J,L,ke,n]),ct=react.useMemo(()=>{let V=[],D=new Date(o);for(;D<=s;){let Ne=(D.getTime()-o.getTime())/864e5*ke*n;if(r==="day")V.push({date:new Date(D),label:D.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ne}),D.setDate(D.getDate()+1);else if(r==="week"){let z=Be(D);V.push({date:new Date(D),label:`${v.labels.week} ${z}`,x:Ne}),D.setDate(D.getDate()+7);}else V.push({date:new Date(D),label:D.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ne}),D.setMonth(D.getMonth()+1);}return V},[o,s,r,ke,n,l,v.labels.week]),et=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ke*n,[o,ke,n]),Ee=Math.max(he.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(xe,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(xe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ct.map((V,D)=>jsxRuntime.jsxs("g",{children:[D>0&&jsxRuntime.jsx("line",{x1:V.x,y1:0,x2:V.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:V.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:V.label})]},`header-${D}`)),et>=0&&et<=xe&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:et,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:et,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${et-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:v.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(xe,1e3),height:Ee,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:$,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(xe,1e3),height:Ee,fill:t.bgPrimary}),he.map((V,D)=>jsxRuntime.jsx("rect",{x:0,y:D*a,width:Math.max(xe,1e3),height:a,fill:D%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${V.id}`)),ct.map((V,D)=>D>0?jsxRuntime.jsx("line",{x1:V.x,y1:0,x2:V.x,y2:he.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${D}`):null),C&&ct.map((V,D)=>{let U=ct[D+1]?.x||xe;return He(V.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:V.x,y:0,width:U-V.x,height:he.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:V.x,y:0,width:U-V.x,height:he.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${D}`):null}),he.map((V,D)=>{let U=V.startDate&&V.endDate;return jsxRuntime.jsx("g",{children:!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:D*a,width:xe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ae=>ue(ae,V),onMouseMove:ae=>je(ae,V,D),onMouseLeave:()=>{Xe();}},`clickable-${V.id}`),be&&be.taskId===V.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:be.x,y1:D*a+4,x2:be.x,y2:D*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:be.x,cy:be.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:be.x,cy:be.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${be.x}, ${D*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:be.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!be||be.taskId!==V.id)&&jsxRuntime.jsx("text",{x:et>0?et:100,y:D*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${V.id}`)]})},`row-group-${V.id}`)}),he.map((V,D)=>{if(!V.startDate||!V.endDate)return null;let{x:U,width:ae}=kt(V),Ne=D*a+(a-18)/2,z=V.subtasks&&V.subtasks.length>0&&!V.isMilestone;if(V.isMilestone)return jsxRuntime.jsx(Li,{task:V,x:U+ae/2,y:Ne+12,theme:t,onClick:d},V.id);if(z){let oe=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ge=8,ge=Ne+(a-18)/2+(18-Ge)/2,Ve=4,Oe=V.progress||0,Ue=new Date;Ue.setHours(0,0,0,0);let lt=V.startDate&&Ue>=V.startDate,ot=V.endDate&&(()=>{let mt=new Date(V.endDate);return mt.setHours(0,0,0,0),Ue>mt})(),st=V.startDate&&Ue<V.startDate,pt=1;if(lt&&V.startDate&&V.endDate&&!st){let mt=new Date(V.startDate);mt.setHours(0,0,0,0);let Vt=new Date(V.endDate);Vt.setHours(0,0,0,0);let ht=Math.max(1,(Vt.getTime()-mt.getTime())/(1e3*60*60*24)),ne=Math.min((Ue.getTime()-mt.getTime())/(1e3*60*60*24),ht)/ht*100;pt=ne>0?Oe/ne:1;}let Tt;Oe>=100?Tt="#00E5CC":st?Tt="#4B5563":ot&&Oe<100?Tt="#EF4444":pt>=.95?Tt="#22C55E":pt>=.8?Tt="#F59E0B":Tt="#EF4444";let Ot=Math.max(Oe/100*ae,Oe>0?Ve*2:0),St=ae>100&&Oe>0,Et=V.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(V),onContextMenu:mt=>{mt.preventDefault(),mt.stopPropagation(),g?.(V,mt);},onMouseMove:mt=>{ee({task:V,x:U,y:ge,width:ae,height:Ge,showBelow:ge<100,mouseX:mt.clientX,mouseY:mt.clientY});},onMouseLeave:()=>ee(null),style:{cursor:"default",opacity:b?Et?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:U,y:Ne,width:ae,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:U,y:ge,width:ae,height:Ge,rx:Ve,fill:oe?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Oe>0&&jsxRuntime.jsx("rect",{x:U,y:ge,width:Ot,height:Ge,rx:Ve,fill:Tt}),b&&Et&&jsxRuntime.jsx("rect",{x:U,y:ge,width:ae,height:Ge,rx:Ve,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),St&&jsxRuntime.jsxs("text",{x:U+Ot+6,y:ge+Ge/2,dominantBaseline:"central",fill:oe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Oe),"%"]})]},V.id)}return jsxRuntime.jsx(Ei,{task:V,x:U,y:Ne,width:ae,theme:t,dayWidth:ke*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:xt,onDragMove:nt,onHoverChange:ee,showBaseline:f,showTaskBarLabels:p,showCriticalPath:b,readOnly:S?!S(V):false,onProgressChange:E},V.id)}),w&&he.map((V,D)=>!V.dependencies||V.dependencies.length===0||!V.startDate||!V.endDate?null:V.dependencies.map(U=>{let ae=he.find(Tt=>Tt.id===U);if(!ae||!ae.startDate||!ae.endDate)return null;let Ne=he.findIndex(Tt=>Tt.id===U),z=ze(ae.id,kt(ae)),oe=ze(V.id,kt(V)),Ge=z.x+z.width,ge=Ne*a+26,Ve=oe.x,Oe=D*a+26,Ue=`dep-${U}-${V.id}`;if(B.has(Ue))return null;let lt=b&&V.isCriticalPath&&ae.isCriticalPath;return jsxRuntime.jsx(ks,{x1:Ge,y1:ge,x2:Ve,y2:Oe,theme:t,lineStyle:i,colorOverride:b?lt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?lt?2:1:void 0,glowFilter:lt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(V.id,U),onHoverChange:Tt=>{Le.current=Tt,Tt&&te({key:Ue,fromId:U,toId:V.id,exitX:Ge,exitY:ge,enterX:Ve,enterY:Oe});}},Ue)})),L.map(V=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:V.previewX,y:V.y-48,width:V.width,height:18,rx:6,fill:V.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(V.daysDelta)>0&&jsxRuntime.jsx("text",{x:V.previewX+V.width/2,y:V.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:V.daysDelta>0?`+${V.daysDelta}d`:`${V.daysDelta}d`})]},`cascade-preview-${V.taskId}`)),w&&G&&jsxRuntime.jsx(ks,{x1:G.exitX,y1:G.exitY,x2:G.enterX,y2:G.enterY,theme:t,lineStyle:i,onDelete:()=>{let V=G.key;te(null),Le.current=false,q(D=>new Set(D).add(V)),h?.(G.toId,G.fromId);},hoverOverlayOnly:true,onHoverChange:V=>{Le.current=V,V||te(null);}},`${G.key}-hover-overlay`),et>=0&&et<=xe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:et,y1:0,x2:et,y2:Ee,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:et,y1:0,x2:et,y2:Ee,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Y&&jsxRuntime.jsx(vm,{tooltipData:Y,theme:t,locale:l==="es"?"es":"en"})]})}var Lv=['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"'],Cm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Iv=()=>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"})}),Bv=()=>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"})}),Rv=()=>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"})}),Ov=()=>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 $i({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=react.useState(false),[d,m]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[f,b]=react.useState(false),[w,C]=react.useState(true),[S,E]=react.useState(""),[k,v]=react.useState(-1),[P,L]=react.useState(false),[M,J]=react.useState(0),H=react.useRef(null),Y=react.useRef(null),T=react.useRef(null),G=react.useRef(null),{enabled:te=true,placeholder:Le='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:q,suggestions:be=Lv,maxHistory:_e=50,persistHistory:$,mentionableUsers:ee=[]}=a,le=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ke=le?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",xe=le?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Be=le?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",He=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ue=le?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",je=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Xe=le?"rgba(46, 148, 255, 0.9)":"#2E94FF",he=le?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",kt=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",xt=le?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",nt=le?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ze=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",ct=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",et=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Ee=le?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",V=le?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=le?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",U=le?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ae=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ne="rgba(46, 148, 255, 0.04)",z=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",oe=le?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ge=le?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ge=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ve=le?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Oe=le?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ue=le?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=le?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ot="rgba(46, 148, 255, 0.06)",st=le?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Tt=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ot=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",St=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Et=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ft=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",mt=le?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Vt=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",ht=le?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",it=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pe=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",O=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",_=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",De=$?.storageKey||"gantt-ai-history",Qe=$?.maxMessages??5,bt=ee.filter(I=>{if(!S)return true;let ye=S.toLowerCase();return I.name.toLowerCase().includes(ye)||I.email&&I.email.toLowerCase().includes(ye)}).slice(0,5),Dt=react.useCallback(I=>{if(h(I),ee.length===0)return;let ye=H.current;if(!ye)return;let Z=ye.selectionStart||I.length,N=I.slice(0,Z),K=N.lastIndexOf("@");if(K>=0&&((K>0?N[K-1]:" ")===" "||K===0)){let Pe=N.slice(K+1);if(Pe.length<=40){E(Pe),v(K),L(true),J(0);return}}L(false),E(""),v(-1);},[ee.length]),Pt=react.useCallback(I=>{let ye=x.slice(0,k),Z=x.slice(k+1+S.length),N=`${ye}@${I.name} ${Z}`;h(N),L(false),E(""),v(-1),setTimeout(()=>H.current?.focus(),0);},[x,k,S]),At=react.useCallback(I=>{if(!P||bt.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),J(ye=>ye<bt.length-1?ye+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),J(ye=>ye>0?ye-1:bt.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let ye=bt[M];return ye&&Pt(ye),true}return I.key==="Escape"?(L(false),true):false},[P,bt,M,Pt]);react.useEffect(()=>{if($?.enabled)try{let I=localStorage.getItem(De);if(I){let Z=JSON.parse(I).map(N=>({...N,timestamp:new Date(N.timestamp)}));y(Z.slice(-Qe));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[$?.enabled,De,Qe]),react.useEffect(()=>{if($?.enabled&&g.length>0)try{let I=g.filter(ye=>!ye.isLoading).slice(-Qe);localStorage.setItem(De,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,$?.enabled,De,Qe]),react.useEffect(()=>{Y.current&&Y.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,d]);let ta=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&l?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&c?.(I.taskId,I.dependencyFrom);break}},[o,s,n,l,c]),la=react.useCallback(async I=>{if(!I.trim()||f)return;let ye={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(N=>[...N.slice(-(_e-1)),ye]),h(""),C(false),b(true);let Z={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(N=>[...N,Z]);try{if(q){let N=await q(I,e);y(K=>{let Te=K.filter($t=>!$t.isLoading),Pe={id:`assistant-${Date.now()}`,role:"assistant",content:N.message,timestamp:new Date,command:N};return [...Te,Pe]}),ta(N);}else y(N=>[...N.filter(Te=>!Te.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(N){y(K=>[...K.filter(Pe=>!Pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${N instanceof Error?N.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,_e,q,e,ta]),Q=I=>{I.preventDefault(),la(x);},$e=I=>{h(I),H.current?.focus();};if(react.useEffect(()=>{let I=ye=>{(ye.metaKey||ye.ctrlKey)&&ye.key==="k"&&(ye.preventDefault(),p(Z=>!Z),i||m(false)),ye.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[i]),react.useEffect(()=>{if(!i)return;let I=Z=>{let N=Z.target;T.current&&!T.current.contains(N)&&p(false);},ye=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(ye),document.removeEventListener("mousedown",I);}},[i]),!te)return null;let Fe={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Fe[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ke,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${xe}`,color:"#2E94FF",cursor:"pointer",boxShadow:Be,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Cm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Xe,background:ue,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${je}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let m=d+p;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;m=Math.min(m,x);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(m,{es:x,ef:x+y});let h=s.get(m)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=p;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let m of c){let g=l.get(m),y=d.get(m),x=y.ls-g.es,h=s.get(m)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=p-g.ef,t.set(m,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let l=Se.getLatestEndDate(e);if(!l)return null;let c=Se.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Se.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),p<y&&(p=y);}let d=Se.calculateEndDate(p,i),m=g=>g.map(y=>y.id===c.id?{...y,startDate:p,endDate:d}:y.subtasks?{...y,subtasks:m(y.subtasks)}:y);l=m(l),l=Se.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(M=>M.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),S=(f.endDate.getTime()-w)/p,k=(w-i)/p*s,v=k+y*s,P=Math.max(S*s,s),L=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:v,width:P,y:L,rowIndex:b,daysDelta:y,color:f.color}),m(f.id,y,x);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Bi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:C=true,canEditTask:S,onTaskProgressDrag:E}){let v=$r(),P=react.useRef(null),[L,M]=react.useState([]),[J,H]=react.useState(null),[Y,T]=react.useState(null),[G,te]=react.useState(null),Le=react.useRef(false),[B,q]=react.useState(new Set),[be,_e]=react.useState(null),$=react.useCallback(V=>{if(G&&!Le.current){let D=V.target,U=false;for(;D&&D!==V.currentTarget;){if(D.getAttribute?.("data-dependency-line")==="true"||D.getAttribute?.("data-dependency-hover-overlay")==="true"){U=true;break}D=D.parentElement;}U||te(null);}},[G]),ee=react.useCallback(V=>{T(V);},[]),le=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ke=r==="day"?60:r==="week"?20:8,xe=le*ke*n,Be=V=>{let D=new Date(Date.UTC(V.getFullYear(),V.getMonth(),V.getDate())),U=D.getUTCDay()||7;D.setUTCDate(D.getUTCDate()+4-U);let ae=new Date(Date.UTC(D.getUTCFullYear(),0,1));return Math.ceil(((D.getTime()-ae.getTime())/864e5+1)/7)},He=V=>{let D=V.getDay();return D===0||D===6},at=react.useCallback(V=>{let D=Math.round(V/(ke*n)),U=new Date(o);return U.setDate(U.getDate()+D),U},[o,ke,n]),ue=react.useCallback((V,D)=>{if(D.startDate&&D.endDate)return;let U=V.currentTarget.ownerSVGElement;if(!U)return;let ae=U.createSVGPoint();ae.x=V.clientX,ae.y=V.clientY;let Ne=ae.matrixTransform(U.getScreenCTM()?.inverse()),z=at(Ne.x),oe=new Date(z);oe.setDate(oe.getDate()+1),_e(null),y?.(D,z,oe);},[at,y]),je=react.useCallback((V,D,U)=>{let ae=V.currentTarget.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=V.clientX,Ne.y=V.clientY;let z=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),oe=at(z.x),ge=Math.round(z.x/(ke*n))*ke*n;_e({taskId:D.id,x:ge,y:U*a+a/2,date:oe});},[at,ke,n,a]),Xe=react.useCallback(()=>{_e(null);},[]),he=react.useMemo(()=>{let V=Ne=>Ne.map(z=>{if(z.subtasks&&z.subtasks.length>0){let oe=V(z.subtasks),Ge=oe.filter(ge=>ge.startDate&&ge.endDate);if(Ge.length>0){let ge=Ge.map(lt=>lt.startDate.getTime()),Ve=Ge.map(lt=>lt.endDate.getTime()),Oe=new Date(Math.min(...ge)),Ue=new Date(Math.max(...Ve));return {...z,subtasks:oe,startDate:Oe,endDate:Ue}}return {...z,subtasks:oe}}return z}),D=(Ne,z=[])=>{let oe=[...Ne].sort((Ge,ge)=>(Ge.position??0)-(ge.position??0));for(let Ge of oe)z.push(Ge),Ge.subtasks&&Ge.subtasks.length>0&&(Ge.isExpanded===void 0||Ge.isExpanded)&&D(Ge.subtasks,z);return z},U=V(e);return D(U)},[e]),kt=react.useCallback(V=>{if(!V.startDate||!V.endDate)return {x:0,width:0};let D=V.startDate.getTime(),U=V.endDate.getTime(),ae=o.getTime(),Ne=(D-ae)/(1e3*60*60*24),z=(U-D)/(1e3*60*60*24)+1,oe=Ne*ke*n,Ge=Math.max(ke*n,40),ge=Math.max(z*ke*n,Ge);return {x:oe,width:ge}},[o,ke,n]),xt=react.useMemo(()=>he.filter(V=>V.startDate&&V.endDate).map(V=>{let{x:D,width:U}=kt(V),Ne=he.findIndex(z=>z.id===V.id)*a+(a-18)/2;return {id:V.id,x:D,y:Ne,width:U,height:18}}),[he,kt]),nt=react.useCallback((V,D,U)=>{if(!U){M([]),H(null);return}if(H({taskId:V,daysDelta:D}),D===0){M([]);return}let ae=Se.calculateCascadePreview(e,V,D,he,o,ke*n,a,48);M(ae);},[e,he,o,ke,n,a,48]),ze=react.useCallback((V,D)=>{if(!J)return D;let U=ke*n,ae=J.daysDelta*U;if(V===J.taskId)return {x:D.x+ae,width:D.width};let Ne=L.find(z=>z.taskId===V);return Ne?{x:Ne.previewX,width:Ne.width}:D},[J,L,ke,n]),ct=react.useMemo(()=>{let V=[],D=new Date(o);for(;D<=s;){let Ne=(D.getTime()-o.getTime())/864e5*ke*n;if(r==="day")V.push({date:new Date(D),label:D.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ne}),D.setDate(D.getDate()+1);else if(r==="week"){let z=Be(D);V.push({date:new Date(D),label:`${v.labels.week} ${z}`,x:Ne}),D.setDate(D.getDate()+7);}else V.push({date:new Date(D),label:D.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ne}),D.setMonth(D.getMonth()+1);}return V},[o,s,r,ke,n,l,v.labels.week]),et=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ke*n,[o,ke,n]),Ee=Math.max(he.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(xe,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(xe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ct.map((V,D)=>jsxRuntime.jsxs("g",{children:[D>0&&jsxRuntime.jsx("line",{x1:V.x,y1:0,x2:V.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:V.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:V.label})]},`header-${D}`)),et>=0&&et<=xe&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:et,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:et,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${et-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:v.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(xe,1e3),height:Ee,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:$,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(xe,1e3),height:Ee,fill:t.bgPrimary}),he.map((V,D)=>jsxRuntime.jsx("rect",{x:0,y:D*a,width:Math.max(xe,1e3),height:a,fill:D%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${V.id}`)),ct.map((V,D)=>D>0?jsxRuntime.jsx("line",{x1:V.x,y1:0,x2:V.x,y2:he.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${D}`):null),C&&ct.map((V,D)=>{let U=ct[D+1]?.x||xe;return He(V.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:V.x,y:0,width:U-V.x,height:he.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:V.x,y:0,width:U-V.x,height:he.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${D}`):null}),he.map((V,D)=>{let U=V.startDate&&V.endDate;return jsxRuntime.jsx("g",{children:!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:D*a,width:xe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ae=>ue(ae,V),onMouseMove:ae=>je(ae,V,D),onMouseLeave:()=>{Xe();}},`clickable-${V.id}`),be&&be.taskId===V.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:be.x,y1:D*a+4,x2:be.x,y2:D*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:be.x,cy:be.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:be.x,cy:be.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${be.x}, ${D*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:be.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!be||be.taskId!==V.id)&&jsxRuntime.jsx("text",{x:et>0?et:100,y:D*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${V.id}`)]})},`row-group-${V.id}`)}),he.map((V,D)=>{if(!V.startDate||!V.endDate)return null;let{x:U,width:ae}=kt(V),Ne=D*a+(a-18)/2,z=V.subtasks&&V.subtasks.length>0&&!V.isMilestone;if(V.isMilestone)return jsxRuntime.jsx(Li,{task:V,x:U+ae/2,y:Ne+12,theme:t,onClick:d},V.id);if(z){let oe=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ge=8,ge=Ne+(a-18)/2+(18-Ge)/2,Ve=4,Oe=V.progress||0,Ue=new Date;Ue.setHours(0,0,0,0);let lt=V.startDate&&Ue>=V.startDate,ot=V.endDate&&(()=>{let mt=new Date(V.endDate);return mt.setHours(0,0,0,0),Ue>mt})(),st=V.startDate&&Ue<V.startDate,pt=1;if(lt&&V.startDate&&V.endDate&&!st){let mt=new Date(V.startDate);mt.setHours(0,0,0,0);let Vt=new Date(V.endDate);Vt.setHours(0,0,0,0);let ht=Math.max(1,(Vt.getTime()-mt.getTime())/(1e3*60*60*24)),ne=Math.min((Ue.getTime()-mt.getTime())/(1e3*60*60*24),ht)/ht*100;pt=ne>0?Oe/ne:1;}let Tt;Oe>=100?Tt="#00E5CC":st?Tt="#4B5563":ot&&Oe<100?Tt="#EF4444":pt>=.95?Tt="#22C55E":pt>=.8?Tt="#F59E0B":Tt="#EF4444";let Ot=Math.max(Oe/100*ae,Oe>0?Ve*2:0),St=ae>100&&Oe>0,Et=V.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(V),onContextMenu:mt=>{mt.preventDefault(),mt.stopPropagation(),g?.(V,mt);},onMouseMove:mt=>{ee({task:V,x:U,y:ge,width:ae,height:Ge,showBelow:ge<100,mouseX:mt.clientX,mouseY:mt.clientY});},onMouseLeave:()=>ee(null),style:{cursor:"default",opacity:b?Et?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:U,y:Ne,width:ae,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:U,y:ge,width:ae,height:Ge,rx:Ve,fill:oe?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Oe>0&&jsxRuntime.jsx("rect",{x:U,y:ge,width:Ot,height:Ge,rx:Ve,fill:Tt}),b&&Et&&jsxRuntime.jsx("rect",{x:U,y:ge,width:ae,height:Ge,rx:Ve,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),St&&jsxRuntime.jsxs("text",{x:U+Ot+6,y:ge+Ge/2,dominantBaseline:"central",fill:oe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Oe),"%"]})]},V.id)}return jsxRuntime.jsx(Ei,{task:V,x:U,y:Ne,width:ae,theme:t,dayWidth:ke*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:xt,onDragMove:nt,onHoverChange:ee,showBaseline:f,showTaskBarLabels:p,showCriticalPath:b,readOnly:S?!S(V):false,onProgressChange:E},V.id)}),w&&he.map((V,D)=>!V.dependencies||V.dependencies.length===0||!V.startDate||!V.endDate?null:V.dependencies.map(U=>{let ae=he.find(Tt=>Tt.id===U);if(!ae||!ae.startDate||!ae.endDate)return null;let Ne=he.findIndex(Tt=>Tt.id===U),z=ze(ae.id,kt(ae)),oe=ze(V.id,kt(V)),Ge=z.x+z.width,ge=Ne*a+26,Ve=oe.x,Oe=D*a+26,Ue=`dep-${U}-${V.id}`;if(B.has(Ue))return null;let lt=b&&V.isCriticalPath&&ae.isCriticalPath;return jsxRuntime.jsx(Cs,{x1:Ge,y1:ge,x2:Ve,y2:Oe,theme:t,lineStyle:i,colorOverride:b?lt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?lt?2:1:void 0,glowFilter:lt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(V.id,U),onHoverChange:Tt=>{Le.current=Tt,Tt&&te({key:Ue,fromId:U,toId:V.id,exitX:Ge,exitY:ge,enterX:Ve,enterY:Oe});}},Ue)})),L.map(V=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:V.previewX,y:V.y-48,width:V.width,height:18,rx:6,fill:V.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(V.daysDelta)>0&&jsxRuntime.jsx("text",{x:V.previewX+V.width/2,y:V.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:V.daysDelta>0?`+${V.daysDelta}d`:`${V.daysDelta}d`})]},`cascade-preview-${V.taskId}`)),w&&G&&jsxRuntime.jsx(Cs,{x1:G.exitX,y1:G.exitY,x2:G.enterX,y2:G.enterY,theme:t,lineStyle:i,onDelete:()=>{let V=G.key;te(null),Le.current=false,q(D=>new Set(D).add(V)),h?.(G.toId,G.fromId);},hoverOverlayOnly:true,onHoverChange:V=>{Le.current=V,V||te(null);}},`${G.key}-hover-overlay`),et>=0&&et<=xe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:et,y1:0,x2:et,y2:Ee,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:et,y1:0,x2:et,y2:Ee,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Y&&jsxRuntime.jsx(vm,{tooltipData:Y,theme:t,locale:l==="es"?"es":"en"})]})}var Lv=['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"'],Cm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Iv=()=>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"})}),Bv=()=>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"})}),Rv=()=>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"})}),Ov=()=>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 $i({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=react.useState(false),[d,m]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[f,b]=react.useState(false),[w,C]=react.useState(true),[S,E]=react.useState(""),[k,v]=react.useState(-1),[P,L]=react.useState(false),[M,J]=react.useState(0),H=react.useRef(null),Y=react.useRef(null),T=react.useRef(null),G=react.useRef(null),{enabled:te=true,placeholder:Le='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:q,suggestions:be=Lv,maxHistory:_e=50,persistHistory:$,mentionableUsers:ee=[]}=a,le=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ke=le?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",xe=le?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Be=le?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",He=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",at=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ue=le?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",je=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Xe=le?"rgba(46, 148, 255, 0.9)":"#2E94FF",he=le?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",kt=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",xt=le?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",nt=le?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ze=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",ct=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",et=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Ee=le?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",V=le?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=le?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",U=le?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ae=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ne="rgba(46, 148, 255, 0.04)",z=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",oe=le?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ge=le?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ge=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ve=le?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Oe=le?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ue=le?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=le?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ot="rgba(46, 148, 255, 0.06)",st=le?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Tt=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ot=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",St=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Et=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ft=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",mt=le?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Vt=le?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",ht=le?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",it=le?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pe=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",O=le?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",_=le?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",De=$?.storageKey||"gantt-ai-history",Qe=$?.maxMessages??5,bt=ee.filter(I=>{if(!S)return true;let ye=S.toLowerCase();return I.name.toLowerCase().includes(ye)||I.email&&I.email.toLowerCase().includes(ye)}).slice(0,5),Dt=react.useCallback(I=>{if(h(I),ee.length===0)return;let ye=H.current;if(!ye)return;let Z=ye.selectionStart||I.length,N=I.slice(0,Z),K=N.lastIndexOf("@");if(K>=0&&((K>0?N[K-1]:" ")===" "||K===0)){let Pe=N.slice(K+1);if(Pe.length<=40){E(Pe),v(K),L(true),J(0);return}}L(false),E(""),v(-1);},[ee.length]),Pt=react.useCallback(I=>{let ye=x.slice(0,k),Z=x.slice(k+1+S.length),N=`${ye}@${I.name} ${Z}`;h(N),L(false),E(""),v(-1),setTimeout(()=>H.current?.focus(),0);},[x,k,S]),At=react.useCallback(I=>{if(!P||bt.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),J(ye=>ye<bt.length-1?ye+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),J(ye=>ye>0?ye-1:bt.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let ye=bt[M];return ye&&Pt(ye),true}return I.key==="Escape"?(L(false),true):false},[P,bt,M,Pt]);react.useEffect(()=>{if($?.enabled)try{let I=localStorage.getItem(De);if(I){let Z=JSON.parse(I).map(N=>({...N,timestamp:new Date(N.timestamp)}));y(Z.slice(-Qe));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[$?.enabled,De,Qe]),react.useEffect(()=>{if($?.enabled&&g.length>0)try{let I=g.filter(ye=>!ye.isLoading).slice(-Qe);localStorage.setItem(De,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,$?.enabled,De,Qe]),react.useEffect(()=>{Y.current&&Y.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,d]);let ta=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&l?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&c?.(I.taskId,I.dependencyFrom);break}},[o,s,n,l,c]),la=react.useCallback(async I=>{if(!I.trim()||f)return;let ye={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(N=>[...N.slice(-(_e-1)),ye]),h(""),C(false),b(true);let Z={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(N=>[...N,Z]);try{if(q){let N=await q(I,e);y(K=>{let Te=K.filter($t=>!$t.isLoading),Pe={id:`assistant-${Date.now()}`,role:"assistant",content:N.message,timestamp:new Date,command:N};return [...Te,Pe]}),ta(N);}else y(N=>[...N.filter(Te=>!Te.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(N){y(K=>[...K.filter(Pe=>!Pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${N instanceof Error?N.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,_e,q,e,ta]),Q=I=>{I.preventDefault(),la(x);},$e=I=>{h(I),H.current?.focus();};if(react.useEffect(()=>{let I=ye=>{(ye.metaKey||ye.ctrlKey)&&ye.key==="k"&&(ye.preventDefault(),p(Z=>!Z),i||m(false)),ye.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[i]),react.useEffect(()=>{if(!i)return;let I=Z=>{let N=Z.target;T.current&&!T.current.contains(N)&&p(false);},ye=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(ye),document.removeEventListener("mousedown",I);}},[i]),!te)return null;let Fe={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Fe[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ke,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${xe}`,color:"#2E94FF",cursor:"pointer",boxShadow:Be,overflow:"visible"},onClick:()=>p(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Cm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Xe,background:ue,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${je}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:he,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${kt}`,boxShadow:xt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:nt,borderBottom:`1px solid ${ze}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ct,border:`1px solid ${et}`,color:"#2E94FF"},children:jsxRuntime.jsx(Cm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ee},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsxRuntime.jsx(Rv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsxRuntime.jsx(Bv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ae,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:be.slice(0,4).map((I,ye)=>jsxRuntime.jsx("button",{onClick:()=>$e(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:oe,border:`1px solid ${z}`},onMouseEnter:Z=>{Z.currentTarget.style.borderColor=Ge,Z.currentTarget.style.color="#2E94FF";},onMouseLeave:Z=>{Z.currentTarget.style.borderColor=z,Z.currentTarget.style.color=oe;},children:I.length>30?I.slice(0,30)+"...":I},ye))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?ge:Oe,color:I.role==="user"?"#2E94FF":lt,border:I.role==="user"?`1px solid ${Ve}`:`1px solid ${Ue}`},children:[I.isLoading?jsxRuntime.jsx(Ov,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:Y})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(P&&bt.length>0){I.preventDefault();return}Q(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ot}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&bt.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:G,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:mt,border:`1px solid ${Vt}`,boxShadow:ht,backdropFilter:"blur(12px)"},children:bt.map((I,ye)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Pt(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ye===M?it:"transparent",color:ne},onMouseEnter:()=>J(ye),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:O,border:`1px solid ${_}`,color:"#2E94FF"},children:I.name.split(" ").map(Z=>Z[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:pe},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${pt}`},children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:x,onChange:I=>Dt(I.target.value),onKeyDown:I=>{At(I);},placeholder:Le,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Tt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Ot:"transparent",color:x.trim()?"#2E94FF":Et,border:x.trim()?`1px solid ${St}`:"1px solid transparent"},children:jsxRuntime.jsx(Iv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Tm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Nm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Uv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.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=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Dm(e){return {...Uv,...e}}var Yv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Mm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:w="en",customTranslations:C,showCreateTaskButton:S=false,createTaskLabel:E,onCreateTask:k,taskFilter:v,onTaskFilterChange:P,toolbarRightContent:L,showBaseline:M,viewMode:J,onViewModeChange:H,projectForecast:Y,onThemeChange:T,onTaskClick:G,onTaskDblClick:te,onTaskContextMenu:Le,onTaskUpdate:B,onDependentTasksScheduled:q,onProgressChange:be,onTaskEdit:_e,onTaskAddSubtask:$,onTaskMarkIncomplete:ee,onTaskSetInProgress:le,onDependencyCreate:ke,onDependencyDelete:xe,onBeforeTaskAdd:Be,onAfterTaskAdd:He,onBeforeTaskUpdate:at,onAfterTaskUpdate:ue,onBeforeTaskDelete:je,onAfterTaskDelete:Xe,permissions:he,onCopySnapshotLink:kt}=a,nt=react.useContext(ki)?.theme,[ze,ct]=react.useState(nt||s||"dark"),[et,Ee]=react.useState(n),[V,D]=react.useState(l),[U,ae]=react.useState(1),[Ne,z]=react.useState("all"),[oe,Ge]=react.useState(J||"execution"),ge=J??oe,Ve=react.useCallback(A=>{Ge(A),H?.(A);},[H]),Oe=M??ge==="oracle",[Ue,lt]=react.useState(a.showCriticalPath!==false),[ot,st]=react.useState(a.showDependencies!==false),[pt,Tt]=react.useState(a.highlightWeekends!==false),Ot=react.useCallback(A=>{lt(A),a.onShowCriticalPathChange?.(A);},[a.onShowCriticalPathChange]),St=react.useCallback(A=>{st(A),a.onShowDependenciesChange?.(A);},[a.onShowDependenciesChange]),Et=react.useCallback(A=>{Tt(A),a.onHighlightWeekendsChange?.(A);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(et);},[et]),react.useEffect(()=>{a.onZoomChange?.(U);},[U]);let Ft=react.useRef(a.onDateRangeChange);Ft.current=a.onDateRangeChange;let mt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Vt,ht]=react.useState(()=>{if(!h)return "all";try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(j.taskFilter)return j.taskFilter}}catch(A){console.warn("[GanttBoard] Error loading filter state from localStorage:",A);}return "all"}),it=v??Vt,ne=P??ht,[pe,O]=react.useState(()=>{if(!h)return false;try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(A){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",A);}return false});react.useEffect(()=>{let A=mt();if(A)try{let R={taskFilter:it,hideCompleted:pe};localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[it,pe,mt]);let _=react.useRef(f);react.useEffect(()=>{if(_.current!==f&&f!==void 0){ht("all"),O(false);let A=mt();if(A)try{localStorage.removeItem(A);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}_.current=f;},[f,mt]);let[De,Qe]=react.useState(0),[bt,Dt]=react.useState(false),[Pt,At]=react.useState(null),[ta,la]=react.useState({isOpen:false,x:0,y:0,task:null}),[Q,$e]=react.useState(null),[Fe,I]=react.useState(null);react.useEffect(()=>{nt&&nt!==ze&&ct(nt);},[nt]),react.useEffect(()=>{s&&s!==ze&&ct(s);},[s]);let ye=react.useCallback(A=>{ct(A),T?.(A);},[T]),{state:Z,setState:N,undo:K,redo:Te,canUndo:Pe,canRedo:$t,clearHistory:Ct}=Tm(t,50),Jt=react.useMemo(()=>{let A=(R,j=0)=>{let X=j;for(let we of R)we.subtasks?.length&&(X=Math.max(X,A(we.subtasks,j+1)));return X};return A(Z)+1},[Z]),Wa=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ha=react.useRef(new Map),wa=react.useRef(false);if(!wa.current&&x){wa.current=true;let A=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(A);if(R){let j=JSON.parse(R);Array.isArray(j)&&(ha.current=new Map(j));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let lr=react.useCallback(()=>{let A=Wa();if(A)try{let R=Array.from(ha.current.entries());localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Wa]),Pr=react.useRef(0),Qn=react.useRef(Z);react.useEffect(()=>{Qn.current=Z;},[Z]);let Ur=react.useRef(false),F=react.useCallback(A=>{z(A),Pr.current+=1,N(R=>{let j=(we,Ae=0)=>we.map(Mt=>{let dt=A==="all"||Ae<A-1;return Mt.subtasks?.length&&ha.current.set(Mt.id,dt),{...Mt,isExpanded:dt,subtasks:Mt.subtasks?j(Mt.subtasks,Ae+1):void 0}}),X=j(R);return lr(),X});},[N,lr]);react.useEffect(()=>{if(Pr.current>0){Pr.current-=1;return}let A=j=>{let X=new Map;for(let we of j){let Ae=we.id;X.get(Ae)||X.set(Ae,we);}return Array.from(X.values())},R=j=>j.map(X=>{let we=ha.current.get(X.id),Ae=we!==void 0?{...X,isExpanded:we}:X;if(Ae.subtasks?.length){let Mt=A(Ae.subtasks);return {...Ae,subtasks:R(Mt)}}return Ae});if(ha.current.size>0)N($r(R(t)));else {let j=X=>X.map(we=>we.subtasks?.length?{...we,subtasks:A(j(we.subtasks))}:we);N($r(j(t)));}},[t,N]);let se=react.useRef(t),Ce=react.useRef(true);react.useEffect(()=>{if(Ce.current){Ce.current=false,se.current=Z;return}if(Ur.current){Ur.current=false,se.current=Z;return}if(!r)return;let A=JSON.stringify(se.current),R=JSON.stringify(Z);A!==R&&(se.current=Z,r(Z));},[Z,r]);let ve=react.useMemo(()=>kd(w,C),[w,C]),Re=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[tt,me]=react.useState(()=>Re(ve));react.useEffect(()=>{me(A=>A.map(R=>({...R,label:ve.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ve]);let Ke=react.useMemo(()=>tt.filter(R=>R.visible).reduce((R,j)=>R+j.width,0),[tt]),Ze=react.useRef(tt.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=tt.filter(X=>X.visible),R=A.map(X=>X.id).join(","),j=Ze.current;if(R!==j){let X=A.some(Ae=>Ae.id!=="name"),we=j.includes(",");X?!we&&X&&At(null):At(null),Ze.current=R;}},[tt]);let yt=60,oa=.6,jt=react.useMemo(()=>{let R=Ke+yt,j=typeof window<"u"?window.innerWidth*oa:800,X=Math.max(R,j);return Pt!==null?Math.max(200,Math.min(Pt,X)):Math.max(200,R)},[Pt,Ke]),Ut=react.useRef(null),na=react.useRef(null),_t=react.useRef(null),Ba=react.useRef(null),Nt=react.useMemo(()=>Vp(ze),[ze]),pr=react.useMemo(()=>({theme:Nt,themeName:ze}),[Nt,ze]),Co=react.useMemo(()=>Dm(g),[g]),Ar=react.useMemo(()=>{if(!y)return Z;let A=Se.calculateCriticalPathFull(Z),R=j=>j.map(X=>{let we=A.get(X.id),Ae=X.subtasks?R(X.subtasks):void 0,Mt=Ae?.some(Ma=>Ma.isCriticalPath||Ma.subtasks&&Ma.subtasks.some(Qt=>Qt.isCriticalPath))||false,dt=we?we.isCritical:Mt;return {...X,isCriticalPath:dt,cpmData:we||void 0,subtasks:Ae}});return R(Z)},[Z,y]),To=react.useMemo(()=>Se.flattenTasks(Z).some(R=>R.dependencies&&R.dependencies.length>0),[Z]),No=react.useMemo(()=>{if(it==="all"&&!pe)return Ar;let A=R=>{let j=[];for(let X of R){let we=X.subtasks?.length?A(X.subtasks):void 0,Ae=false;if(pe)Ae=X.progress<100;else switch(it){case "all":Ae=true;break;case "incomplete":Ae=X.progress<100;break;case "in_progress":Ae=X.progress>0&&X.progress<100;break;case "completed":Ae=X.progress===100;break}(Ae||we&&we.length>0)&&j.push({...X,subtasks:we});}return j};return A(Ar)},[Ar,it,pe]),Gs=Yv(V);Nm({undo:K,redo:Te,canUndo:Pe,canRedo:$t,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>Se.findTaskById(Z,A),addTask:(A,R)=>{N(j=>{if(!R)return [...j,{...A,level:0}];let X=we=>we.map(Ae=>Ae.id===R?{...Ae,subtasks:[...Ae.subtasks||[],{...A,parentId:R,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:X(Ae.subtasks)}:Ae);return X(j)});},updateTask:(A,R)=>{N(j=>{let X=we=>we.map(Ae=>Ae.id===A?{...Ae,...R}:Ae.subtasks?{...Ae,subtasks:X(Ae.subtasks)}:Ae);return X(j)});},deleteTask:A=>{N(R=>{let j=X=>X.filter(we=>we.id===A?false:(we.subtasks&&(we.subtasks=j(we.subtasks)),true));return j(R)});},deleteTasks:A=>{N(R=>Pd(R,A));},duplicateTask:A=>{if(a.onTaskDuplicate){let R=Se.findTaskById(Z,A);R&&a.onTaskDuplicate(R);}else N(R=>vs(R,[A]).tasks);},splitTask:(A,R,j=3)=>{N(X=>Se.splitTask(X,A,R,j));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(A,R)=>!Se.validateDependencies(Z,A,R),getAllTasks:()=>Se.flattenTasks(Z),getTasksByStatus:A=>Se.flattenTasks(Z).filter(R=>R.status===A),getTasksByParent:A=>A?Se.findTaskById(Z,A)?.subtasks||[]:Z.filter(j=>!j.parentId),getCriticalPath:()=>Se.flattenTasks(Z).filter(A=>A.isCriticalPath),indentTask:A=>{N(R=>$r(Ed(R,[A])));},outdentTask:A=>{N(R=>$r(Md(R,[A])));},moveTask:(A,R)=>{N(j=>Fd(j,[A],R));},createSubtask:async A=>{let{tasks:R,newTask:j}=Id(Z,A);if(Be){let X=Be({...j,parentId:A});if((X instanceof Promise?await X:X)===false)return}N($r(R)),He&&He({...j,parentId:A});},scrollToTask:A=>{let j=Se.flattenTasks(Z).findIndex(X=>X.id===A);if(j!==-1&&Ut.current){let X=j*Gs;Ut.current.scrollTo({top:X,behavior:"smooth"}),_t.current&&_t.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(A,R=2e3)=>{},expandTask:A=>{N(R=>{let j=X=>X.map(we=>we.id===A?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},collapseTask:A=>{N(R=>{let j=X=>X.map(we=>we.id===A?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},expandAll:()=>{N(A=>{let R=j=>j.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?R(X.subtasks):void 0}));return R(A)});},collapseAll:()=>{N(A=>{let R=j=>j.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?R(X.subtasks):void 0}));return R(A)});},collapseToLevel:A=>{F(A);},undo:K,redo:Te,canUndo:()=>Pe,canRedo:()=>$t,clearHistory:Ct,exportToPNG:async()=>{if(!Ba.current||!Ut.current||!_t.current)throw new Error("Gantt container not found");let A=Ba.current,R=Ut.current,j=na.current||R.querySelector(".gantt-grid-scroll"),X=_t.current,we=j?.scrollTop||0,Ae=X.scrollTop,Mt=A.style.overflow,dt=A.style.height,Ma=R.style.overflow;try{let Qt=j?.querySelector(".gantt-taskgrid-content"),ga=X.querySelector("svg"),ir=Qt?.scrollHeight||j?.scrollHeight||600,Dr=ga?.getBoundingClientRect().height||X.scrollHeight,Yo=(A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ir,Dr)+20;j&&(j.scrollTop=0),X.scrollTop=0,A.style.overflow="visible",A.style.height=`${Yo}px`,R.style.overflow="visible",await new Promise(vn=>setTimeout(vn,100));let ao=await htmlToImage.toPng(A,{backgroundColor:Nt.bgPrimary,pixelRatio:2,filter:vn=>{if(!(vn instanceof Element))return !0;let js=window.getComputedStyle(vn),es=parseInt(js.zIndex,10);return (isNaN(es)||es<50)&&js.position!=="fixed"}});return await(await fetch(ao)).blob()}finally{A.style.overflow=Mt,A.style.height=dt,R.style.overflow=Ma,j&&(j.scrollTop=we),X.scrollTop=Ae;}},exportToPDF:async A=>{await Se.exportToPDF(Z,A);},exportToExcel:async A=>{await Se.exportToExcel(Z,A,fl.current);},exportToJSON:()=>Se.exportToJSON(Z),exportToCSV:()=>Se.exportToCSV(Z),importFromJSON:A=>{let R=Se.importFromJSON(A);N(R);},getTasks:()=>Z,refresh:()=>{N(A=>[...A]);},clearAll:()=>{N([]);}}),[Z,K,Te,Pe,$t,Ct,Nt,Gs]);let lf=react.useCallback(A=>{me(R=>R.map(j=>j.id===A?{...j,visible:!j.visible}:j));},[]),df=react.useCallback((A,R)=>{me(j=>j.map(X=>{if(X.id!==A)return X;let we=X.minWidth??100,Ae=X.maxWidth??800,Mt=Math.max(we,Math.min(Ae,R));return {...X,width:Mt}}));},[]),cf=react.useCallback(A=>{N(R=>{let j=Ld(R,A),X=we=>{for(let Ae of we){if(Ae.id===A){ha.current.set(A,Ae.isExpanded??true);return}Ae.subtasks?.length&&X(Ae.subtasks);}};return X(j),lr(),j}),a.onTaskToggleExpand?.(A);},[a,lr]),Do=react.useCallback((A,R)=>{if(at&&at(A,R)===false)return;let X=Se.findTaskById(Z,A)?.progress,we=Mt=>Mt.map(dt=>dt.id===A?{...dt,...R}:dt.subtasks?{...dt,subtasks:we(dt.subtasks)}:dt);N(we(Z));let Ae=Se.findTaskById(we(Z),A);Ae&&(B?.(Ae),ue?.(Ae),R.progress!==void 0&&X!==void 0&&R.progress!==X&&be?.(A,X,R.progress));},[Z,B,at,ue,be]),uf=react.useCallback(A=>{A.length!==0&&(Pr.current+=1,Ur.current=true,N(R=>$r(Ed(R,A))),a.onTaskIndent?.(A[0]));},[a]),pf=react.useCallback(A=>{A.length!==0&&(Pr.current+=1,Ur.current=true,N(R=>$r(Md(R,A))),a.onTaskOutdent?.(A[0]));},[a]),mf=react.useCallback((A,R,j)=>{Pr.current+=1,Ur.current=true,N(X=>$r(um(X,A,R,j))),a.onTaskReparent?.(A,R,j);},[a]),gf=react.useCallback((A,R)=>{A.length!==0&&(Pr.current+=1,Ur.current=true,N(j=>Fd(j,A,R)),a.onTaskMove?.(A[0],R));},[a]),pl=react.useCallback(async A=>{let R=[];for(let j of A)je&&await Promise.resolve(je(j))===false||R.push(j);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(N(j=>$r(Pd(j,R))),R.forEach(j=>a.onTaskDelete?.(j))),Xe&&R.forEach(j=>Xe(j)));},[a,je,Xe]),ff=react.useCallback(A=>{a.onTaskDuplicate?A.forEach(R=>{let j=Se.findTaskById(Z,R);j&&a.onTaskDuplicate(j);}):N(R=>vs(R,A).tasks);},[a,Z]),bf=react.useCallback((A,R)=>{N(j=>{let{tasks:X,newTask:we}=cm(j,A,R);return Be&&Be(we)===false?j:(a.onTaskCreate?.(we.parentId,we.position||0),He?.(we),X)});},[a,Be,He]),hf=react.useCallback((A,R)=>{N(j=>Ad(j,A,R)),a.onTaskRename?.(A,R);},[a]),ml=react.useCallback(A=>{let{onTaskAddSubtask:R}=a;if(R){let j=On(Z,A);if(j){R(j);return}}N(j=>{let{tasks:X}=Id(j,A);return a.onTaskCreate?.(A,0),X});},[a,Z]),yf=react.useCallback((A,R)=>{let j=Math.max(0,Math.min(100,Math.round(R))),X={progress:j};j===100?X.status="completed":j>0?X.status="in-progress":X.status="todo",Do(A.id,X);},[Do]),xf=react.useCallback((A,R,j)=>{let X=!A.startDate&&!A.endDate,we=A.startDate?Math.round((R.getTime()-A.startDate.getTime())/(1e3*60*60*24)):0,Ae=Qt=>Qt.map(ga=>ga.id===A.id?{...ga,startDate:R,endDate:j,...A.segments&&{segments:A.segments}}:ga.subtasks?{...ga,subtasks:Ae(ga.subtasks)}:ga),Mt=Ae(Z),dt=Mt;Mt=Se.autoScheduleDependents(Mt,A.id,we),Mt=$r(Mt),N(Mt);let Ma={...A,startDate:R,endDate:j};if(X&&a?.onTaskDateChange?a.onTaskDateChange(A,R,j):B?.(Ma),q&&we!==0){let Qt=Se.flattenTasks(dt),ga=Se.flattenTasks(Mt),ir=[];for(let Dr of ga){if(Dr.id===A.id)continue;let So=Qt.find(ao=>ao.id===Dr.id);if(!So)continue;let xn=Dr.startDate?.getTime()!==So.startDate?.getTime(),Yo=Dr.endDate?.getTime()!==So.endDate?.getTime();(xn||Yo)&&ir.push(Dr);}ir.length>0&&q(ir);}},[Z,B,q,a]),vf=react.useCallback((A,R)=>{Le?.(A,R),la({isOpen:true,x:R.clientX,y:R.clientY,task:A});},[Le]),wf=react.useCallback((A,R)=>{let j=Se.splitTask(Z,A.id,R);N(j),la({isOpen:false,x:0,y:0,task:null});},[Z]),Xc=react.useCallback(A=>{let R=Se.findTaskById(Z,A.id)||A;te?.(R),_e||$e(R);},[Z,te,_e]),Jc=react.useCallback((A,R,j)=>{let X=new Map,we=Qt=>{Qt.forEach(ga=>{ga.dependencies&&X.set(ga.id,ga.dependencies),ga.subtasks&&we(ga.subtasks);});};we(j);let Ae=X.get(R)||[];X.set(R,[...Ae,A]);let Mt=new Set,dt=new Set,Ma=Qt=>{if(!Mt.has(Qt)){Mt.add(Qt),dt.add(Qt);let ga=X.get(Qt)||[];for(let ir of ga){if(!Mt.has(ir)&&Ma(ir))return true;if(dt.has(ir))return true}}return dt.delete(Qt),false};return Ma(R)},[]),Qc=react.useCallback((A,R)=>{if(Jc(A.id,R,Qn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:he,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${kt}`,boxShadow:xt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:nt,borderBottom:`1px solid ${ze}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ct,border:`1px solid ${et}`,color:"#2E94FF"},children:jsxRuntime.jsx(Cm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ee},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>m(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsxRuntime.jsx(Rv,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:V},onMouseEnter:I=>{I.currentTarget.style.background=U,I.currentTarget.style.color=D;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=V;},children:jsxRuntime.jsx(Bv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ae,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:be.slice(0,4).map((I,ye)=>jsxRuntime.jsx("button",{onClick:()=>$e(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ne,color:oe,border:`1px solid ${z}`},onMouseEnter:Z=>{Z.currentTarget.style.borderColor=Ge,Z.currentTarget.style.color="#2E94FF";},onMouseLeave:Z=>{Z.currentTarget.style.borderColor=z,Z.currentTarget.style.color=oe;},children:I.length>30?I.slice(0,30)+"...":I},ye))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?ge:Oe,color:I.role==="user"?"#2E94FF":lt,border:I.role==="user"?`1px solid ${Ve}`:`1px solid ${Ue}`},children:[I.isLoading?jsxRuntime.jsx(Ov,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:Y})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(P&&bt.length>0){I.preventDefault();return}Q(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ot}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&bt.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:G,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:mt,border:`1px solid ${Vt}`,boxShadow:ht,backdropFilter:"blur(12px)"},children:bt.map((I,ye)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Pt(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ye===M?it:"transparent",color:ne},onMouseEnter:()=>J(ye),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:O,border:`1px solid ${_}`,color:"#2E94FF"},children:I.name.split(" ").map(Z=>Z[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:pe},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${pt}`},children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:x,onChange:I=>Dt(I.target.value),onKeyDown:I=>{At(I);},placeholder:Le,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Tt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Ot:"transparent",color:x.trim()?"#2E94FF":Et,border:x.trim()?`1px solid ${St}`:"1px solid transparent"},children:jsxRuntime.jsx(Iv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Tm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Nm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Uv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.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=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Dm(e){return {...Uv,...e}}var Yv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Mm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:w="en",customTranslations:C,showCreateTaskButton:S=false,createTaskLabel:E,onCreateTask:k,taskFilter:v,onTaskFilterChange:P,toolbarRightContent:L,showBaseline:M,viewMode:J,onViewModeChange:H,projectForecast:Y,onThemeChange:T,onTaskClick:G,onTaskDblClick:te,onTaskContextMenu:Le,onTaskUpdate:B,onDependentTasksScheduled:q,onProgressChange:be,onTaskEdit:_e,onTaskAddSubtask:$,onTaskMarkIncomplete:ee,onTaskSetInProgress:le,onDependencyCreate:ke,onDependencyDelete:xe,onBeforeTaskAdd:Be,onAfterTaskAdd:He,onBeforeTaskUpdate:at,onAfterTaskUpdate:ue,onBeforeTaskDelete:je,onAfterTaskDelete:Xe,permissions:he,onCopySnapshotLink:kt}=a,nt=react.useContext(ki)?.theme,[ze,ct]=react.useState(nt||s||"dark"),[et,Ee]=react.useState(n),[V,D]=react.useState(l),[U,ae]=react.useState(1),[Ne,z]=react.useState("all"),[oe,Ge]=react.useState(J||"execution"),ge=J??oe,Ve=react.useCallback(A=>{Ge(A),H?.(A);},[H]),Oe=M??ge==="oracle",[Ue,lt]=react.useState(a.showCriticalPath!==false),[ot,st]=react.useState(a.showDependencies!==false),[pt,Tt]=react.useState(a.highlightWeekends!==false),Ot=react.useCallback(A=>{lt(A),a.onShowCriticalPathChange?.(A);},[a.onShowCriticalPathChange]),St=react.useCallback(A=>{st(A),a.onShowDependenciesChange?.(A);},[a.onShowDependenciesChange]),Et=react.useCallback(A=>{Tt(A),a.onHighlightWeekendsChange?.(A);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(et);},[et]),react.useEffect(()=>{a.onZoomChange?.(U);},[U]);let Ft=react.useRef(a.onDateRangeChange);Ft.current=a.onDateRangeChange;let mt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Vt,ht]=react.useState(()=>{if(!h)return "all";try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(j.taskFilter)return j.taskFilter}}catch(A){console.warn("[GanttBoard] Error loading filter state from localStorage:",A);}return "all"}),it=v??Vt,ne=P??ht,[pe,O]=react.useState(()=>{if(!h)return false;try{let A=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(A);if(R){let j=JSON.parse(R);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(A){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",A);}return false});react.useEffect(()=>{let A=mt();if(A)try{let R={taskFilter:it,hideCompleted:pe};localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[it,pe,mt]);let _=react.useRef(f);react.useEffect(()=>{if(_.current!==f&&f!==void 0){ht("all"),O(false);let A=mt();if(A)try{localStorage.removeItem(A);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}_.current=f;},[f,mt]);let[De,Qe]=react.useState(0),[bt,Dt]=react.useState(false),[Pt,At]=react.useState(null),[ta,la]=react.useState({isOpen:false,x:0,y:0,task:null}),[Q,$e]=react.useState(null),[Fe,I]=react.useState(null);react.useEffect(()=>{nt&&nt!==ze&&ct(nt);},[nt]),react.useEffect(()=>{s&&s!==ze&&ct(s);},[s]);let ye=react.useCallback(A=>{ct(A),T?.(A);},[T]),{state:Z,setState:N,undo:K,redo:Te,canUndo:Pe,canRedo:$t,clearHistory:Ct}=Tm(t,50),Jt=react.useMemo(()=>{let A=(R,j=0)=>{let X=j;for(let we of R)we.subtasks?.length&&(X=Math.max(X,A(we.subtasks,j+1)));return X};return A(Z)+1},[Z]),Wa=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ya=react.useRef(new Map),wa=react.useRef(false);if(!wa.current&&x){wa.current=true;let A=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(A);if(R){let j=JSON.parse(R);Array.isArray(j)&&(ya.current=new Map(j));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let dr=react.useCallback(()=>{let A=Wa();if(A)try{let R=Array.from(ya.current.entries());localStorage.setItem(A,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Wa]),Ar=react.useRef(0),Zn=react.useRef(Z);react.useEffect(()=>{Zn.current=Z;},[Z]);let Wr=react.useRef(false),F=react.useCallback(A=>{z(A),Ar.current+=1,N(R=>{let j=(we,Ae=0)=>we.map(Mt=>{let dt=A==="all"||Ae<A-1;return Mt.subtasks?.length&&ya.current.set(Mt.id,dt),{...Mt,isExpanded:dt,subtasks:Mt.subtasks?j(Mt.subtasks,Ae+1):void 0}}),X=j(R);return dr(),X});},[N,dr]);react.useEffect(()=>{if(Ar.current>0){Ar.current-=1;return}let A=j=>{let X=new Map;for(let we of j){let Ae=we.id;X.get(Ae)||X.set(Ae,we);}return Array.from(X.values())},R=j=>j.map(X=>{let we=ya.current.get(X.id),Ae=we!==void 0?{...X,isExpanded:we}:X;if(Ae.subtasks?.length){let Mt=A(Ae.subtasks);return {...Ae,subtasks:R(Mt)}}return Ae});if(ya.current.size>0)N(Hr(R(t)));else {let j=X=>X.map(we=>we.subtasks?.length?{...we,subtasks:A(j(we.subtasks))}:we);N(Hr(j(t)));}},[t,N]);let se=react.useRef(t),Ce=react.useRef(true);react.useEffect(()=>{if(Ce.current){Ce.current=false,se.current=Z;return}if(Wr.current){Wr.current=false,se.current=Z;return}if(!r)return;let A=JSON.stringify(se.current),R=JSON.stringify(Z);A!==R&&(se.current=Z,r(Z));},[Z,r]);let ve=react.useMemo(()=>kd(w,C),[w,C]),Re=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[tt,me]=react.useState(()=>Re(ve));react.useEffect(()=>{me(A=>A.map(R=>({...R,label:ve.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ve]);let Ke=react.useMemo(()=>tt.filter(R=>R.visible).reduce((R,j)=>R+j.width,0),[tt]),Ze=react.useRef(tt.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=tt.filter(X=>X.visible),R=A.map(X=>X.id).join(","),j=Ze.current;if(R!==j){let X=A.some(Ae=>Ae.id!=="name"),we=j.includes(",");X?!we&&X&&At(null):At(null),Ze.current=R;}},[tt]);let yt=60,oa=.6,jt=react.useMemo(()=>{let R=Ke+yt,j=typeof window<"u"?window.innerWidth*oa:800,X=Math.max(R,j);return Pt!==null?Math.max(200,Math.min(Pt,X)):Math.max(200,R)},[Pt,Ke]),Ut=react.useRef(null),na=react.useRef(null),_t=react.useRef(null),Ba=react.useRef(null),Nt=react.useMemo(()=>Vp(ze),[ze]),mr=react.useMemo(()=>({theme:Nt,themeName:ze}),[Nt,ze]),To=react.useMemo(()=>Dm(g),[g]),Lr=react.useMemo(()=>{if(!y)return Z;let A=Se.calculateCriticalPathFull(Z),R=j=>j.map(X=>{let we=A.get(X.id),Ae=X.subtasks?R(X.subtasks):void 0,Mt=Ae?.some(Ma=>Ma.isCriticalPath||Ma.subtasks&&Ma.subtasks.some(Qt=>Qt.isCriticalPath))||false,dt=we?we.isCritical:Mt;return {...X,isCriticalPath:dt,cpmData:we||void 0,subtasks:Ae}});return R(Z)},[Z,y]),No=react.useMemo(()=>Se.flattenTasks(Z).some(R=>R.dependencies&&R.dependencies.length>0),[Z]),Do=react.useMemo(()=>{if(it==="all"&&!pe)return Lr;let A=R=>{let j=[];for(let X of R){let we=X.subtasks?.length?A(X.subtasks):void 0,Ae=false;if(pe)Ae=X.progress<100;else switch(it){case "all":Ae=true;break;case "incomplete":Ae=X.progress<100;break;case "in_progress":Ae=X.progress>0&&X.progress<100;break;case "completed":Ae=X.progress===100;break}(Ae||we&&we.length>0)&&j.push({...X,subtasks:we});}return j};return A(Lr)},[Lr,it,pe]),Gs=Yv(V);Nm({undo:K,redo:Te,canUndo:Pe,canRedo:$t,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>Se.findTaskById(Z,A),addTask:(A,R)=>{N(j=>{if(!R)return [...j,{...A,level:0}];let X=we=>we.map(Ae=>Ae.id===R?{...Ae,subtasks:[...Ae.subtasks||[],{...A,parentId:R,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:X(Ae.subtasks)}:Ae);return X(j)});},updateTask:(A,R)=>{N(j=>{let X=we=>we.map(Ae=>Ae.id===A?{...Ae,...R}:Ae.subtasks?{...Ae,subtasks:X(Ae.subtasks)}:Ae);return X(j)});},deleteTask:A=>{N(R=>{let j=X=>X.filter(we=>we.id===A?false:(we.subtasks&&(we.subtasks=j(we.subtasks)),true));return j(R)});},deleteTasks:A=>{N(R=>Pd(R,A));},duplicateTask:A=>{if(a.onTaskDuplicate){let R=Se.findTaskById(Z,A);R&&a.onTaskDuplicate(R);}else N(R=>ws(R,[A]).tasks);},splitTask:(A,R,j=3)=>{N(X=>Se.splitTask(X,A,R,j));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(A,R)=>!Se.validateDependencies(Z,A,R),getAllTasks:()=>Se.flattenTasks(Z),getTasksByStatus:A=>Se.flattenTasks(Z).filter(R=>R.status===A),getTasksByParent:A=>A?Se.findTaskById(Z,A)?.subtasks||[]:Z.filter(j=>!j.parentId),getCriticalPath:()=>Se.flattenTasks(Z).filter(A=>A.isCriticalPath),indentTask:A=>{N(R=>Hr(Ed(R,[A])));},outdentTask:A=>{N(R=>Hr(Md(R,[A])));},moveTask:(A,R)=>{N(j=>Fd(j,[A],R));},createSubtask:async A=>{let{tasks:R,newTask:j}=Id(Z,A);if(Be){let X=Be({...j,parentId:A});if((X instanceof Promise?await X:X)===false)return}N(Hr(R)),He&&He({...j,parentId:A});},scrollToTask:A=>{let j=Se.flattenTasks(Z).findIndex(X=>X.id===A);if(j!==-1&&Ut.current){let X=j*Gs;Ut.current.scrollTo({top:X,behavior:"smooth"}),_t.current&&_t.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(A,R=2e3)=>{},expandTask:A=>{N(R=>{let j=X=>X.map(we=>we.id===A?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},collapseTask:A=>{N(R=>{let j=X=>X.map(we=>we.id===A?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:j(we.subtasks)}:we);return j(R)});},expandAll:()=>{N(A=>{let R=j=>j.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?R(X.subtasks):void 0}));return R(A)});},collapseAll:()=>{N(A=>{let R=j=>j.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?R(X.subtasks):void 0}));return R(A)});},collapseToLevel:A=>{F(A);},undo:K,redo:Te,canUndo:()=>Pe,canRedo:()=>$t,clearHistory:Ct,exportToPNG:async()=>{if(!Ba.current||!Ut.current||!_t.current)throw new Error("Gantt container not found");let A=Ba.current,R=Ut.current,j=na.current||R.querySelector(".gantt-grid-scroll"),X=_t.current,we=j?.scrollTop||0,Ae=X.scrollTop,Mt=A.style.overflow,dt=A.style.height,Ma=R.style.overflow;try{let Qt=j?.querySelector(".gantt-taskgrid-content"),fa=X.querySelector("svg"),lr=Qt?.scrollHeight||j?.scrollHeight||600,Sr=fa?.getBoundingClientRect().height||X.scrollHeight,Xo=(A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(lr,Sr)+20;j&&(j.scrollTop=0),X.scrollTop=0,A.style.overflow="visible",A.style.height=`${Xo}px`,R.style.overflow="visible",await new Promise(wn=>setTimeout(wn,100));let ro=await htmlToImage.toPng(A,{backgroundColor:Nt.bgPrimary,pixelRatio:2,filter:wn=>{if(!(wn instanceof Element))return !0;let js=window.getComputedStyle(wn),ts=parseInt(js.zIndex,10);return (isNaN(ts)||ts<50)&&js.position!=="fixed"}});return await(await fetch(ro)).blob()}finally{A.style.overflow=Mt,A.style.height=dt,R.style.overflow=Ma,j&&(j.scrollTop=we),X.scrollTop=Ae;}},exportToPDF:async A=>{await Se.exportToPDF(Z,A);},exportToExcel:async A=>{await Se.exportToExcel(Z,A,fl.current);},exportToJSON:()=>Se.exportToJSON(Z),exportToCSV:()=>Se.exportToCSV(Z),importFromJSON:A=>{let R=Se.importFromJSON(A);N(R);},getTasks:()=>Z,refresh:()=>{N(A=>[...A]);},clearAll:()=>{N([]);}}),[Z,K,Te,Pe,$t,Ct,Nt,Gs]);let lf=react.useCallback(A=>{me(R=>R.map(j=>j.id===A?{...j,visible:!j.visible}:j));},[]),df=react.useCallback((A,R)=>{me(j=>j.map(X=>{if(X.id!==A)return X;let we=X.minWidth??100,Ae=X.maxWidth??800,Mt=Math.max(we,Math.min(Ae,R));return {...X,width:Mt}}));},[]),cf=react.useCallback(A=>{N(R=>{let j=Ld(R,A),X=we=>{for(let Ae of we){if(Ae.id===A){ya.current.set(A,Ae.isExpanded??true);return}Ae.subtasks?.length&&X(Ae.subtasks);}};return X(j),dr(),j}),a.onTaskToggleExpand?.(A);},[a,dr]),So=react.useCallback((A,R)=>{if(at&&at(A,R)===false)return;let X=Se.findTaskById(Z,A)?.progress,we=Mt=>Mt.map(dt=>dt.id===A?{...dt,...R}:dt.subtasks?{...dt,subtasks:we(dt.subtasks)}:dt);N(we(Z));let Ae=Se.findTaskById(we(Z),A);Ae&&(B?.(Ae),ue?.(Ae),R.progress!==void 0&&X!==void 0&&R.progress!==X&&be?.(A,X,R.progress));},[Z,B,at,ue,be]),uf=react.useCallback(A=>{A.length!==0&&(Ar.current+=1,Wr.current=true,N(R=>Hr(Ed(R,A))),a.onTaskIndent?.(A[0]));},[a]),pf=react.useCallback(A=>{A.length!==0&&(Ar.current+=1,Wr.current=true,N(R=>Hr(Md(R,A))),a.onTaskOutdent?.(A[0]));},[a]),mf=react.useCallback((A,R,j)=>{Ar.current+=1,Wr.current=true,N(X=>Hr(um(X,A,R,j))),a.onTaskReparent?.(A,R,j);},[a]),gf=react.useCallback((A,R)=>{A.length!==0&&(Ar.current+=1,Wr.current=true,N(j=>Fd(j,A,R)),a.onTaskMove?.(A[0],R));},[a]),pl=react.useCallback(async A=>{let R=[];for(let j of A)je&&await Promise.resolve(je(j))===false||R.push(j);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(N(j=>Hr(Pd(j,R))),R.forEach(j=>a.onTaskDelete?.(j))),Xe&&R.forEach(j=>Xe(j)));},[a,je,Xe]),ff=react.useCallback(A=>{a.onTaskDuplicate?A.forEach(R=>{let j=Se.findTaskById(Z,R);j&&a.onTaskDuplicate(j);}):N(R=>ws(R,A).tasks);},[a,Z]),bf=react.useCallback((A,R)=>{N(j=>{let{tasks:X,newTask:we}=cm(j,A,R);return Be&&Be(we)===false?j:(a.onTaskCreate?.(we.parentId,we.position||0),He?.(we),X)});},[a,Be,He]),hf=react.useCallback((A,R)=>{N(j=>Ad(j,A,R)),a.onTaskRename?.(A,R);},[a]),ml=react.useCallback(A=>{let{onTaskAddSubtask:R}=a;if(R){let j=$n(Z,A);if(j){R(j);return}}N(j=>{let{tasks:X}=Id(j,A);return a.onTaskCreate?.(A,0),X});},[a,Z]),yf=react.useCallback((A,R)=>{let j=Math.max(0,Math.min(100,Math.round(R))),X={progress:j};j===100?X.status="completed":j>0?X.status="in-progress":X.status="todo",So(A.id,X);},[So]),xf=react.useCallback((A,R,j)=>{let X=!A.startDate&&!A.endDate,we=A.startDate?Math.round((R.getTime()-A.startDate.getTime())/(1e3*60*60*24)):0,Ae=Qt=>Qt.map(fa=>fa.id===A.id?{...fa,startDate:R,endDate:j,...A.segments&&{segments:A.segments}}:fa.subtasks?{...fa,subtasks:Ae(fa.subtasks)}:fa),Mt=Ae(Z),dt=Mt;Mt=Se.autoScheduleDependents(Mt,A.id,we),Mt=Hr(Mt),N(Mt);let Ma={...A,startDate:R,endDate:j};if(X&&a?.onTaskDateChange?a.onTaskDateChange(A,R,j):B?.(Ma),q&&we!==0){let Qt=Se.flattenTasks(dt),fa=Se.flattenTasks(Mt),lr=[];for(let Sr of fa){if(Sr.id===A.id)continue;let Eo=Qt.find(ro=>ro.id===Sr.id);if(!Eo)continue;let vn=Sr.startDate?.getTime()!==Eo.startDate?.getTime(),Xo=Sr.endDate?.getTime()!==Eo.endDate?.getTime();(vn||Xo)&&lr.push(Sr);}lr.length>0&&q(lr);}},[Z,B,q,a]),vf=react.useCallback((A,R)=>{Le?.(A,R),la({isOpen:true,x:R.clientX,y:R.clientY,task:A});},[Le]),wf=react.useCallback((A,R)=>{let j=Se.splitTask(Z,A.id,R);N(j),la({isOpen:false,x:0,y:0,task:null});},[Z]),Xc=react.useCallback(A=>{let R=Se.findTaskById(Z,A.id)||A;te?.(R),_e||$e(R);},[Z,te,_e]),Jc=react.useCallback((A,R,j)=>{let X=new Map,we=Qt=>{Qt.forEach(fa=>{fa.dependencies&&X.set(fa.id,fa.dependencies),fa.subtasks&&we(fa.subtasks);});};we(j);let Ae=X.get(R)||[];X.set(R,[...Ae,A]);let Mt=new Set,dt=new Set,Ma=Qt=>{if(!Mt.has(Qt)){Mt.add(Qt),dt.add(Qt);let fa=X.get(Qt)||[];for(let lr of fa){if(!Mt.has(lr)&&Ma(lr))return true;if(dt.has(lr))return true}}return dt.delete(Qt),false};return Ma(R)},[]),Qc=react.useCallback((A,R)=>{if(Jc(A.id,R,Zn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let j=X=>X.map(we=>{if(we.id===R){let Ae=we.dependencies||[];if(!Ae.includes(A.id))return {...we,dependencies:[...Ae,A.id]}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Pr.current+=1,N(X=>j(X)),ke?.(A.id,R);},[ke,Jc]),Zc=react.useCallback((A,R)=>{let j=X=>X.map(we=>{if(we.id===A&&we.dependencies){let Ae=we.dependencies.filter(Mt=>Mt!==R);return {...we,dependencies:Ae}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Pr.current+=1,N(X=>j(X)),xe?.(A,R);},[xe]),{startDate:hn,endDate:gl}=react.useMemo(()=>{let A=Z.filter(Ae=>Ae.startDate&&Ae.endDate);if(A.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let dt=new Date(Ae);return dt.setDate(dt.getDate()+60),{startDate:Mt,endDate:dt}}let R=A.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),j=new Date(Math.min(...R.map(Ae=>Ae.getTime()))),X=new Date(Math.max(...R.map(Ae=>Ae.getTime()))),we=et==="day"?7:et==="week"?14:30;return j.setDate(j.getDate()-we),X.setDate(X.getDate()+we),{startDate:j,endDate:X}},[Z,et]);react.useEffect(()=>{Ft.current?.(hn,gl);},[hn,gl]);let kf=react.useCallback(async()=>{if(!Ba.current||!Ut.current||!_t.current)return;await new Promise(Yo=>setTimeout(Yo,200));let A=Ba.current,R=Ut.current,j=na.current||R.querySelector(".gantt-grid-scroll"),X=_t.current,we=j?.scrollTop||0,Ae=j?.scrollLeft||0,Mt=X.scrollTop,dt=X.scrollLeft,Ma=A.style.overflow,Qt=A.style.height,ga=j?.style.overflow||"",ir=X.style.overflow,Dr=R.style.overflow,So=A.style.width,xn=X.style.width;try{let Yo=j?.querySelector(".gantt-taskgrid-content"),ao=X.querySelector("svg"),hl=ao?.getAttribute("height")?parseInt(ao.getAttribute("height"),10):ao?.getBoundingClientRect().height||0,vn=Yo?.scrollHeight||j?.scrollHeight||600,js=Math.max(hl,X.scrollHeight),es=ao?.getAttribute("width")?parseInt(ao.getAttribute("width"),10):ao?.getBoundingClientRect().width||X.scrollWidth,Ff=A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,yl=Math.max(vn,js,hl),au=Ff+yl+50,ru=(j?.offsetWidth||R.offsetWidth||300)+es+10;j&&(j.scrollTop=0,j.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,A.style.overflow="visible",A.style.height=`${au}px`,A.style.width=`${ru}px`,R.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${yl+50}px`),X.style.overflow="visible",X.style.height=`${yl+50}px`,X.style.width=`${es+10}px`,await new Promise(_s=>setTimeout(_s,150));let Pf=await htmlToImage.toPng(A,{backgroundColor:Nt.bgPrimary,pixelRatio:2,width:ru,height:au,skipFonts:!1,filter:_s=>{if(!(_s instanceof Element))return !0;let ou=window.getComputedStyle(_s),nu=parseInt(ou.zIndex,10);return !(!isNaN(nu)&&nu>=50||ou.position==="fixed")}}),xl=document.createElement("a");xl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,xl.href=Pf,xl.click();}finally{A.style.overflow=Ma,A.style.height=Qt,A.style.width=So,R.style.overflow=Dr,j&&(j.style.overflow=ga,j.style.height="",j.scrollTop=we,j.scrollLeft=Ae),X.style.overflow=ir,X.style.height="",X.style.width=xn,X.scrollTop=Mt,X.scrollLeft=dt;}p?.("png");},[Nt,p]),Cf=react.useCallback(async()=>{await Se.exportToPDF(Z),p?.("pdf");},[Z,p]),fl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});fl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Tf=react.useCallback(async()=>{let A=new Date,R=we=>String(we).padStart(2,"0"),j=`${A.getFullYear()}-${R(A.getMonth()+1)}-${R(A.getDate())}_${R(A.getHours())}${R(A.getMinutes())}`,X=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(Z,`${X}_${j}.xlsx`,fl.current),p?.("excel");},[Z,d,p]),Nf=react.useCallback(()=>{let A=Se.exportToCSV(Z),R=new Blob([A],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),p?.("csv");},[Z,p]),Df=react.useCallback(()=>{let A=Se.exportToJSON(Z),R=new Blob([A],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),p?.("json");},[Z,p]),Sf=react.useCallback(()=>{Se.exportToMSProject(Z,"Gantt Project","project.xml"),p?.("msproject");},[Z,p]),Ef=A=>{A.preventDefault(),Dt(true);},yn=react.useRef(false),[bl,eu]=react.useState(false),Zn=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let A=_t.current,R=Ut.current?.querySelector(".gantt-grid-scroll");if(!A||!R)return;let j=()=>{if(yn.current)return;yn.current=true;let dt=A.scrollTop;Qe(dt),R.scrollTop=dt,requestAnimationFrame(()=>{yn.current=false;});},X=()=>{if(yn.current)return;yn.current=true;let dt=R.scrollTop;Qe(dt),A.scrollTop=dt,requestAnimationFrame(()=>{yn.current=false;});},we=dt=>{if(bt&&R){let Qt=R.parentElement?.getBoundingClientRect()?.left||0,ga=dt.clientX-Qt,ir=200,Dr=Ke+yt,So=window.innerWidth*oa,xn=Math.max(Dr,So);ga>=ir&&ga<=xn&&At(ga);}if(bl&&A){let Ma=dt.clientX-Zn.current.x,Qt=dt.clientY-Zn.current.y;A.scrollLeft=Zn.current.scrollLeft-Ma,A.scrollTop=Zn.current.scrollTop-Qt;}},Ae=()=>{Dt(false),eu(false);},Mt=dt=>{if(dt.button!==0)return;let Ma=dt.target;Ma.closest("[data-task-bar]")||Ma.closest("[data-dependency-line]")||Ma.closest("button")||Ma.closest('[role="button"]')||Ma.tagName==="rect"&&Ma.getAttribute("data-clickable")==="true"||(eu(true),Zn.current={x:dt.clientX,y:dt.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},dt.preventDefault());};return A.addEventListener("scroll",j),R.addEventListener("scroll",X),A.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Ae),()=>{A.removeEventListener("scroll",j),R.removeEventListener("scroll",X),A.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Ae);}},[bt,bl,Ke]);let tu=react.useRef(false),Mf=react.useRef(null);return react.useLayoutEffect(()=>{if(tu.current||Z.length===0||!_t.current)return;tu.current=true,Mf.current=hn;let A=_t.current,R=new Date,j=et==="day"?60:et==="week"?20:8,X=(R.getTime()-hn.getTime())/(1e3*60*60*24),we=A.clientWidth,Mt=X*j*U-we/2;X>=0&&we>0&&(A.scrollLeft=Math.max(0,Mt));},[Z.length,hn,et,U]),jsxRuntime.jsx(Ln.Provider,{value:ve,children:jsxRuntime.jsx(Tl.Provider,{value:pr,children:jsxRuntime.jsxs("div",{ref:Ba,className:"flex flex-col h-full w-full",style:{backgroundColor:Nt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Nt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Nt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Ti,{theme:Nt,timeScale:et,onTimeScaleChange:Ee,zoom:U,onZoomChange:ae,currentTheme:ze,onThemeChange:ye,rowDensity:V,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:S&&he?.canCreateTask!==false&&!he?.canCreateSubtaskOnly,createTaskLabel:E,onCreateTask:k,taskFilter:it,onTaskFilterChange:ne,hideCompleted:pe,onHideCompletedChange:O,toolbarRightContent:L,wbsLevel:Ne,onWbsLevelChange:F,maxWbsDepth:Jt,viewMode:ge,onViewModeChange:Ve,projectForecast:Y,onExportPNG:i?kf:void 0,onExportPDF:i?Cf:void 0,onExportExcel:i?Tf:void 0,onExportCSV:i?Nf:void 0,onExportJSON:i?Df:void 0,onExportMSProject:i?Sf:void 0,showCriticalPath:Ue,onShowCriticalPathChange:Ot,showDependencies:ot,onShowDependenciesChange:St,highlightWeekends:pt,onHighlightWeekendsChange:Et,showBaseline:Oe,onShowBaselineChange:A=>{A&&ge!=="oracle"&&Ve("oracle"),!A&&ge==="oracle"&&Ve("execution");},onCopySnapshotLink:kt,hasDependencies:To})}),jsxRuntime.jsxs("div",{ref:Ut,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:na,className:"gantt-grid-scroll flex-shrink-0",style:{width:jt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Si,{tasks:No,theme:Nt,rowHeight:Gs,availableUsers:m,templates:Co,showCriticalPath:Ue,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:Le,onTaskToggle:cf,scrollTop:De,columns:tt,onToggleColumn:lf,onColumnResize:df,onTaskUpdate:Do,onTaskIndent:uf,onTaskOutdent:pf,onTaskMove:gf,onMultiTaskDelete:pl,onTaskDuplicate:ff,onTaskCreate:bf,onTaskRename:hf,onCreateSubtask:ml,onOpenTaskModal:G?A=>G(A):void 0,onDeleteRequest:(A,R)=>I({taskId:A,taskName:R}),onTaskReparent:mf,scrollContainerRef:na})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Nt.border,zIndex:15},onMouseDown:Ef}),jsxRuntime.jsx("div",{ref:_t,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:bl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Bi,{tasks:No,theme:Nt,rowHeight:Gs,timeScale:et,startDate:hn,endDate:gl,zoom:U,locale:w,templates:Co,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:vf,onTaskDateChange:xf,onTaskProgressDrag:yf,onDependencyCreate:Qc,onDependencyDelete:Zc,showBaseline:Oe,showCriticalPath:Ue,showDependencies:ot,highlightWeekends:pt,canEditTask:he?.canEditTask})})]}),ta.task&&jsxRuntime.jsx(Bn,{isOpen:ta.isOpen,x:ta.x,y:ta.y,theme:Nt,onClose:()=>la({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=ta.task;if(!A)return [];let R=Se.findTaskById(Z,A.id)||A,j=R.subtasks&&R.subtasks.length>0,X=he?.canCreateTask!==false,we=he?.canDeleteTask!==false;if(j){let Qt=[],ga=he?.canDuplicateTask!==false;return X&&Qt.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{$?$(R):ml(R.id);}}),ga&&Qt.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):N(ir=>vs(ir,[R.id]).tasks),la({isOpen:false,x:0,y:0,task:null});}}),we&&(Qt.length>0&&Qt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Qt.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),Qt}let Ae=he?.canUpdateTask!==false,Mt=he?.canDuplicateTask!==false,dt=[];return Ae&&dt.push({id:"edit",label:ve.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{_e?_e(R):$e(R);}}),X&&dt.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{$?$(R):ml(R.id);}}),dt.length>0&&Ae&&dt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(dt.push({id:"markIncomplete",label:ve.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(R):Do(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),dt.push({id:"setInProgress",label:ve.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{le?le(R):Do(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),dt.push({id:"markComplete",label:ve.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{Do(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Mt||Ae&&R.startDate&&R.endDate)&&dt.length>0&&dt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&dt.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):N(Qt=>vs(Qt,[R.id]).tasks),la({isOpen:false,x:0,y:0,task:null});}}),Ae&&R.startDate&&R.endDate&&dt.push({id:"split",label:ve.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let Qt=R.startDate.getTime(),ga=R.endDate.getTime(),ir=Qt+(ga-Qt)/2,Dr=new Date(ir);wf(R,Dr);}}),we&&(dt.length>0&&dt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),dt.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),dt})()}),jsxRuntime.jsx(bo,{task:Q,isOpen:!!Q,onClose:()=>$e(null),onTaskUpdate:A=>{Q&&(Do(Q.id,A),$e(null));},theme:ze==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Fe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>I(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Nt.bgSecondary,border:`1px solid ${Nt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Nt.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:Nt.textPrimary,fontFamily:"Inter, sans-serif"},children:[ve.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Nt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="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:Nt.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Nt.textPrimary},children:['"',Fe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Nt.bgPrimary,borderTop:`1px solid ${Nt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Nt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=Nt.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{pl([Fe.taskId]),I(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx($i,{tasks:Z,theme:Nt,config:b,onTasksUpdate:N,onTaskUpdate:Do,onTaskCreate:A=>{N(R=>[...R,A]);},onTaskDelete:A=>{pl([A]);},onDependencyCreate:(A,R)=>{let j=Se.findTaskById(Z,A);j&&Qc(j,R);},onDependencyDelete:Zc})]})})})});function s2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function i2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Od=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],$d=[{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 Am({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Od,...i.filter(D=>!Od.some(U=>U.id===D.id))],f=gt[c]||gt.dark,[b,w]=react.useState(false),[C,S]=react.useState(false),[E,k]=react.useState(false),[v,P]=react.useState(false),[L,M]=react.useState({top:0,left:0}),[J,H]=react.useState(null),[Y,T]=react.useState(new Date),[G,te]=react.useState({top:0,left:0}),[Le,B]=react.useState(false),[q,be]=react.useState([]),[_e,$]=react.useState(false),[ee,le]=react.useState(""),ke=react.useRef(null),xe=react.useRef(null),Be=react.useRef(null),He=react.useRef(null),at=react.useRef(null),[ue,je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,he]=react.useState({});react.useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(je({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),be([]));},[a,e,x]),react.useEffect(()=>{let D=U=>{ke.current&&!ke.current.contains(U.target)&&w(false),xe.current&&!xe.current.contains(U.target)&&S(false),Be.current&&!Be.current.contains(U.target)&&k(false),He.current&&!He.current.contains(U.target)&&P(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let kt=()=>{let D={};return ue.name.trim()||(D.name="El nombre es requerido"),ue.startDate&&ue.endDate&&ue.startDate>ue.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),he(D),Object.keys(D).length===0},xt=async D=>{if(D.preventDefault(),!!kt())try{let U=l==="create"&&q.length>0?{...ue,pendingFiles:q}:ue;await s(U),be([]),t();}catch(U){console.error("Error submitting task:",U);}},nt=(D,U)=>{je(ae=>{let Ne={...ae,[D]:U};if(D==="status"){let z=U;z==="todo"?Ne.progress=0:z==="in-progress"?(ae.progress===0||ae.progress===100)&&(Ne.progress=50):z==="completed"||z==="closed"?Ne.progress=100:(z==="in-review"||z==="review")&&(Ne.progress=75);}if(D==="progress"){let z=typeof U=="number"?U:parseInt(U,10);z===100&&ae.status!=="completed"?Ne.status="completed":z>0&&z<100&&ae.status==="todo"?Ne.status="in-progress":z===0&&ae.status!=="todo"&&(Ne.status="todo");}return Ne}),Xe[D]&&he(ae=>{let Ne={...ae};return delete Ne[D],Ne});},ze=h.find(D=>D.id===ue.status)??Od[0],ct=$d.find(D=>D.id===ue.priority)??$d[1],et=tn.find(D=>D.value===ue.color)??tn[0],Ee=c==="dark",V={backgroundColor:Ee?"#1d1f27":f.bgSecondary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ee?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,boxShadow:Ee?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:xt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:ue.name,onChange:D=>nt("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Xe.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Xe.name]}),jsxRuntime.jsx("textarea",{value:ue.description||"",onChange:D=>nt("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsxRuntime.jsx("span",{style:{color:ze.color},children:ze.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("status",D.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ue.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:xe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{children:ct.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:$d.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("priority",D.id),S(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ue.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[ue.assignees&&ue.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ue.assignees.slice(0,3).map((D,U)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},U))}),ue.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ue.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let U=ue.assignees?.some(ae=>ae.name===D.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ae=U?(ue.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ue.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:f.accent}];nt("assignees",ae);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)P(false);else {if(He.current){let D=He.current.getBoundingClientRect(),U=window.innerHeight,ae=120,z=U-D.bottom<ae?D.top-ae-8:D.bottom+8;M({top:z,left:D.left});}P(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ue.color}}),jsxRuntime.jsx("span",{children:et.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>P(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:tn.slice(0,18).map(D=>{let U=ue.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),nt("color",D.value),P(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:U?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(Po,{selectedTags:ue.tags||[],availableTags:p,onChange:D=>nt("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ee?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="start")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("start"),T(ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.startDate?ue.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="end")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("end"),T(ue.endDate||ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.endDate?ue.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${G.top}px`,left:`${G.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ee?"#262626":f.border}`},children:[(()=>{let D=new Date,U=new Date(D);U.setDate(D.getDate()+1);let ae=new Date(D);ae.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:ae},{label:"2 semanas",date:Ne}].map((oe,Ge)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{J==="start"?(nt("startDate",oe.date),(!ue.endDate||oe.date>ue.endDate)&&nt("endDate",oe.date),H("end")):(nt("endDate",oe.date),(!ue.startDate||oe.date<ue.startDate)&&nt("startDate",oe.date),H(null));},children:oe.label},Ge))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("startDate",void 0),nt("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,U)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},U))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=Y.getFullYear(),U=Y.getMonth(),ae=new Date(D,U,1).getDay(),Ne=new Date(D,U+1,0).getDate(),z=new Date,oe=[];for(let ge=ae-1;ge>=0;ge--)oe.push({day:new Date(D,U,-ge).getDate(),date:new Date(D,U-1,new Date(D,U,-ge).getDate()),isCurrentMonth:false});for(let ge=1;ge<=Ne;ge++)oe.push({day:ge,date:new Date(D,U,ge),isCurrentMonth:true});let Ge=42-oe.length;for(let ge=1;ge<=Ge;ge++)oe.push({day:ge,date:new Date(D,U+1,ge),isCurrentMonth:false});return oe.map((ge,Ve)=>{let Oe=ge.date.toDateString()===z.toDateString(),Ue=ue.startDate?.toDateString()===ge.date.toDateString(),lt=ue.endDate?.toDateString()===ge.date.toDateString(),ot=ue.startDate&&ue.endDate&&ge.date>=ue.startDate&&ge.date<=ue.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:ge.isCurrentMonth?Ue||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ue?f.accent:lt?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Oe&&!Ue&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{J==="start"?(nt("startDate",ge.date),ue.endDate&&ge.date>ue.endDate&&nt("endDate",ge.date),H("end")):(nt("endDate",ge.date),ue.startDate&&ge.date<ue.startDate&&nt("startDate",ge.date),H(null));},children:ge.day},Ve)})})()})]})]})]})})]}),Xe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Xe.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ue.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ee?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let U=D.currentTarget.getBoundingClientRect(),ae=Math.round((D.clientX-U.left)/U.width*100/5)*5;nt("progress",Math.max(0,Math.min(100,ae)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Le),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Le?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ue.effortMinutes?s2(ue.effortMinutes):"",onChange:D=>{let U=i2(D.target.value);nt("effortMinutes",U);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ue.parentId||"",onChange:D=>nt("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ue.location||"",onChange:D=>nt("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ue.equipment||"",onChange:D=>nt("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?q.length>0&&`(${q.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(io,{cardId:"pending",attachments:q.map((D,U)=>({id:`pending-${U}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>be(U=>[...U,...D]),onDelete:D=>{let U=parseInt(D.replace("pending-",""),10);be(ae=>ae.filter((Ne,z)=>z!==U));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(io,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&q.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[q.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ue.isMilestone,onChange:D=>nt("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ue.dependencies&&ue.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ue.dependencies.map(D=>{let U=r.find(ae=>ae.id===D);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[U?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ae=(ue.dependencies||[]).filter(Ne=>Ne!==D);nt("dependencies",ae);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},D)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{$(!_e),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),le("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:ee,onChange:D=>le(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let U=ue.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ae=ue.dependencies||[],Ne;U?Ne=ae.filter(z=>z!==D.id):Ne=[...ae,D.id],nt("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:U?`${f.accent}10`:"transparent"},onMouseEnter:ae=>{U||(ae.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ae=>{ae.currentTarget.style.backgroundColor=U?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:U?f.accent:"transparent",borderColor:U?f.accent:f.borderLight},children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:Ee?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Lm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let j=X=>X.map(we=>{if(we.id===R){let Ae=we.dependencies||[];if(!Ae.includes(A.id))return {...we,dependencies:[...Ae,A.id]}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Ar.current+=1,N(X=>j(X)),ke?.(A.id,R);},[ke,Jc]),Zc=react.useCallback((A,R)=>{let j=X=>X.map(we=>{if(we.id===A&&we.dependencies){let Ae=we.dependencies.filter(Mt=>Mt!==R);return {...we,dependencies:Ae}}return we.subtasks?{...we,subtasks:j(we.subtasks)}:we});Ar.current+=1,N(X=>j(X)),xe?.(A,R);},[xe]),{startDate:yn,endDate:gl}=react.useMemo(()=>{let A=Z.filter(Ae=>Ae.startDate&&Ae.endDate);if(A.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let dt=new Date(Ae);return dt.setDate(dt.getDate()+60),{startDate:Mt,endDate:dt}}let R=A.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),j=new Date(Math.min(...R.map(Ae=>Ae.getTime()))),X=new Date(Math.max(...R.map(Ae=>Ae.getTime()))),we=et==="day"?7:et==="week"?14:30;return j.setDate(j.getDate()-we),X.setDate(X.getDate()+we),{startDate:j,endDate:X}},[Z,et]);react.useEffect(()=>{Ft.current?.(yn,gl);},[yn,gl]);let kf=react.useCallback(async()=>{if(!Ba.current||!Ut.current||!_t.current)return;await new Promise(Xo=>setTimeout(Xo,200));let A=Ba.current,R=Ut.current,j=na.current||R.querySelector(".gantt-grid-scroll"),X=_t.current,we=j?.scrollTop||0,Ae=j?.scrollLeft||0,Mt=X.scrollTop,dt=X.scrollLeft,Ma=A.style.overflow,Qt=A.style.height,fa=j?.style.overflow||"",lr=X.style.overflow,Sr=R.style.overflow,Eo=A.style.width,vn=X.style.width;try{let Xo=j?.querySelector(".gantt-taskgrid-content"),ro=X.querySelector("svg"),hl=ro?.getAttribute("height")?parseInt(ro.getAttribute("height"),10):ro?.getBoundingClientRect().height||0,wn=Xo?.scrollHeight||j?.scrollHeight||600,js=Math.max(hl,X.scrollHeight),ts=ro?.getAttribute("width")?parseInt(ro.getAttribute("width"),10):ro?.getBoundingClientRect().width||X.scrollWidth,Ff=A.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,yl=Math.max(wn,js,hl),au=Ff+yl+50,ru=(j?.offsetWidth||R.offsetWidth||300)+ts+10;j&&(j.scrollTop=0,j.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,A.style.overflow="visible",A.style.height=`${au}px`,A.style.width=`${ru}px`,R.style.overflow="visible",j&&(j.style.overflow="visible",j.style.height=`${yl+50}px`),X.style.overflow="visible",X.style.height=`${yl+50}px`,X.style.width=`${ts+10}px`,await new Promise(_s=>setTimeout(_s,150));let Pf=await htmlToImage.toPng(A,{backgroundColor:Nt.bgPrimary,pixelRatio:2,width:ru,height:au,skipFonts:!1,filter:_s=>{if(!(_s instanceof Element))return !0;let ou=window.getComputedStyle(_s),nu=parseInt(ou.zIndex,10);return !(!isNaN(nu)&&nu>=50||ou.position==="fixed")}}),xl=document.createElement("a");xl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,xl.href=Pf,xl.click();}finally{A.style.overflow=Ma,A.style.height=Qt,A.style.width=Eo,R.style.overflow=Sr,j&&(j.style.overflow=fa,j.style.height="",j.scrollTop=we,j.scrollLeft=Ae),X.style.overflow=lr,X.style.height="",X.style.width=vn,X.scrollTop=Mt,X.scrollLeft=dt;}p?.("png");},[Nt,p]),Cf=react.useCallback(async()=>{await Se.exportToPDF(Z),p?.("pdf");},[Z,p]),fl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});fl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Tf=react.useCallback(async()=>{let A=new Date,R=we=>String(we).padStart(2,"0"),j=`${A.getFullYear()}-${R(A.getMonth()+1)}-${R(A.getDate())}_${R(A.getHours())}${R(A.getMinutes())}`,X=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(Z,`${X}_${j}.xlsx`,fl.current),p?.("excel");},[Z,d,p]),Nf=react.useCallback(()=>{let A=Se.exportToCSV(Z),R=new Blob([A],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href),p?.("csv");},[Z,p]),Df=react.useCallback(()=>{let A=Se.exportToJSON(Z),R=new Blob([A],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href),p?.("json");},[Z,p]),Sf=react.useCallback(()=>{Se.exportToMSProject(Z,"Gantt Project","project.xml"),p?.("msproject");},[Z,p]),Ef=A=>{A.preventDefault(),Dt(true);},xn=react.useRef(false),[bl,eu]=react.useState(false),es=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let A=_t.current,R=Ut.current?.querySelector(".gantt-grid-scroll");if(!A||!R)return;let j=()=>{if(xn.current)return;xn.current=true;let dt=A.scrollTop;Qe(dt),R.scrollTop=dt,requestAnimationFrame(()=>{xn.current=false;});},X=()=>{if(xn.current)return;xn.current=true;let dt=R.scrollTop;Qe(dt),A.scrollTop=dt,requestAnimationFrame(()=>{xn.current=false;});},we=dt=>{if(bt&&R){let Qt=R.parentElement?.getBoundingClientRect()?.left||0,fa=dt.clientX-Qt,lr=200,Sr=Ke+yt,Eo=window.innerWidth*oa,vn=Math.max(Sr,Eo);fa>=lr&&fa<=vn&&At(fa);}if(bl&&A){let Ma=dt.clientX-es.current.x,Qt=dt.clientY-es.current.y;A.scrollLeft=es.current.scrollLeft-Ma,A.scrollTop=es.current.scrollTop-Qt;}},Ae=()=>{Dt(false),eu(false);},Mt=dt=>{if(dt.button!==0)return;let Ma=dt.target;Ma.closest("[data-task-bar]")||Ma.closest("[data-dependency-line]")||Ma.closest("button")||Ma.closest('[role="button"]')||Ma.tagName==="rect"&&Ma.getAttribute("data-clickable")==="true"||(eu(true),es.current={x:dt.clientX,y:dt.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},dt.preventDefault());};return A.addEventListener("scroll",j),R.addEventListener("scroll",X),A.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Ae),()=>{A.removeEventListener("scroll",j),R.removeEventListener("scroll",X),A.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Ae);}},[bt,bl,Ke]);let tu=react.useRef(false),Mf=react.useRef(null);return react.useLayoutEffect(()=>{if(tu.current||Z.length===0||!_t.current)return;tu.current=true,Mf.current=yn;let A=_t.current,R=new Date,j=et==="day"?60:et==="week"?20:8,X=(R.getTime()-yn.getTime())/(1e3*60*60*24),we=A.clientWidth,Mt=X*j*U-we/2;X>=0&&we>0&&(A.scrollLeft=Math.max(0,Mt));},[Z.length,yn,et,U]),jsxRuntime.jsx(In.Provider,{value:ve,children:jsxRuntime.jsx(Tl.Provider,{value:mr,children:jsxRuntime.jsxs("div",{ref:Ba,className:"flex flex-col h-full w-full",style:{backgroundColor:Nt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Nt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Nt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Ti,{theme:Nt,timeScale:et,onTimeScaleChange:Ee,zoom:U,onZoomChange:ae,currentTheme:ze,onThemeChange:ye,rowDensity:V,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:S&&he?.canCreateTask!==false&&!he?.canCreateSubtaskOnly,createTaskLabel:E,onCreateTask:k,taskFilter:it,onTaskFilterChange:ne,hideCompleted:pe,onHideCompletedChange:O,toolbarRightContent:L,wbsLevel:Ne,onWbsLevelChange:F,maxWbsDepth:Jt,viewMode:ge,onViewModeChange:Ve,projectForecast:Y,onExportPNG:i?kf:void 0,onExportPDF:i?Cf:void 0,onExportExcel:i?Tf:void 0,onExportCSV:i?Nf:void 0,onExportJSON:i?Df:void 0,onExportMSProject:i?Sf:void 0,showCriticalPath:Ue,onShowCriticalPathChange:Ot,showDependencies:ot,onShowDependenciesChange:St,highlightWeekends:pt,onHighlightWeekendsChange:Et,showBaseline:Oe,onShowBaselineChange:A=>{A&&ge!=="oracle"&&Ve("oracle"),!A&&ge==="oracle"&&Ve("execution");},onCopySnapshotLink:kt,hasDependencies:No})}),jsxRuntime.jsxs("div",{ref:Ut,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:na,className:"gantt-grid-scroll flex-shrink-0",style:{width:jt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Si,{tasks:Do,theme:Nt,rowHeight:Gs,availableUsers:m,templates:To,showCriticalPath:Ue,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:Le,onTaskToggle:cf,scrollTop:De,columns:tt,onToggleColumn:lf,onColumnResize:df,onTaskUpdate:So,onTaskIndent:uf,onTaskOutdent:pf,onTaskMove:gf,onMultiTaskDelete:pl,onTaskDuplicate:ff,onTaskCreate:bf,onTaskRename:hf,onCreateSubtask:ml,onOpenTaskModal:G?A=>G(A):void 0,onDeleteRequest:(A,R)=>I({taskId:A,taskName:R}),onTaskReparent:mf,scrollContainerRef:na})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Nt.border,zIndex:15},onMouseDown:Ef}),jsxRuntime.jsx("div",{ref:_t,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:bl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Bi,{tasks:Do,theme:Nt,rowHeight:Gs,timeScale:et,startDate:yn,endDate:gl,zoom:U,locale:w,templates:To,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:G,onTaskDblClick:Xc,onTaskContextMenu:vf,onTaskDateChange:xf,onTaskProgressDrag:yf,onDependencyCreate:Qc,onDependencyDelete:Zc,showBaseline:Oe,showCriticalPath:Ue,showDependencies:ot,highlightWeekends:pt,canEditTask:he?.canEditTask})})]}),ta.task&&jsxRuntime.jsx(Rn,{isOpen:ta.isOpen,x:ta.x,y:ta.y,theme:Nt,onClose:()=>la({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=ta.task;if(!A)return [];let R=Se.findTaskById(Z,A.id)||A,j=R.subtasks&&R.subtasks.length>0,X=he?.canCreateTask!==false,we=he?.canDeleteTask!==false;if(j){let Qt=[],fa=he?.canDuplicateTask!==false;return X&&Qt.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{$?$(R):ml(R.id);}}),fa&&Qt.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):N(lr=>ws(lr,[R.id]).tasks),la({isOpen:false,x:0,y:0,task:null});}}),we&&(Qt.length>0&&Qt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Qt.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),Qt}let Ae=he?.canUpdateTask!==false,Mt=he?.canDuplicateTask!==false,dt=[];return Ae&&dt.push({id:"edit",label:ve.contextMenu?.editTask||"Edit Task",icon:ma.Pencil,onClick:()=>{_e?_e(R):$e(R);}}),X&&dt.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ma.Add,onClick:()=>{$?$(R):ml(R.id);}}),dt.length>0&&Ae&&dt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(dt.push({id:"markIncomplete",label:ve.contextMenu?.markIncomplete||"Mark Incomplete",icon:ma.MarkIncomplete,onClick:()=>{ee?ee(R):So(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),dt.push({id:"setInProgress",label:ve.contextMenu?.setInProgress||"Set In Progress",icon:ma.SetInProgress,onClick:()=>{le?le(R):So(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),dt.push({id:"markComplete",label:ve.contextMenu?.markComplete||"Mark Complete",icon:ma.MarkComplete,onClick:()=>{So(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Mt||Ae&&R.startDate&&R.endDate)&&dt.length>0&&dt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&dt.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ma.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):N(Qt=>ws(Qt,[R.id]).tasks),la({isOpen:false,x:0,y:0,task:null});}}),Ae&&R.startDate&&R.endDate&&dt.push({id:"split",label:ve.contextMenu?.splitTask||"Split Task",icon:ma.Split,onClick:()=>{let Qt=R.startDate.getTime(),fa=R.endDate.getTime(),lr=Qt+(fa-Qt)/2,Sr=new Date(lr);wf(R,Sr);}}),we&&(dt.length>0&&dt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),dt.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ma.Delete,onClick:()=>{I({taskId:R.id,taskName:R.name});}})),dt})()}),jsxRuntime.jsx(ho,{task:Q,isOpen:!!Q,onClose:()=>$e(null),onTaskUpdate:A=>{Q&&(So(Q.id,A),$e(null));},theme:ze==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Fe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>I(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Nt.bgSecondary,border:`1px solid ${Nt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Nt.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:Nt.textPrimary,fontFamily:"Inter, sans-serif"},children:[ve.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Nt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="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:Nt.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Nt.textPrimary},children:['"',Fe.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Nt.bgPrimary,borderTop:`1px solid ${Nt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>I(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Nt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=Nt.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{pl([Fe.taskId]),I(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx($i,{tasks:Z,theme:Nt,config:b,onTasksUpdate:N,onTaskUpdate:So,onTaskCreate:A=>{N(R=>[...R,A]);},onTaskDelete:A=>{pl([A]);},onDependencyCreate:(A,R)=>{let j=Se.findTaskById(Z,A);j&&Qc(j,R);},onDependencyDelete:Zc})]})})})});function s2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function i2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Od=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],$d=[{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 Am({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Od,...i.filter(D=>!Od.some(U=>U.id===D.id))],f=gt[c]||gt.dark,[b,w]=react.useState(false),[C,S]=react.useState(false),[E,k]=react.useState(false),[v,P]=react.useState(false),[L,M]=react.useState({top:0,left:0}),[J,H]=react.useState(null),[Y,T]=react.useState(new Date),[G,te]=react.useState({top:0,left:0}),[Le,B]=react.useState(false),[q,be]=react.useState([]),[_e,$]=react.useState(false),[ee,le]=react.useState(""),ke=react.useRef(null),xe=react.useRef(null),Be=react.useRef(null),He=react.useRef(null),at=react.useRef(null),[ue,je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,he]=react.useState({});react.useEffect(()=>{a?(je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(je({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),be([]));},[a,e,x]),react.useEffect(()=>{let D=U=>{ke.current&&!ke.current.contains(U.target)&&w(false),xe.current&&!xe.current.contains(U.target)&&S(false),Be.current&&!Be.current.contains(U.target)&&k(false),He.current&&!He.current.contains(U.target)&&P(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let kt=()=>{let D={};return ue.name.trim()||(D.name="El nombre es requerido"),ue.startDate&&ue.endDate&&ue.startDate>ue.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),he(D),Object.keys(D).length===0},xt=async D=>{if(D.preventDefault(),!!kt())try{let U=l==="create"&&q.length>0?{...ue,pendingFiles:q}:ue;await s(U),be([]),t();}catch(U){console.error("Error submitting task:",U);}},nt=(D,U)=>{je(ae=>{let Ne={...ae,[D]:U};if(D==="status"){let z=U;z==="todo"?Ne.progress=0:z==="in-progress"?(ae.progress===0||ae.progress===100)&&(Ne.progress=50):z==="completed"||z==="closed"?Ne.progress=100:(z==="in-review"||z==="review")&&(Ne.progress=75);}if(D==="progress"){let z=typeof U=="number"?U:parseInt(U,10);z===100&&ae.status!=="completed"?Ne.status="completed":z>0&&z<100&&ae.status==="todo"?Ne.status="in-progress":z===0&&ae.status!=="todo"&&(Ne.status="todo");}return Ne}),Xe[D]&&he(ae=>{let Ne={...ae};return delete Ne[D],Ne});},ze=h.find(D=>D.id===ue.status)??Od[0],ct=$d.find(D=>D.id===ue.priority)??$d[1],et=an.find(D=>D.value===ue.color)??an[0],Ee=c==="dark",V={backgroundColor:Ee?"#1d1f27":f.bgSecondary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ee?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,boxShadow:Ee?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:xt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:ue.name,onChange:D=>nt("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Xe.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Xe.name]}),jsxRuntime.jsx("textarea",{value:ue.description||"",onChange:D=>nt("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsxRuntime.jsx("span",{style:{color:ze.color},children:ze.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("status",D.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ue.status===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxRuntime.jsxs("div",{ref:xe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{children:ct.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:$d.map(D=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("priority",D.id),S(false);},children:[jsxRuntime.jsx("span",{children:D.icon}),D.label,ue.priority===D.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Be,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[ue.assignees&&ue.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ue.assignees.slice(0,3).map((D,U)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},U))}),ue.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ue.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let U=ue.assignees?.some(ae=>ae.name===D.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ae=U?(ue.assignees||[]).filter(Ne=>Ne.name!==D.name):[...ue.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Ne=>Ne[0]).join("").toUpperCase().slice(0,2),color:f.accent}];nt("assignees",ae);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)P(false);else {if(He.current){let D=He.current.getBoundingClientRect(),U=window.innerHeight,ae=120,z=U-D.bottom<ae?D.top-ae-8:D.bottom+8;M({top:z,left:D.left});}P(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ue.color}}),jsxRuntime.jsx("span",{children:et.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>P(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:an.slice(0,18).map(D=>{let U=ue.color===D.value;return jsxRuntime.jsx("button",{type:"button",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),nt("color",D.value),P(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:U?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsxRuntime.jsx(Ao,{selectedTags:ue.tags||[],availableTags:p,onChange:D=>nt("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ee?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="start")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("start"),T(ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.startDate?ue.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ue.isMilestone)if(J==="end")H(null);else {if(at.current){let D=at.current.getBoundingClientRect();te({top:D.bottom+8,left:Math.max(16,D.left-40)});}H("end"),T(ue.endDate||ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:n||ue.isMilestone,children:ue.endDate?ue.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${G.top}px`,left:`${G.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":f.bgPrimary,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ee?"#262626":f.border}`},children:[(()=>{let D=new Date,U=new Date(D);U.setDate(D.getDate()+1);let ae=new Date(D);ae.setDate(D.getDate()+7);let Ne=new Date(D);return Ne.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:ae},{label:"2 semanas",date:Ne}].map((oe,Ge)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{J==="start"?(nt("startDate",oe.date),(!ue.endDate||oe.date>ue.endDate)&&nt("endDate",oe.date),H("end")):(nt("endDate",oe.date),(!ue.startDate||oe.date<ue.startDate)&&nt("startDate",oe.date),H(null));},children:oe.label},Ge))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{nt("startDate",void 0),nt("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>T(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,U)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},U))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=Y.getFullYear(),U=Y.getMonth(),ae=new Date(D,U,1).getDay(),Ne=new Date(D,U+1,0).getDate(),z=new Date,oe=[];for(let ge=ae-1;ge>=0;ge--)oe.push({day:new Date(D,U,-ge).getDate(),date:new Date(D,U-1,new Date(D,U,-ge).getDate()),isCurrentMonth:false});for(let ge=1;ge<=Ne;ge++)oe.push({day:ge,date:new Date(D,U,ge),isCurrentMonth:true});let Ge=42-oe.length;for(let ge=1;ge<=Ge;ge++)oe.push({day:ge,date:new Date(D,U+1,ge),isCurrentMonth:false});return oe.map((ge,Ve)=>{let Oe=ge.date.toDateString()===z.toDateString(),Ue=ue.startDate?.toDateString()===ge.date.toDateString(),lt=ue.endDate?.toDateString()===ge.date.toDateString(),ot=ue.startDate&&ue.endDate&&ge.date>=ue.startDate&&ge.date<=ue.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:ge.isCurrentMonth?Ue||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ue?f.accent:lt?"#7C3AED":ot?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Oe&&!Ue&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{J==="start"?(nt("startDate",ge.date),ue.endDate&&ge.date>ue.endDate&&nt("endDate",ge.date),H("end")):(nt("endDate",ge.date),ue.startDate&&ge.date<ue.startDate&&nt("startDate",ge.date),H(null));},children:ge.day},Ve)})})()})]})]})]})})]}),Xe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Xe.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ue.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ee?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let U=D.currentTarget.getBoundingClientRect(),ae=Math.round((D.clientX-U.left)/U.width*100/5)*5;nt("progress",Math.max(0,Math.min(100,ae)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Le),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Le?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Le&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ue.effortMinutes?s2(ue.effortMinutes):"",onChange:D=>{let U=i2(D.target.value);nt("effortMinutes",U);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ue.parentId||"",onChange:D=>nt("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ue.location||"",onChange:D=>nt("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ue.equipment||"",onChange:D=>nt("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?q.length>0&&`(${q.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsxRuntime.jsx(lo,{cardId:"pending",attachments:q.map((D,U)=>({id:`pending-${U}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>be(U=>[...U,...D]),onDelete:D=>{let U=parseInt(D.replace("pending-",""),10);be(ae=>ae.filter((Ne,z)=>z!==U));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(lo,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&q.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[q.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ue.isMilestone,onChange:D=>nt("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ue.dependencies&&ue.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ue.dependencies.map(D=>{let U=r.find(ae=>ae.id===D);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[U?.name||D.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ae=(ue.dependencies||[]).filter(Ne=>Ne!==D);nt("dependencies",ae);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},D)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{$(!_e),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),le("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ee?"#0a0a0a":f.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":f.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:ee,onChange:D=>le(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>ee===""||D.name.toLowerCase().includes(ee.toLowerCase())).map(D=>{let U=ue.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ae=ue.dependencies||[],Ne;U?Ne=ae.filter(z=>z!==D.id):Ne=[...ae,D.id],nt("dependencies",Ne);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:U?`${f.accent}10`:"transparent"},onMouseEnter:ae=>{U||(ae.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ae=>{ae.currentTarget.style.backgroundColor=U?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:U?f.accent:"transparent",borderColor:U?f.accent:f.borderLight},children:U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:Ee?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Lm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -410,7 +410,27 @@ If ambiguous, ask for clarification in the message field.`;function Im(e){return
|
|
|
410
410
|
${Bm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function wo(e,t){let a=Bm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Hd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function zd(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 Ud(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 Rm(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 Om(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),d=wo(t,i),m=Hd(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:y},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=wo(t,i),m=zd(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),d=wo(t,i),m=Ud(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=wo(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),p=l[2].trim(),d=wo(t,i),m=wo(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),p=wo(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function $m(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 l2(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 d2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ui(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ui(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:l2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Hm(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:d2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function zm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ui(r,e,t))}var Wd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Wi={en:Wd,es:Vd};function Gd(e){return Wi[e]||Wi.en}function Vi(e,t){let a=Gd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var jd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function Um(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function Wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Um(e),i=jd[0],p=jd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(Um(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:jd.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var _d=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Gm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=_d.find(p=>p.value===e)??_d[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:_d.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function Ds(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Kd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function qd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{p.current&&!p.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:Ds(x.name),color:x.color||Kd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ds(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ds(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ds(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Ds(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Xm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,p]=react.useState(false),[d,m]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&p(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),P=new Date(k,v,1),M=new Date(k,v+1,0).getDate(),J=P.getDay(),H=[],T=new Date(k,v,0).getDate();for(let te=J-1;te>=0;te--)H.push({date:new Date(k,v-1,T-te),isCurrentMonth:false});for(let te=1;te<=M;te++)H.push({date:new Date(k,v,te),isCurrentMonth:true});let G=42-H.length;for(let te=1;te<=G;te++)H.push({date:new Date(k,v+1,te),isCurrentMonth:false});return H},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),p(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),m("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),p(false);}},S=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let P=new Date(k);P.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let L=new Date(k);L.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let M=new Date(k);M.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let J=new Date(k);J.setDate(k.getDate()+14);let H=new Date(k);return H.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:P,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:L,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let E=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),p(!i);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(E)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((k,v)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let P=k.date.toDateString()===new Date().toDateString(),L=h?.toDateString()===k.date.toDateString(),M=f?.toDateString()===k.date.toDateString(),J=L||M,H=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),P&&"ring-2 ring-[#007BFF]",L&&"bg-[#007BFF] text-white",M&&!L&&"bg-[#7C3AED] text-white",H&&!J&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!J&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function _i({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Xm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Gn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ki(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(m));},y*x);p.current.push(h);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Jm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Zm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=Gn(),{displayValue:g,isAnimating:y}=Ki(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let S=C.currentTarget.getBoundingClientRect(),E=C.clientX-S.left,k=Math.round(E/S.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&m());},h=react.useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{l(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let S=Math.max(0,Math.min(100,C));S!==e&&(t(S),s&&m());}},[c,t,e,s,m]),b=react.useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&l(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[w>0?jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",w===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function ag({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function ng({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=Gn(),{displayValue:h,isAnimating:f}=Ki(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let S=C;o!==void 0&&(S=Math.max(o,S)),s!==void 0&&(S=Math.min(s,S)),S!==e&&(t?.(S),c&&x());}p(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:C=>m(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function sg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function lg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:p}=Jm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function ug({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function K2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function q2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Nr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:p}){let[d,m]=react.useState(false),[g,y]=react.useState(""),x=react.useRef(null),{isFlashing:h,triggerFlash:f}=Gn(),b=c==="financial"&&(i>0||p!=null),w=p??(e?e/60*i:0),C=b&&(p!=null?p>0:e)?`$${Math.round(w).toLocaleString("en-US")}`:K2(e,r);react.useEffect(()=>{d&&x.current&&(x.current.focus(),x.current.select());},[d]),react.useEffect(()=>{if(e){let v=Math.floor(e/60),P=e%60;v>0&&P>0?y(`${v}h ${P}m`):v>0?y(`${v}h`):y(`${P}m`);}else y("");},[e,d]);let S=()=>{let v=q2(g);v!==e&&(t?.(v),n&&f()),m(false);},E=v=>{v.key==="Enter"?S():v.key==="Escape"&&m(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=b?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(k,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:C})]}):d?jsxRuntime.jsx("input",{ref:x,type:"text",value:g,onChange:v=>y(v.target.value),onBlur:S,onKeyDown:E,onClick:v=>v.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:v=>{v.stopPropagation(),m(true);},className:u("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:C})]})}function fg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function hg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",p=l==="financial"&&c>0,d=te=>p?`$${Math.round(te*c).toLocaleString("en-US")}`:`${te}h`,[m,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,S=e.soldEffortMinutes||0,E=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,P=v>100?Math.round((w-C)/60*10)/10:0,L=v>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let te=Le=>{b.current&&!b.current.contains(Le.target)&&(x(false),f(null));};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[y,h]);let M=te=>{if(te.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Le=>!Le),f(null);return}n&&n(e);},J=te=>{x(false),f(te);},H=async(te,Le)=>{h==="log"&&r&&te?r(e,te,Le):h==="estimate"&&o?o(e,te):h==="quoted"&&s&&s(e,te),f(null);},Y=r||o||s||n,T=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(te=>te.show),G=h==="estimate"?C:h==="quoted"?S:void 0;return C===0&&w===0&&S===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&Y&&jsxRuntime.jsx("button",{onClick:M,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:T.map(te=>jsxRuntime.jsxs("button",{onClick:Le=>{Le.stopPropagation(),J(te.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Le=>{Le.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Le=>{Le.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(oo,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:H,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let te=w===0,B=(C>0?w/C:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:te?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(E)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),P>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(P)," ",i?"Excedido":"Over"]})]})})(),C>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(v,100)}%`,backgroundColor:L,borderRadius:2,transition:"width 0.3s"}})})]}),Y&&jsxRuntime.jsx("button",{onClick:M,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:T.map(te=>jsxRuntime.jsxs("button",{onClick:Le=>{Le.stopPropagation(),J(te.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Le=>{Le.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Le=>{Le.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(oo,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:H,onClose:()=>f(null)})})})})]})}function t1(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function a1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function yg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function xg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=t1(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(yg,{assignee:g,size:24,isDark:t},g.name+y))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?a1(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(yg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var r1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function wg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",r1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function y1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function x1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Sg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?Tg.es:Tg.en;if(react.useEffect(()=>{let k=P=>{f.current&&!f.current.contains(P.target)&&t();},v=P=>{P.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),l&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let P=e.task.assignees||[],M=P.some(J=>J.name===v.name)?P.filter(J=>J.name!==v.name):[...P,{name:v.name,initials:y1(v.name),color:v.color||x1(v.name),avatar:v.avatarUrl}];l({...e.task,assignees:M}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},S=e.type==="task"?w():C(),E={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:E,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:S.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(v1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function v1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Tg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Bg={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},O1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Og({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[p,d]=react.useState(null),[m,g]=react.useState(null),y=react.useRef(null),x=l==="es"?Rg.es:Rg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let J=v.getBoundingClientRect();g({top:J.bottom+4,right:window.innerWidth-J.right});}let P=y.current.getBoundingClientRect(),M=window.innerHeight-P.top-20;d(Math.max(300,M));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=L=>{y.current&&!y.current.contains(L.target)&&t();},P=L=>{L.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",P),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",P);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...O1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let P=a.find(L=>L.type===k);return P?.label?P.label:k},b=k=>{if(k==="name")return;let v=a.map(P=>P.id===k?{...P,visible:!P.visible}:P);o(v);},w=(k,v)=>{let P=a.find(M=>M.type===k&&(!v||M.customFieldId===v));if(P){b(P.id);return}let L={id:v||k,type:k,label:v?r.find(M=>M.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,L]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),S=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),E=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>i(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",E);},onFocus:k=>{k.currentTarget.style.borderColor=E,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(M=>M.type===k&&!M.customFieldId),P=v?.visible??false,L=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{L||(v?b(v.id):w(k));},disabled:L,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:L?.4:1,cursor:L?"not-allowed":"pointer"},onMouseEnter:M=>{L||(M.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:P?E:"transparent",border:P?`1.5px solid ${E}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${E}40`:"none"},children:P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:P?E:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:P?500:400,color:P?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),S.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:S.map(k=>{let P=a.find(L=>L.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:L=>{L.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:P?E:"transparent",border:P?`1.5px solid ${E}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${E}40`:"none"},children:P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:P?E:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:P?500:400,color:P?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Rg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var _1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function zg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?Hg.es:Hg.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let m=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{p([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,p(b);},x=h=>{i.length>1&&p(i.filter((f,b)=>b!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:_1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Hg={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Vg={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Gg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),p=s==="es"?Vg.es:Vg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function jg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Ps(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function _g({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxRuntime.jsxs("div",{className:u("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:n?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,p=e.totalExecuted??0,d=c-p,m=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(p/c*100),120):0,y=p>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ps(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ps(i)})]}),p>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ps(p)})]}),c>0&&jsxRuntime.jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:x}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[d>=0?`+${Ps(d)} ${n?"Disp.":"Avail."}`:`${Ps(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,p=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":p>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:jg(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:jg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${p}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:u("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:u("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxRuntime.jsxs("button",{onClick:()=>s?.(c.id),className:u("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsxRuntime.jsx("span",{className:u("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,p=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!i&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let p=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:p}})})]},`${c.name}-${i}`)})})]})]})}var lw=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function Zg(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(...Zg(r.subtasks,t+1));return a}function dw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function Yn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Yn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function qn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function cw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Jg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function uc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function e0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:S=false,financialBlur:E,healthSidebar:k,lens:v="hours",hourlyRate:P=0,rateMap:L,aggregateParentHours:M=false,showProjectTotals:J=false,totalsDollarOverride:H}=t,Y=Vi(d,m),T=p==="dark",G=F=>{if(!L||!F.assignees||F.assignees.length===0)return P;let se=0,Ce=0;for(let Re of F.assignees){let tt=Re.id?L[Re.id]:void 0;if(tt==null||tt<=0)continue;let me=typeof Re.estimatedMinutes=="number"?Re.estimatedMinutes:0;me>0&&(se+=tt*me,Ce+=me);}if(Ce>0)return se/Ce;let ve=F.assignees.map(Re=>Re.id?L[Re.id]:void 0).filter(Re=>Re!=null&&Re>0);return ve.length===0?P:ve.reduce((Re,tt)=>Re+tt,0)/ve.length},te=F=>{let se=0,Ce=0,ve=0,Re=tt=>{for(let me of tt)if(me.subtasks&&me.subtasks.length>0){let Ke={s:se,a:Ce,q:ve};if(Re(me.subtasks),se-Ke.s+(Ce-Ke.a)+(ve-Ke.q)===0){let yt=G(me);se+=(me.timeLoggedMinutes??0)/60*yt,Ce+=(me.effortMinutes??0)/60*yt,ve+=(me.soldEffortMinutes??0)/60*yt;}}else {let Ke=G(me);se+=(me.timeLoggedMinutes??0)/60*Ke,Ce+=(me.effortMinutes??0)/60*Ke,ve+=(me.soldEffortMinutes??0)/60*Ke;}};return F.subtasks&&Re(F.subtasks),{dollarSpent:se,dollarAllocated:Ce,dollarQuoted:ve}},Le=react.useCallback(()=>{if(!S||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let F=localStorage.getItem(S);if(F){let se=JSON.parse(F);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(F){console.error("Error loading persisted filter:",F);}return {statusFilter:"all",hideCompleted:false}},[S]),B=react.useMemo(()=>{function F(se){let Ce=0,ve=0,Re=0,tt=0,me=0,Ke=0;for(let Ze of se)if(Ze.subtasks&&Ze.subtasks.length>0){let yt=F(Ze.subtasks);if(yt.spent+yt.allocated+yt.quoted>0)Ce+=yt.spent,ve+=yt.allocated,Re+=yt.quoted,tt+=yt.dollarSpent,me+=yt.dollarAllocated,Ke+=yt.dollarQuoted;else {let jt=Ze.timeLoggedMinutes??0,Ut=Ze.effortMinutes??0,na=Ze.soldEffortMinutes??0;Ce+=jt,ve+=Ut,Re+=na;let _t=G(Ze);tt+=jt/60*_t,me+=Ut/60*_t,Ke+=na/60*_t;}}else {let yt=Ze.timeLoggedMinutes??0,oa=Ze.effortMinutes??0,jt=Ze.soldEffortMinutes??0;Ce+=yt,ve+=oa,Re+=jt;let Ut=G(Ze);tt+=yt/60*Ut,me+=oa/60*Ut,Ke+=jt/60*Ut;}return {spent:Ce,allocated:ve,quoted:Re,dollarSpent:tt,dollarAllocated:me,dollarQuoted:Ke}}return F(e)},[e]),q=react.useMemo(()=>{let F=new Map;function se(Ce){let ve=0;for(let Re of Ce)if(Re.subtasks&&Re.subtasks.length>0){let tt=se(Re.subtasks);F.set(Re.id,tt),ve+=tt;}else ve+=Re.weight||0;return ve}return se(e),F},[e]),be=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:B.spent,totalHoursAllocatedMinutes:B.allocated}},[k,B]),[_e,$]=react.useState(true),[ee,le]=react.useState(null),[ke,xe]=react.useState("position"),[Be,He]=react.useState("asc"),[at,ue]=react.useState(""),[je,Xe]=react.useState(()=>Le().statusFilter),[he,kt]=react.useState(()=>Le().hideCompleted),[xt,nt]=react.useState(x||lw),[ze,ct]=react.useState(false),[et,Ee]=react.useState(false),[V,D]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[U,ae]=react.useState(null),[Ne,z]=react.useState(false),[oe,Ge]=react.useState(null),[ge,Ve]=react.useState(null),[Oe,Ue]=react.useState(null),lt=react.useRef(0),ot=react.useRef(false),st=!!(a.onTaskMove||a.onTaskReparent),pt=react.useCallback((F,se)=>{st&&(se.preventDefault(),lt.current=se.clientY,ae(F),ot.current=false,z(false),Ue({x:se.clientX,y:se.clientY}));},[st]),Tt=react.useCallback(F=>{if(!U||(Math.abs(F.clientY-lt.current)>5&&!ot.current&&(ot.current=true,z(true)),Ue({x:F.clientX,y:F.clientY}),!ot.current))return;let Ce=document.querySelectorAll("[data-listview-row]"),ve=null,Re=null;Ce.forEach(tt=>{let me=tt.getBoundingClientRect(),Ke=tt.getAttribute("data-listview-row");if(Ke&&Ke!==U&&F.clientY>=me.top&&F.clientY<=me.bottom){ve=Ke;let Ze=F.clientY-me.top,yt=me.height;Re=Ze<yt*.25?"above":Ze>yt*.75?"below":"child";}}),Ge(ve),Ve(Re);},[U]),Ot=react.useCallback(()=>{if(ot.current&&U&&oe&&ge){if(ge==="child"&&a.onTaskReparent)a.onTaskReparent(U,oe);else if(ge==="above"||ge==="below"){let F=(ve,Re,tt=null)=>{for(let me of ve){if(me.id===Re)return tt;if(me.subtasks){let Ke=F(me.subtasks,Re,me.id);if(Ke!==void 0)return Ke}}},se=F(e,U,null),Ce=F(e,oe,null);if(a.onTaskReparent){let ve=(yt,oa)=>{if(oa===null)return yt;for(let jt of yt){if(jt.id===oa)return jt.subtasks||[];if(jt.subtasks){let Ut=ve(jt.subtasks,oa);if(Ut.length>0||jt.subtasks.some(na=>na.id===oa))return Ut}}return []},Re=ve(e,Ce??null),tt=Re.findIndex(yt=>yt.id===oe),me=se===Ce,Ke=me?Re.findIndex(yt=>yt.id===U):-1,Ze=ge==="below"?tt+1:tt;me&&Ke!==-1&&Ke<tt&&(Ze-=1),a.onTaskReparent(U,Ce??null,Math.max(0,Ze));}}}ae(null),Ge(null),Ve(null),Ue(null),ot.current=false,z(false);},[U,oe,ge,e,a]);react.useEffect(()=>{if(U)return document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",Ot),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",Ot),document.body.style.cursor="",document.body.style.userSelect="";}},[U,Tt,Ot]);let[St,Et]=react.useState("all"),[Ft,mt]=react.useState(false),Vt=react.useRef(null),ht=react.useRef(null),it=react.useMemo(()=>{let F=0;function se(Ce,ve){for(let Re of Ce)ve>F&&(F=ve),Re.subtasks?.length&&se(Re.subtasks,ve+1);}return se(e,1),F},[e]);react.useEffect(()=>{if(!Ft)return;let F=se=>{Vt.current?.contains(se.target)||ht.current?.contains(se.target)||mt(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[Ft]),react.useEffect(()=>{if(St==="all"){let Ce=function(ve){for(let Re of ve)Re.subtasks?.length&&(Re.isExpanded===false&&a.onTaskToggleExpand?.(Re.id),Ce(Re.subtasks));};Ce(e);}else {let Ce=function(ve,Re){for(let tt of ve)if(tt.subtasks?.length){let me=Re<St,Ke=tt.isExpanded!==false;me!==Ke&&a.onTaskToggleExpand?.(tt.id),Ce(tt.subtasks,Re+1);}};Ce(e,1);}},[St]);let[ne,pe]=react.useState(null),[O,_]=react.useState(0),[De,Qe]=react.useState(0),bt=react.useRef(null),[Dt,Pt]=react.useState(null),[At,ta]=react.useState(null);react.useEffect(()=>{x&&nt(F=>{if(F.length===x.length){let se=true;for(let Ce=0;Ce<F.length;Ce++){let ve=F[Ce],Re=x[Ce];if(!ve||!Re||ve.id!==Re.id||ve.visible!==Re.visible||ve.width!==Re.width||ve.label!==Re.label){se=false;break}}if(se)return F}return x});},[x]),react.useEffect(()=>{if(!(!S||typeof window>"u"))try{localStorage.setItem(S,JSON.stringify({statusFilter:je,hideCompleted:he}));}catch(F){console.error("Error persisting filter state:",F);}},[S,je,he]);let la=react.useMemo(()=>{let F=new Set;function se(Ce){for(let ve of Ce)ve.subtasks?.length&&(ve.isExpanded!==false&&F.add(ve.id),se(ve.subtasks));}return se(e),F},[e]),Q=react.useMemo(()=>xt.filter(F=>F.visible),[xt]),$e=react.useCallback(F=>{a.onTaskToggleExpand?.(F);},[a]),Fe=react.useCallback(F=>{ke===F?He(se=>se==="asc"?"desc":"asc"):(xe(F),He("asc")),a.onSortChange?.({column:F,direction:Be==="asc"?"desc":"asc"});},[ke,Be,a]),I=react.useCallback(F=>{nt(F),a.onColumnsChange?.(F);},[a]),ye=react.useCallback(F=>{let se=xt.map(Ce=>Ce.id===F?{...Ce,visible:false}:Ce);I(se);},[xt,I]),Z=react.useCallback((F,se)=>{xe(F),He(se);},[]),N=react.useCallback((F,se,Ce)=>{b&&(F.preventDefault(),D({isOpen:true,x:F.clientX,y:F.clientY,type:se?"task":"header",task:se,columnId:Ce}));},[b]),K=react.useCallback(()=>{D(F=>({...F,isOpen:false}));},[]),Te=react.useCallback((F,se)=>{if(!f)return;F.preventDefault(),F.stopPropagation();let Ce=xt.find(ve=>ve.id===se);Ce&&(pe(se),_(F.clientX),Qe(Ce.width));},[xt,f]);react.useEffect(()=>{if(!ne)return;let F=xt,se=ve=>{let Re=ve.clientX-O,tt=Math.max(50,De+Re);F=F.map(me=>me.id===ne?{...me,width:tt}:me),nt(F);},Ce=()=>{a.onColumnsChange?.(F),pe(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",Ce);}},[ne,O,De,a]);let Pe=react.useCallback((F,se)=>{if(se==="name"){F.preventDefault();return}Pt(se),F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",se),F.currentTarget instanceof HTMLElement&&(F.currentTarget.style.opacity="0.5");},[]),$t=react.useCallback(F=>{F.currentTarget instanceof HTMLElement&&(F.currentTarget.style.opacity="1"),Pt(null),ta(null);},[]),Ct=react.useCallback((F,se)=>{F.preventDefault(),se!=="name"&&(F.dataTransfer.dropEffect="move",ta(se));},[]),Jt=react.useCallback(()=>{ta(null);},[]),Wa=react.useCallback((F,se)=>{if(F.preventDefault(),!Dt||Dt===se||se==="name")return;let Ce=[...xt],ve=Ce.findIndex(me=>me.id===Dt),Re=Ce.findIndex(me=>me.id===se);if(ve===-1||Re===-1)return;let tt=Ce.splice(ve,1);tt[0]&&(Ce.splice(Re,0,tt[0]),I(Ce),Pt(null),ta(null));},[Dt,xt,I]),ha=react.useCallback(async F=>{if(a.onCreateCustomField){let se={...F,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}Ee(false);},[a]),wa=react.useCallback(F=>F.progress===100||F.status==="completed"?"completed":F.progress&&F.progress>0||F.status==="in-progress"?"in-progress":"todo",[]),lr=react.useMemo(()=>{let F=Zg(e);if(at.trim()){let se=at.toLowerCase();F=F.filter(Ce=>Ce.name.toLowerCase().includes(se));}return je!=="all"&&(F=F.filter(se=>wa(se)===je)),he&&(F=F.filter(se=>wa(se)!=="completed")),F.sort((se,Ce)=>{let ve,Re;switch(ke){case "name":ve=se.name.toLowerCase(),Re=Ce.name.toLowerCase();break;case "startDate":ve=se.startDate?.getTime()||0,Re=Ce.startDate?.getTime()||0;break;case "endDate":ve=se.endDate?.getTime()||0,Re=Ce.endDate?.getTime()||0;break;case "progress":ve=se.progress||0,Re=Ce.progress||0;break;case "status":ve=se.status||"todo",Re=Ce.status||"todo";break;case "priority":let tt={urgent:0,high:1,medium:2,low:3,none:4};ve=tt[se.priority]??4,Re=tt[Ce.priority]??4;break;case "position":return 0;default:return 0}return ve<Re?Be==="asc"?-1:1:ve>Re?Be==="asc"?1:-1:0}),F},[e,at,je,he,ke,Be,wa]),Pr=react.useCallback((F,se)=>{let Ce=tt=>{a.onTaskUpdate?.({...F,...tt});},ve=tt=>tt?F.customFields?.find(Ke=>Ke.fieldId===tt)?.value:void 0,Re=(tt,me)=>{if(!tt)return;let Ze=[...F.customFields||[]],yt=Ze.findIndex(oa=>oa.fieldId===tt);yt>=0?Ze[yt]={fieldId:tt,value:me}:Ze.push({fieldId:tt,value:me}),Ce({customFields:Ze});};switch(se.type){case "name":return null;case "status":return jsxRuntime.jsx(Wm,{value:F.status||(F.progress===100?"completed":F.progress&&F.progress>0?"in-progress":"todo"),onChange:me=>{Ce({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:T,locale:d,translations:Y.status});case "priority":return jsxRuntime.jsx(Gm,{value:F.priority,onChange:me=>Ce({priority:me}),isDark:T,locale:d});case "assignees":{let me=F.hasChildren,Ke=F.assignees||[];if(me&&F.subtasks?.length){let Ze=new Map,yt=oa=>{(oa||[]).forEach(jt=>{(jt.assignees||[]).forEach(Ut=>{Ze.has(Ut.name)||Ze.set(Ut.name,Ut);}),jt.subtasks?.length&&yt(jt.subtasks);});};yt(F.subtasks),Ke=Array.from(Ze.values());}else me&&(Ke=[]);return jsxRuntime.jsx(qd,{value:Ke,availableUsers:l,onChange:Ze=>Ce({assignees:Ze}),isDark:T,locale:d,disabled:me})}case "startDate":return jsxRuntime.jsx(_i,{value:F.startDate,onChange:me=>Ce({startDate:me}),isDark:T,locale:d,dateField:"start",startDate:F.startDate,endDate:F.endDate});case "endDate":return jsxRuntime.jsx(_i,{value:F.endDate,onChange:me=>Ce({endDate:me}),isDark:T,locale:d,dateField:"end",startDate:F.startDate,endDate:F.endDate});case "progress":{let me=!!(F.subtasks&&F.subtasks.length>0),Ke=me?Jg(uc(F.subtasks||[])):F.progress||0;return jsxRuntime.jsx(Zm,{value:Ke,onChange:me?void 0:Ze=>{let yt=Ze===100?"completed":Ze>0?"in-progress":"todo";Ce({progress:Ze,status:yt});},isDark:T,disabled:me})}case "tags":return jsxRuntime.jsx(ug,{value:F.tags||[],isDark:T});case "text":return jsxRuntime.jsx(ag,{value:ve(se.customFieldId)||"",onChange:me=>Re(se.customFieldId,me),isDark:T});case "number":return jsxRuntime.jsx(ng,{value:ve(se.customFieldId)||0,onChange:me=>Re(se.customFieldId,me),isDark:T});case "date":let tt=ve(se.customFieldId);return jsxRuntime.jsx(_i,{value:tt?new Date(tt):void 0,onChange:me=>Re(se.customFieldId,me),isDark:T,locale:d});case "dropdown":return jsxRuntime.jsx(sg,{value:ve(se.customFieldId)||"",options:se.options||[],onChange:me=>Re(se.customFieldId,me),isDark:T});case "checkbox":return jsxRuntime.jsx(lg,{value:ve(se.customFieldId)||false,onChange:me=>Re(se.customFieldId,me),isDark:T});case "estimatedTime":{let me=F.status==="completed"||F.progress===100;return jsxRuntime.jsx(Nr,{value:F.estimatedTime,onChange:Ke=>Ce({estimatedTime:Ke}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)})}case "quotedTime":{let me=F.status==="completed"||F.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("quotedTime"));return jsxRuntime.jsx(Nr,{value:F.quotedTime,onChange:Ze=>Ce({quotedTime:Ze}),isDark:T,locale:d,disabled:me,isBlurred:Ke,lens:v,hourlyRate:G(F)})}case "elapsedTime":{let me=F.status==="completed"||F.progress===100,Ke=F.executedDollarsCanonical;return jsxRuntime.jsx(Nr,{value:F.elapsedTime,onChange:Ze=>Ce({elapsedTime:Ze}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F),financialOverride:Ke})}case "effortMinutes":{if(M&&F.subtasks&&F.subtasks.length>0){let{allocated:oa}=Yn(F);if(v==="financial"){let jt=te(F),Ut=Math.round(jt.dollarAllocated),na=Math.round(jt.dollarQuoted),_t=na-Ut;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Ut>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",Ut.toLocaleString("es-CO")]}):null,_t!==0&&Ut>0&&na>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",_t>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[_t>0?"+":"",Math.abs(_t)>=1e3?`$${(_t/1e3).toFixed(1)}K`:`$${_t}`]})]})}return jsxRuntime.jsx(Nr,{value:oa>0?oa:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:P})}let me=F.status==="completed"||F.progress===100,Ke=F.effortMinutes||0,Ze=F.soldEffortMinutes||0,yt=G(F);if(v==="financial"&&yt&&Ke>0&&Ze>0){let oa=Math.round(Ke/60*yt),Ut=Math.round(Ze/60*yt)-oa;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Nr,{value:Ke,onChange:na=>Ce({effortMinutes:na}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)}),Ut!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ut>0?"+":"",Math.abs(Ut)>=1e3?`$${(Ut/1e3).toFixed(1)}K`:`$${Ut}`]})]})}return jsxRuntime.jsx(Nr,{value:Ke,onChange:oa=>Ce({effortMinutes:oa}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)})}case "timeLoggedMinutes":{let me=F.executedDollarsCanonical;if(M&&F.subtasks&&F.subtasks.length>0){let{spent:Ze}=Yn(F);return jsxRuntime.jsx(Nr,{value:Ze>0?Ze:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F),financialOverride:me})}let Ke=F.status==="completed"||F.progress===100;return jsxRuntime.jsx(Nr,{value:F.timeLoggedMinutes,onChange:a.onLogTime?Ze=>{a.onLogTime?.(F,Ze);}:void 0,isDark:T,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:Ke,lens:v,hourlyRate:G(F),financialOverride:me})}case "soldEffortMinutes":{if(M&&F.subtasks&&F.subtasks.length>0){let{quoted:Ze}=Yn(F),yt=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Nr,{value:Ze>0?Ze:void 0,isDark:T,locale:d,disabled:true,isBlurred:yt,lens:v,hourlyRate:G(F)})}let me=F.status==="completed"||F.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Nr,{value:F.soldEffortMinutes,onChange:Ze=>Ce({soldEffortMinutes:Ze}),isDark:T,locale:d,disabled:me,isBlurred:Ke,lens:v,hourlyRate:G(F)})}case "scheduleVariance":{let me=F.effortMinutes||0,Ke=F.soldEffortMinutes||0,Ze=F.timeLoggedMinutes||0,yt=me>0||Ke>0||Ze>0;return jsxRuntime.jsx(fg,{startDate:F.startDate,endDate:F.endDate,scheduleVariance:F.scheduleVariance,isDark:T,locale:d,hasTimeAllocated:yt})}case "hoursBar":{if(M&&F.hasChildren){let{spent:me,allocated:Ke,quoted:Ze}=Yn(F),yt=me>Ke&&Ke>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",T?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",yt?"text-[#FF453A]":T?"text-white/80":"text-gray-800"),children:qn(me)}),Ke>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:T?"text-white/60":"text-gray-600",children:qn(Ke)})]}),Ze>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:T?"text-amber-400/70":"text-amber-600",children:qn(Ze)})]})]})}return jsxRuntime.jsx(hg,{task:F,isDark:T,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:G(F)})}case "teamLoad":return F.hasChildren||F.subtasks&&F.subtasks.length>0?jsxRuntime.jsx(xg,{task:F,isDark:T,locale:d}):jsxRuntime.jsx(qd,{value:F.assignees||[],availableUsers:l,onChange:Ke=>{a.onTaskUpdate?.({...F,assignees:Ke});},isDark:T,locale:d});case "blockers":return jsxRuntime.jsx(wg,{blockers:F.blockers,isDark:T,locale:d});case "weight":{let me=q.get(F.id);if(me!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",me>0?T?"text-white/50":"text-gray-400":T?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?`${Number(me.toFixed(2))}%`:"\u2014"});let Ke=F.weight||0;return jsxRuntime.jsx(cw,{value:Ke,onChange:Ze=>Ce({weight:Ze}),isDark:T})}default:return jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white/60":"text-gray-500"),children:"-"})}},[a,T,d,l,Y,M,q]),Qn=react.useCallback(F=>{let Ce={name:Y.columns.name,status:Y.columns.status,priority:Y.columns.priority,assignees:Y.columns.assignees,startDate:Y.columns.startDate,endDate:Y.columns.endDate,progress:Y.columns.progress,tags:Y.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:Y.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:Y.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:Y.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:Y.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:Y.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:Y.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:Y.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:Y.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:Y.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:Y.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:Y.columns.weight||(d==="es"?"Peso":"Weight")}[F.type]||F.label;return typeof Ce=="string"?Ce:String(Ce||F.type)},[Y,d]),Ur=react.useMemo(()=>{let Ce=Q.reduce((Re,tt)=>Re+tt.width,0)+(h?48:0),ve={};for(let Re of Q)ve[Re.id]=`${Re.width/Ce*100}%`;return ve},[Q,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:[Y.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:Y.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:Y.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:bt,className:u(T?"bg-[#0D0D0D]":"bg-white",ne&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",T?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:[lr.length," ",Y.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",T?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:at,onChange:F=>ue(F.target.value),placeholder:Y.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",T?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),y&&it>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Vt,onClick:()=>mt(!Ft),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",T?Ft?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ft?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),St==="all"?d==="es"?"Todos":"All":`L${St}`]}),Ft&&jsxRuntime.jsx("div",{ref:ht,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",T?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(it,5)},(F,se)=>({value:se+1,label:`L${se+1}`}))].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{Et(F.value),mt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",T?St===F.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":St===F.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:F.label}),St===F.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(F.value)))})]}),jsxRuntime.jsx(Gg,{value:je,hideCompleted:he,onChange:Xe,onHideCompletedChange:kt,isDark:T,locale:d}),be?.enabled&&be.data&&!_e&&jsxRuntime.jsx("button",{onClick:()=>$(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",T?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&C&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:Y.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",T?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(F=>{let se=F.id!=="name",Ce=At===F.id&&Dt!==F.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",T?"text-white/60":"text-gray-500",se&&"cursor-grab",F.type!=="name"&&"justify-center",Dt===F.id&&"opacity-50",Ce&&(T?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Ur[F.id],minWidth:F.minWidth},draggable:se,onDragStart:se?ve=>Pe(ve,F.id):void 0,onDragEnd:se?$t:void 0,onDragOver:se?ve=>Ct(ve,F.id):void 0,onDragLeave:se?Jt:void 0,onDrop:se?ve=>Wa(ve,F.id):void 0,onContextMenu:ve=>N(ve,void 0,F.id),children:[se&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",T?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),F.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Fe(F.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Qn(F),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",ke===F.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Qn(F)}),f&&F.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ne===F.id&&"bg-[#007BFF]"),onMouseDown:ve=>Te(ve,F.id)})]},F.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),ct(se=>!se);},className:u("p-0.5 rounded transition-colors",T?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ze&&(T?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Og,{isOpen:ze,onClose:()=>ct(false),columns:xt,customFields:c,onColumnsChange:I,onCreateCustomField:()=>{ct(false),Ee(true);},isDark:T,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:lr.map((F,se)=>{let Ce=la.has(F.id),ve=Math.min(se*.01,.2),Re=F.hasChildren&&F.level===0,tt=F.subtasks?.length||0;if(Re){let{spent:jt,allocated:Ut,quoted:na}=Yn(F),_t=dw(F);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":F.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",T?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ee===F.id&&(T?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(F),children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(Ba=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ba.type!=="name"&&"justify-center"),style:{width:Ur[Ba.id],minWidth:Ba.minWidth},children:Ba.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Nt=>{Nt.stopPropagation(),$e(F.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",T?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",T?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",T?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Nt=>{Nt.stopPropagation(),$e(F.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Ce?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:T?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:T?"#FFD60A":"#B45309"}})}),F.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:T?"#FFD60A":"#B45309"},children:F.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",T?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:F.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",T?"text-white/30":"text-gray-500"),children:["(",tt," ",d==="es"?tt===1?"Tarea":"Tareas":tt===1?"Item":"Items",")"]}),_t!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",_t>=1?"text-[#32D74B] bg-[#32D74B]/10":_t>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",_t.toFixed(2)]})]})]}):Ba.type==="timeLoggedMinutes"?v==="financial"?(()=>{let Nt=F.executedDollarsCanonical,pr=Nt!=null?Math.round(Nt):Math.round(te(F).dollarSpent);return pr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",pr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Nr,{value:jt>0?jt:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Ba.type==="soldEffortMinutes"?v==="financial"?(()=>{let Nt=te(F),pr=Math.round(Nt.dollarQuoted);return pr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",pr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Nr,{value:na>0?na:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Ba.type==="effortMinutes"?v==="financial"?(()=>{let Nt=te(F),pr=Math.round(Nt.dollarAllocated),Co=Math.round(Nt.dollarQuoted),Ar=Co-pr;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[pr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",pr.toLocaleString("es-CO")]}):null,Ar!==0&&pr>0&&Co>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ar>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ar>0?"+":"",Math.abs(Ar)>=1e3?`$${(Ar/1e3).toFixed(1)}K`:`$${Ar}`]})]})})():jsxRuntime.jsx(Nr,{value:Ut>0?Ut:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Pr(F,Ba)},Ba.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},F.id)}let me=U===F.id,Ke=oe===F.id,Ze=Ke&&ge==="above",yt=Ke&&ge==="below",oa=Ke&&ge==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":F.id,"data-listview-row":F.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-b transition-colors relative group",T?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ee===F.id&&(T?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:me?.4:1,backgroundColor:oa?T?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:oa?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(F),onDoubleClick:()=>a.onTaskDoubleClick?.(F),onContextMenu:jt=>N(jt,F),children:[Ze&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),yt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),st&&jsxRuntime.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:jt=>pt(F.id,jt),style:{color:T?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Q.map(jt=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",jt.type!=="name"&&"justify-center"),style:{width:Ur[jt.id],minWidth:jt.minWidth},children:jt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&F.level>0&&jsxRuntime.jsx("div",{style:{width:`${F.level*24}px`},className:"flex-shrink-0"}),y&&F.hasChildren&&jsxRuntime.jsx("button",{onClick:Ut=>{Ut.stopPropagation(),$e(F.id);},className:u("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",T?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",T?"text-white/60":"text-gray-400")})}),y&&!F.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(F.wbsCode||F.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[F.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",T?"text-[#007BFF]":"text-blue-600"),children:F.wbsCode}),F.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",T?"text-white/40":"text-gray-400"),children:F.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate",F.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",F.progress===100?T?"line-through text-white/50":"line-through text-gray-400":F.hasChildren?T?"text-white":"text-gray-900":T?"text-[#D1D5DB]":"text-gray-600"),children:F.name}),F.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${F.tags[0].color}20`,color:F.tags[0].color},children:F.tags[0].name})]})]}):Pr(F,jt)},jt.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},F.id)})}),J&&lr.length>0&&(()=>{let{spent:F,allocated:se,quoted:Ce}=B,ve=se-F,Re=ve<0,tt=Re?`+${qn(Math.abs(ve))} ${d==="es"?"EXCEDIDO":"OVER"}`:`+${qn(ve)} ${d==="es"?"AHORRADO":"SAVED"}`,me=v==="financial"&&P>0,Ke=H?.spent!=null?H.spent:B.dollarSpent,Ze=H?.allocated!=null?H.allocated:B.dollarAllocated,yt=H?.quoted!=null?H.quoted:B.dollarQuoted,oa=(na,_t)=>{if(me){let Ba=_t??na/60*P;return `$${Math.round(Ba).toLocaleString("es-CO")}`}return qn(na)},jt=me?Math.abs(Ze-Ke):0,Ut=me?`+$${jt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Re?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:tt;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",T?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:T?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(na=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3",na.type!=="name"&&"justify-center"),style:{width:Ur[na.id],minWidth:na.minWidth},children:na.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):na.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(F,me?Ke:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(se,me?Ze:void 0)})]}),se>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Re?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:me?Ut:tt})]}):na.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ce>0?oa(Ce,me?yt:void 0):"\u2013"}):na.type==="effortMinutes"?(()=>{if(me&&Ce>0&&se>0){let _t=Math.round(yt),Ba=Math.round(Ze),Nt=_t-Ba,pr=_t>0?Math.round(Nt/_t*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(se,Ze)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Nt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Nt>=0?"+":"",Math.abs(Nt)>=1e3?`$${(Nt/1e3).toFixed(1)}K`:`$${Nt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",pr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?oa(se,me?Ze:void 0):"\u2013"})})():na.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:F>0?oa(F,me?Ke:void 0):"\u2013"}):na.type==="progress"?(()=>{let _t=Jg(uc(e||[]));return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",T?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_t,"%"]})})():na.type==="weight"?(()=>{let _t=e||[],Ba=[],Nt=To=>{for(let No of To)Ba.push(No),No.subtasks?.length&&Nt(No.subtasks);};Nt(_t);let Co=Ba.filter(To=>!To.subtasks?.length||To.subtasks.length===0).reduce((To,No)=>To+(No.weight||0),0),Ar=Math.abs(Co-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",Ar?T?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Co.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/30":"text-gray-300"),children:"\u2013"})},na.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),lr.length===0&&at&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",T?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(T?"text-white/60":"text-gray-600"),children:Y.empty.noResults})]})})]})}),be?.enabled&&be.data&&_e&&jsxRuntime.jsx(_g,{data:be.data,isDark:T,locale:d,onClose:()=>$(false),lens:t?.lens,onUnassignedTaskClick:F=>{let se=document.querySelector(`[data-task-id="${F}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),le(F),setTimeout(()=>le(null),2e3));}})]}),jsxRuntime.jsx(Sg,{state:V,onClose:K,isDark:T,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ye,onColumnSort:Z,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ne&&Oe&&U&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Oe.x+12,top:Oe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Se.flattenTasks(e).find(Ce=>Ce.id===U);return se?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:T?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${T?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsxRuntime.jsx(zg,{isOpen:et,onClose:()=>Ee(false),onSave:ha,isDark:T,locale:d})]})}var t0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],a0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],r0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var pc={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},mc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},gc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Zi={dark:pc,light:mc,neutral:gc};function o0(e){return Zi[e]||Zi.dark}var fc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},bc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},el={en:fc,es:bc};function Ls(e){return el[e]||el.en}function tl(e,t){let a=Ls(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 n0(e){let t=Ls(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 s0(e,t=0,a=true){let r=Ls(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 Bs(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 yc(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 d0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var p0=26,yw=22,xw=10;function c0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function xc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function m0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function u0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function vw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",h=m?xc(c.effortMinutes,n,l):null,f=m?m0(c,n,l):null,b=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*p0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${yw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function g0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:S,onUpdateEstimate:E,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:P,onDiscardTimer:L,blurFinancials:M=false,suppressDetailModal:J=false,lens:H="hours",hourlyRate:Y=0}){let{theme:T="dark",locale:G="en",customTranslations:te,showBacklog:Le=true}=t,B=tl(G,te),q=T==="dark"||T==="neutral",[be,_e]=react.useState(r||new Date),[$,ee]=react.useState(null),[le,ke]=react.useState(null),[xe,Be]=react.useState(null),[He,at]=react.useState({}),ue=3,je=3,Xe=react.useCallback(z=>{ke(z.id),J||ee(z),h?.(z.id);},[J,h]),[he,kt]=react.useState(null),xt=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()-1,1));},[be]),nt=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()+1,1));},[be]),ze=react.useCallback(()=>{_e(new Date);},[]),ct=react.useMemo(()=>{let z=be.getFullYear(),oe=be.getMonth(),Ge=new Date(z,oe,1),ge=new Date(z,oe+1,0),Ve=Ge.getDay(),Oe=ge.getDate(),Ue=Bs(e),lt=new Date;lt.setHours(0,0,0,0);let ot=[],st=Ve,pt=new Date(z,oe,0).getDate();for(let Ot=st-1;Ot>=0;Ot--){let St=new Date(z,oe-1,pt-Ot);ot.push({date:St,isCurrentMonth:false,isToday:false,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Et=>yc(St,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}for(let Ot=1;Ot<=Oe;Ot++){let St=new Date(z,oe,Ot),Et=St.getTime()===lt.getTime();ot.push({date:St,isCurrentMonth:true,isToday:Et,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Ft=>yc(St,Ft)).map(Ft=>({id:Ft.id,title:Ft.name,start:Ft.startDate,end:Ft.endDate,task:Ft}))});}let Tt=42-ot.length;for(let Ot=1;Ot<=Tt;Ot++){let St=new Date(z,oe+1,Ot);ot.push({date:St,isCurrentMonth:false,isToday:false,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Et=>yc(St,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}return ot},[be,e]),et=react.useMemo(()=>Bs(e).filter(z=>!z.startDate||!z.endDate),[e]),Ee=react.useMemo(()=>{let z=Bs(e),oe=0,Ge=0,ge=0,Ve=0,Oe=0;z.forEach(pt=>{pt.effortMinutes&&(oe+=pt.effortMinutes),pt.soldEffortMinutes&&(Ge+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(ge+=pt.scheduleVariance,Ve++),pt.soldEffortMinutes&&pt.effortMinutes&&(Oe+=pt.soldEffortMinutes-pt.effortMinutes);});let Ue=Ge>0?Math.min(100,Math.round(oe/Ge*100)):0,lt=Ve>0?Math.round(ge/Ve):0,st=`${Oe<0?"-":"+"}${u0(Oe,H,Y)}`;return {budgetUtil:Ue,avgVariance:lt,costDisplay:st,hasCostData:Ge>0}},[e,H,Y]),V=react.useMemo(()=>{let z=[0,0,0,0,0,0];return ct.forEach((oe,Ge)=>{let ge=Math.floor(Ge/7);oe.events.forEach(Ve=>{if(Ve.task.startDate&&Ve.task.soldEffortMinutes){let Oe=new Date(Ve.task.startDate),Ue=oe.date;Oe.getFullYear()===Ue.getFullYear()&&Oe.getMonth()===Ue.getMonth()&&Oe.getDate()===Ue.getDate()&&ge<z.length&&(z[ge]-=Ve.task.soldEffortMinutes);}});}),z},[ct]),D=react.useMemo(()=>{let z=Bs(e),oe=new Map,Ge=new Set,ge=[0,0,0,0,0,0];if(ct.length===0)return {segmentsByCell:oe,multiDayTaskIds:Ge,maxLanesPerRow:ge};let Ve=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Oe=Ve(ct[0].date),Ue=Ve(ct[ct.length-1].date),lt=[];for(let st of z){if(!st.startDate||!st.endDate)continue;let pt=Ve(st.startDate),Tt=Ve(st.endDate);if(pt.getTime()===Tt.getTime()||Tt<Oe||pt>Ue)continue;let Ot=pt<Oe?Oe:pt,St=Tt>Ue?Ue:Tt,Et=c0(Ot,Oe),Ft=c0(St,Oe);Et<0||Et>41||Ft<0||Ft>41||Et!==Ft&&(Ge.add(st.id),lt.push({task:st,startIdx:Et,endIdx:Ft}));}lt.sort((st,pt)=>st.startIdx!==pt.startIdx?st.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(st.endIdx-st.startIdx));let ot=[[],[],[],[],[],[]];for(let{task:st,startIdx:pt,endIdx:Tt}of lt){let Ot=Math.floor(pt/7),St=Math.floor(Tt/7),Et=Ve(st.startDate),Ft=Ve(st.endDate),mt=false;for(let Vt=Ot;Vt<=St;Vt++){let ht=Vt===Ot?pt%7:0,it=Vt===St?Tt%7:6,ne=it-ht+1,pe=0,O=ot[Vt]??[];for(ot[Vt]||(ot[Vt]=O);pe<O.length&&(O[pe]??-1)>=ht;)pe++;if(pe>=xw){mt=true;break}pe>=O.length?O.push(it):O[pe]=it,ge[Vt]=Math.max(ge[Vt]??0,pe+1);let _=Vt===Ot&&Et>=Oe,De=Vt===St&&Ft<=Ue,Qe=Vt*7+ht,bt={taskId:st.id,task:st,rowIndex:Vt,startCol:ht,endCol:it,spanCols:ne,lane:pe,isStart:_,isEnd:De};oe.has(Qe)||oe.set(Qe,[]),oe.get(Qe).push(bt);}mt&&(Ge.delete(st.id),oe.forEach((Vt,ht)=>{let it=Vt.filter(ne=>ne.taskId!==st.id);it.length===0?oe.delete(ht):oe.set(ht,it);}));}return {segmentsByCell:oe,multiDayTaskIds:Ge,maxLanesPerRow:ge}},[ct,e]),U=G==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ae=be.toLocaleDateString(G==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ne=ae.charAt(0).toUpperCase()+ae.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",q?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",q?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",q?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",q?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",q?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",q?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",q?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",q?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",q?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",q?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",q?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",q?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",q?"text-white":"text-gray-900"),children:G==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",q?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:xt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",q?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",q?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:nt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",q?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",q?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:ze,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",q?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",q?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:U.map(z=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",q?"text-white/60 font-mono":"text-gray-500"),children:z},z))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",q?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>ke(null),children:ct.map((z,oe)=>{let Ge=oe%7===6,ge=oe>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ge&&(q?"border-r border-[#222]":"border-r border-gray-200"),!ge&&(q?"border-b border-[#222]":"border-b border-gray-200"),q?z.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":z.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",z.isToday&&q&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",z.isToday&&!q&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",z.isToday?q?"text-[#007FFF] font-bold":"text-blue-600 font-bold":z.isCurrentMonth?q?"text-white/60":"text-gray-900":q?"text-white/20":"text-gray-400"),children:String(z.date.getDate()).padStart(2,"0")}),(()=>{let Ve=Math.floor(oe/7),Oe=(D.maxLanesPerRow[Ve]??0)*p0,Ue=D.segmentsByCell.get(oe);return Oe===0&&!Ue?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Oe}px`,zIndex:5},children:Ue?.map(lt=>jsxRuntime.jsx(vw,{segment:lt,isDark:q,blurFinancials:M,isSelected:le===lt.taskId,t:B,lens:H,hourlyRate:Y,onClick:()=>{Xe(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let Ve=z.events.filter(Oe=>Oe.task.isMilestone&&!D.multiDayTaskIds.has(Oe.id));return Ve.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ve.slice(0,4).map(Oe=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Oe.title,onClick:Ue=>{Ue.stopPropagation(),Xe(Oe.task);}},Oe.id)),Ve.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",q?"text-white/30":"text-gray-400"),children:["+",Ve.length-4]})]})})(),(()=>{let Ve=[];z.events.forEach(Ue=>{Ue.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&Ve.push({taskId:Ue.id,type:lt.type,severity:lt.severity,variance:Ue.task.scheduleVariance});});});let Oe=Ve[0];return Oe?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Oe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Oe.type,Oe.variance?` (+${Math.abs(Oe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let Ve=z.events.filter(ot=>!D.multiDayTaskIds.has(ot.id)),Oe=He[oe]||ue,Ue=Ve.slice(0,Oe),lt=Ve.length-Oe;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ue.map(ot=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{Xe(ot.task),a.onEventClick?.(ot);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ot.task.progress===100||ot.task.status==="completed"?q?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":q?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:q?ot.task.progress===100||ot.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ot.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",ot.task.isMilestone?q?"text-amber-400":"text-amber-600":ot.task.isCriticalPath?"text-red-400":q?"text-[#1264FF]":"text-gray-400"),children:ot.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ot.title})]},ot.id)),lt>0&&jsxRuntime.jsxs("button",{onClick:ot=>{ot.stopPropagation(),at(st=>({...st,[oe]:Oe+je}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",q?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",G==="es"?"m\xE1s":"more"]}),Oe>ue&&Ve.length>ue&&jsxRuntime.jsx("button",{onClick:ot=>{ot.stopPropagation(),at(st=>({...st,[oe]:ue}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",q?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:G==="es"?"menos":"less"})]})})(),z.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ve=oe>=28,Oe=oe%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ue=>{Ue.stopPropagation(),kt(he===oe?null:oe);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",he===oe?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",q?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",he===oe&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he===oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>kt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ve?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ve?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ve?"bottom-full mb-1":"top-full mt-1",Oe?"right-0":"left-0",q?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(an,{onSubmit:Ue=>{a.onTaskCreate?.({name:Ue.name,startDate:Ue.startDate||z.date,endDate:Ue.endDate||z.date,priority:Ue.priority,assignees:Ue.assignee?[Ue.assignee]:void 0}),kt(null);},onCancel:()=>kt(null),availableUsers:t.availableUsers,isDark:q,locale:G==="es"?"es":"en",defaultDate:z.date,dropdownDirection:Ve?"up":"down"})})]})})]})})()}),oe%7===6&&(()=>{let Ve=Math.floor(oe/7),Oe=V[Ve];if(!Oe||Oe===0)return null;let Ue=u0(Oe,H,Y);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Oe<0?"text-red-400":"text-emerald-400",M&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Oe<0?"-":"+",Ue]})})()]},oe)})})})]}),Le&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",q?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",q?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",q?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",q?"text-white/20":"text-gray-400"),children:et.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:et.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",q?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",q?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",q?"text-white/20":"text-gray-400"),children:G==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):et.map(z=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(z);},className:u("w-full text-left rounded-md p-3 transition-all group/card",q?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",q?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",q?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:z.name})]}),z.tags&&z.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[z.tags.slice(0,3).map(oe=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${oe.color}15`,color:oe.color,border:`1px solid ${oe.color}30`},children:oe.name},oe.id)),z.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",q?"text-white/20":"text-gray-400"),children:["+",z.tags.length-3]})]}),(z.effortMinutes||z.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",q?"text-white/25":"text-gray-400",M&&"blur-sm select-none"),children:[xc(z.effortMinutes,H,Y)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",xc(z.effortMinutes,H,Y)]}),(()=>{let oe=m0(z,H,Y);return oe?jsxRuntime.jsx("span",{className:oe.isNegative?"text-red-400":"text-emerald-400",children:oe.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[z.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",z.priority==="urgent"||z.priority==="high"?"text-red-400":z.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(d0,{task:z,isDark:q})]}),z.assignees&&z.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,2).map((oe,Ge)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:oe.color||"#007FFF"},title:oe.name,children:oe.initials||oe.name?.slice(0,2).toUpperCase()},Ge))})]})]},z.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",q?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",q?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:z=>{z.key==="Enter"&&z.target.value.trim()&&(a.onTaskCreate?.({name:z.target.value.trim()}),z.target.value="");}})}),Ee.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",q?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",q?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",q?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",q?"text-white/60":"text-gray-700",M&&"blur-sm select-none"),children:[Ee.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",q?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ee.budgetUtil}%`,background:Ee.budgetUtil>90?"#EF4444":Ee.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",q?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",q?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Ee.avgVariance>0?"text-emerald-400":Ee.avgVariance<0?"text-red-400":q?"text-white/50":"text-gray-600"),children:[Ee.avgVariance>0?"+":"",Ee.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",q?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",q?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Ee.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",M&&"blur-sm select-none"),children:Ee.costDisplay})]})]})]})]})]}),!J&&jsxRuntime.jsx(bo,{task:$,isOpen:!!$,onClose:()=>ee(null),onTaskUpdate:z=>{a.onTaskUpdate?.(z),ee(z);},theme:T==="dark"?"dark":"light",locale:G,availableUsers:t.availableUsers?.map(z=>({id:z.id,name:z.name,avatar:z.avatar,initials:z.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:$?p?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Bs(e).filter(z=>z.id!==$?.id),comments:d?.filter(z=>z.taskId===$?.id).map(z=>({...z,createdAt:z.createdAt instanceof Date?z.createdAt:new Date(z.createdAt),updatedAt:z.updatedAt instanceof Date?z.updatedAt:z.updatedAt?new Date(z.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:S,onEstimateUpdate:E,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:P,onTimerDiscard:L,blurFinancials:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Be(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",q?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",q?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",q?"text-white/90":"text-gray-900"),children:xe.date.toLocaleDateString(G==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Be(null),className:u("p-1 rounded",q?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:xe.events.map(z=>jsxRuntime.jsxs("button",{onClick:()=>{Be(null),Xe(z.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",q?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(d0,{task:z.task,isDark:q}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",q?"text-white/80":"text-gray-900"),children:z.title}),(z.task.priority==="high"||z.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},z.id))})]})]})})]})}var vc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},wc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},kc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},ol={dark:vc,light:wc,neutral:kc};function f0(e){return ol[e]||ol.dark}function kw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,y=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,x=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var h0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Os(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 $s(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 y0(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 x0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...h0,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],S=b.get(C);S?S.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((S,E)=>E.timestamp.getTime()-S.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{p(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),S=Math.floor(C/6e4),E=Math.floor(C/36e5),k=Math.floor(C/864e5);return S<1?"just now":S<60?`${S}m ago`:E<24?`${E}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=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&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[$s(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.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})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.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((w,C)=>{let S=i.has(w.id),E=s===w.id,k=y0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",S&&"expanded",E&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:$s(w.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Os(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[S?"\u25BC":"\u25B6"," Show changes"]}),S&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(P.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(P.to)})]})]},v)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(P)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function w0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&$s(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Os(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:Os(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Cc(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 Tc(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 k0(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 C0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ew(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,x=p.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);p.vx+=y/h*f,p.vy+=x/h*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,y=m.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,m.vx-=g*h,m.vy-=y*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function T0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(1),[C,S]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=Ew(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let E=react.useCallback((H,Y)=>{a.enableDragging&&(Y.stopPropagation(),g(H));},[a.enableDragging]),k=react.useCallback(H=>{if(!m||!i.current)return;let T=i.current.getBoundingClientRect(),G=(H.clientX-T.left-C.x)/b,te=(H.clientY-T.top-C.y)/b;d(Le=>Le.map(B=>B.id===m?{...B,x:G,y:te,fx:G,fy:te}:B));},[m,b,C]),v=react.useCallback(()=>{g(null);},[]),P=react.useCallback((H,Y)=>{Y.stopPropagation(),l?.({type:"node-click",node:H,position:{x:Y.clientX,y:Y.clientY}});},[l]),L=react.useCallback((H,Y)=>{Y.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:Y.clientX,y:Y.clientY}});},[l]),M=react.useCallback(H=>{let Y=p.find(T=>T.id===H);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[p]),J=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Y=H.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),S({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Cc(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[k0(H)," ",Tc(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let Y=M(typeof H.source=="string"?H.source:H.source.id),T=M(typeof H.target=="string"?H.target:H.target.id),G=C0(H.type),te=h===H.id,Le=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",te&&"hovered",Le&&"critical"),onMouseEnter:()=>f(H.id),onMouseLeave:()=>f(null),onClick:B=>L(H,B),children:[jsxRuntime.jsx("line",{x1:Y.x,y1:Y.y,x2:T.x,y2:T.y,stroke:Cc(H.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:te?1:.6,markerEnd:G?"url(#arrowhead)":void 0}),a.showEdgeLabels&&te&&jsxRuntime.jsx("text",{x:(Y.x+T.x)/2,y:(Y.y+T.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Tc(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(H=>{let Y=y===H.id,T=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",Y&&"hovered",T&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:G=>E(H.id,G),onMouseEnter:()=>x(H.id),onMouseLeave:()=>x(null),onClick:G=>P(H,G),children:[jsxRuntime.jsx("circle",{r:T?a.nodeSize*1.2:a.nodeSize,fill:J(H),stroke:T?"#fbbf24":"#ffffff",strokeWidth:T?3:2,opacity:Y?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function S0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),y=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),p(null),m(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),p(null),m(null);try{let b=await r(s.trim());m(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Nc={"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 Fw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Pw={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 Aw(e,t,a){let r=Nc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Hs(e){return `$${e.toFixed(4)}`}var Dc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Aw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},mn=new Dc;function F0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(mn.getStats()),[s,n]=react.useState(mn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(mn.getStats()),n(mn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=mn.getRecentOperations(5);return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Hs(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Hs(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Hs(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function L0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(null),C=react.useRef(null),S=m||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let L=M=>{M.key==="Escape"&&!S&&E();};if(e)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,S]);let E=()=>{S||(l(""),i(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||S)){g(true),x(null),f(null),w(null);try{let L=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(L.tasks.tasks),w({from_cache:L.from_cache,tokens_used:L.tokens_used,mock_mode:L.mock_mode,similarity:L.similarity,tokens_saved:L.tokens_saved});}catch(L){x(L instanceof Error?L.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),E());};if(!e)return null;let P=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:E}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:E,disabled:S,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:h?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 (",P,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((L,M)=>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:["#",M+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:L.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),L.start," \u2192 ",L.end]}),jsxRuntime.jsxs("span",{children:[L.duration," days"]}),L.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",L.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${L.priority==="high"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:L.priority})]})},L.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:n,onChange:L=>l(L.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:S}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:L=>i(L.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]}),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:L=>d(L.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((L,M)=>jsxRuntime.jsx("button",{onClick:()=>l(L),disabled:S,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:L},M))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:S&&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:E,disabled:S,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"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||S,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:S?"Generating...":"Generate Tasks"})]})]})]})})]})}function il({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Xs(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(L=>L.id===h);if(!C)return w;let S=C.columnId,E={...C,columnId:f,position:b},k=w.cards.map(L=>L.id===h?E:L),v=w.columns.map(L=>{if(L.id===S)return {...L,cardIds:L.cardIds.filter(M=>M!==h)};if(L.id===f){let M=k.filter(J=>J.columnId===f).sort((J,H)=>J.position-H.position);return {...L,cardIds:M.map(J=>J.id)}}return L}),P={...w,cards:k,columns:v};return o(P),P});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(S=>S.id===h?{...S,...f}:S),C={...b,cards:w};return o(C),C});},[o]),l=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(E=>E.id===h.columnId?{...E,cardIds:[...E.cardIds,f]}:E),S={...b,cards:[...b.cards,w],columns:C};return o(S),S});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(E=>E.id===h);if(!b)return f;let w=f.cards.filter(E=>E.id!==h),C=f.columns.map(E=>E.id===b.columnId?{...E,cardIds:E.cardIds.filter(k=>k!==h)}:E),S={...f,cards:w,columns:C};return o(S),S});},[o]),i=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),p=react.useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(S=>S.id===h?{...S,...f}:S),C={...b,columns:w};return o(C),C});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(S=>S.columnId!==h),w=f.columns.filter(S=>S.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),m=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function B0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=il({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var zs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},O0={by:"none",order:"asc"};function $0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...zs,...e}),[s,n]=react.useState({...O0,...t}),l=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),i=react.useCallback(()=>{o(zs),n(O0);},[]),p=react.useCallback(()=>{a&&o({...zs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...zs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...zs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),S=`${b}-${w}-${C}`;h=h.filter(E=>{if(!E.endDate&&!E.dueDate)return false;let k=E.endDate||E.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let P=k.getUTCFullYear(),L=String(k.getUTCMonth()+1).padStart(2,"0"),M=String(k.getUTCDate()).padStart(2,"0");v=`${P}-${L}-${M}`;}switch(r.dateFilter){case "overdue":return v<S;case "today":return v===S;case "this-week":let P=new Date(S+"T00:00:00"),L=new Date(v+"T00:00:00"),M=new Date(P);return M.setDate(M.getDate()+7),L>=P&&L<=M;case "custom":if(r.dateRange){let J=typeof k=="string"?new Date(k):k;return J>=r.dateRange.start&&J<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,S=b.createdAt?new Date(b.createdAt).getTime():0;w=C-S;break;case "priority":let E={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=E[f.priority||"LOW"],v=E[b.priority||"LOW"];w=k-v;break;case "dueDate":let P=f.endDate||f.dueDate,L=b.endDate||b.dueDate;if(!P)return 1;if(!L)return -1;let M=typeof P=="string"?new Date(P).getTime():P.getTime(),J=typeof L=="string"?new Date(L).getTime():L.getTime();w=M-J;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let H=f.estimatedTime||0,Y=b.estimatedTime||0;w=H-Y;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var z0,U0;if(typeof window<"u")try{let e=Ks("ai");z0=e.generateObject,U0=e.generateText;}catch{}function W0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(z0&&U0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Ec(){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 V0(e){let{cards:t}=e,[a,r]=Ec(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,P)=>v.position-P.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,S]=b<w?[b,w]:[w,b],E=f.slice(C,S+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...E]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:p}}var G0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function j0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...G0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(S=>S.columnId===f).length,createdAt:new Date};n(S=>[...S,C]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),i=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(S=>S.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(S=>{S.labels&&S.labels.length>0&&S.labels.forEach(E=>{b.has(E)||b.set(E,[]),b.get(E).push(S);});}),b.forEach((S,E)=>{S.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${E}`,cardIds:S.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${S.length} cards with label "${E}"`,confidence:.85});});let w=new Map;h.forEach(S=>{S.assignedUserIds&&S.assignedUserIds.length>0&&S.assignedUserIds.forEach(E=>{w.has(E)||w.set(E,[]),w.get(E).push(S);});}),w.forEach((S,E)=>{S.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${E.slice(-4)}`,cardIds:S.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${S.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(S=>{S.priority&&(C.has(S.priority)||C.set(S.priority,[]),C.get(S.priority).push(S));}),C.forEach((S,E)=>{if(S.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[E.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${E} Priority`,cardIds:S.map(v=>v.id),columnId:x,strategy:"priority",color:E==="high"||E==="urgent"?"#ef4444":"#10b981"},reason:`${S.length} cards with ${E} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let S of h){let k=(await r.findSimilar(S,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[S.id,...k.map(L=>L.card.id)],P=k.reduce((L,M)=>L+M.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${S.title.substring(0,30)}${S.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:P});}}return f.filter(S=>S.confidence>=o.autoStackConfidenceThreshold).sort((S,E)=>E.confidence-S.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var _0=react.createContext(null);function K0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=Ks("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ks("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ks("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(_0.Provider,{value:{store:o},children:e})}function ll(){let e=react.useContext(_0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ws(){let e=ll(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),i=react.useCallback((b,w)=>{e.updateColumn(b,w);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),m=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function Y0(e){let{cards:t}=Ws();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 X0(e="position",t="asc"){let{cards:a}=Ws();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var dl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=lu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Yw=new dl;function Q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Z0(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 tf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:m.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function af(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 rf(e,t=10){return e>t}var Ac={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Oc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$c={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Hc={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)"},zc={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)"},Uc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Vc={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}},cl={spacing:Ac,borderRadius:Lc,fontSize:Ic,fontWeight:Bc,lineHeight:Rc,zIndex:Oc,duration:$c,easing:Hc,shadows:zc,opacity:Uc,kanban:Wc,gantt:Vc};function of(e,t,a){return e[t]??a}function Gc(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)?Gc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function jc(e="asakaa"){let t=Gc(cl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Qw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ko(e,t){let a=Bm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Hd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let m=p[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function zd(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 Ud(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 Rm(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 Om(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),d=ko(t,i),m=Hd(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:y},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=ko(t,i),m=zd(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),d=ko(t,i),m=Ud(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=ko(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),p=l[2].trim(),d=ko(t,i),m=ko(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),p=ko(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function $m(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 l2(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 d2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ui(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Ui(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:l2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Hm(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:d2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function zm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ui(r,e,t))}var Wd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Wi={en:Wd,es:Vd};function Gd(e){return Wi[e]||Wi.en}function Vi(e,t){let a=Gd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var jd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function Um(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function Wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Um(e),i=jd[0],p=jd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(Um(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",p.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:jd.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var _d=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Gm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=_d.find(p=>p.value===e)??_d[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:_d.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function Ss(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Kd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function qd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{p.current&&!p.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:Ss(x.name),color:x.color||Kd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ss(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ss(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Ss(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Ss(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Xm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,p]=react.useState(false),[d,m]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&p(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),P=new Date(k,v,1),M=new Date(k,v+1,0).getDate(),J=P.getDay(),H=[],T=new Date(k,v,0).getDate();for(let te=J-1;te>=0;te--)H.push({date:new Date(k,v-1,T-te),isCurrentMonth:false});for(let te=1;te<=M;te++)H.push({date:new Date(k,v,te),isCurrentMonth:true});let G=42-H.length;for(let te=1;te<=G;te++)H.push({date:new Date(k,v+1,te),isCurrentMonth:false});return H},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),p(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),m("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),p(false);}},S=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let P=new Date(k);P.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let L=new Date(k);L.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let M=new Date(k);M.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let J=new Date(k);J.setDate(k.getDate()+14);let H=new Date(k);return H.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:P,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:L,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let E=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),p(!i);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(E)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((k,v)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),p(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let P=k.date.toDateString()===new Date().toDateString(),L=h?.toDateString()===k.date.toDateString(),M=f?.toDateString()===k.date.toDateString(),J=L||M,H=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),P&&"ring-2 ring-[#007BFF]",L&&"bg-[#007BFF] text-white",M&&!L&&"bg-[#7C3AED] text-white",H&&!J&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!J&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function _i({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Xm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function jn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ki(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),p=react.useRef([]);return react.useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(m));},y*x);p.current.push(h);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Jm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),p=react.useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Zm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=react.useState(false),[c,i]=react.useState(""),p=react.useRef(null),{isFlashing:d,triggerFlash:m}=jn(),{displayValue:g,isAnimating:y}=Ki(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let S=C.currentTarget.getBoundingClientRect(),E=C.clientX-S.left,k=Math.round(E/S.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&m());},h=react.useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);react.useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=react.useCallback(()=>{l(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let S=Math.max(0,Math.min(100,C));S!==e&&(t(S),s&&m());}},[c,t,e,s,m]),b=react.useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&l(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[w>0?jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:p,value:c,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",w===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function ag({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function ng({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=react.useState(false),[d,m]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=jn(),{displayValue:h,isAnimating:f}=Ki(e,{enabled:l&&!i});react.useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),react.useEffect(()=>{m(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let S=C;o!==void 0&&(S=Math.max(o,S)),s!==void 0&&(S=Math.min(s,S)),S!==e&&(t?.(S),c&&x());}p(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(m(e?.toString()||""),p(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):i?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:C=>m(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),p(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function sg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function lg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:p}=Jm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():i(!e):t(!e));},m=l?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),p();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function ug({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function K2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function q2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:p}){let[d,m]=react.useState(false),[g,y]=react.useState(""),x=react.useRef(null),{isFlashing:h,triggerFlash:f}=jn(),b=c==="financial"&&(i>0||p!=null),w=p??(e?e/60*i:0),C=b&&(p!=null?p>0:e)?`$${Math.round(w).toLocaleString("en-US")}`:K2(e,r);react.useEffect(()=>{d&&x.current&&(x.current.focus(),x.current.select());},[d]),react.useEffect(()=>{if(e){let v=Math.floor(e/60),P=e%60;v>0&&P>0?y(`${v}h ${P}m`):v>0?y(`${v}h`):y(`${P}m`);}else y("");},[e,d]);let S=()=>{let v=q2(g);v!==e&&(t?.(v),n&&f()),m(false);},E=v=>{v.key==="Enter"?S():v.key==="Escape"&&m(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=b?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(k,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:C})]}):d?jsxRuntime.jsx("input",{ref:x,type:"text",value:g,onChange:v=>y(v.target.value),onBlur:S,onKeyDown:E,onClick:v=>v.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:v=>{v.stopPropagation(),m(true);},className:u("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(k,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:C})]})}function fg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function hg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",p=l==="financial"&&c>0,d=te=>p?`$${Math.round(te*c).toLocaleString("en-US")}`:`${te}h`,[m,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,S=e.soldEffortMinutes||0,E=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,P=v>100?Math.round((w-C)/60*10)/10:0,L=v>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let te=Le=>{b.current&&!b.current.contains(Le.target)&&(x(false),f(null));};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[y,h]);let M=te=>{if(te.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Le=>!Le),f(null);return}n&&n(e);},J=te=>{x(false),f(te);},H=async(te,Le)=>{h==="log"&&r&&te?r(e,te,Le):h==="estimate"&&o?o(e,te):h==="quoted"&&s&&s(e,te),f(null);},Y=r||o||s||n,T=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(te=>te.show),G=h==="estimate"?C:h==="quoted"?S:void 0;return C===0&&w===0&&S===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&Y&&jsxRuntime.jsx("button",{onClick:M,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:T.map(te=>jsxRuntime.jsxs("button",{onClick:Le=>{Le.stopPropagation(),J(te.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Le=>{Le.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Le=>{Le.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(no,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:H,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let te=w===0,B=(C>0?w/C:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:te?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(E)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),P>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(P)," ",i?"Excedido":"Over"]})]})})(),C>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(v,100)}%`,backgroundColor:L,borderRadius:2,transition:"width 0.3s"}})})]}),Y&&jsxRuntime.jsx("button",{onClick:M,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:T.map(te=>jsxRuntime.jsxs("button",{onClick:Le=>{Le.stopPropagation(),J(te.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Le=>{Le.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Le=>{Le.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(no,{mode:h,locale:a,isDark:t,currentValue:G||void 0,onSave:H,onClose:()=>f(null)})})})})]})}function t1(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function a1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function yg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function xg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=t1(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(yg,{assignee:g,size:24,isDark:t},g.name+y))}),m>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?a1(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(yg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var r1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function wg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",r1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function y1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function x1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Sg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?Tg.es:Tg.en;if(react.useEffect(()=>{let k=P=>{f.current&&!f.current.contains(P.target)&&t();},v=P=>{P.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),l&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let P=e.task.assignees||[],M=P.some(J=>J.name===v.name)?P.filter(J=>J.name!==v.name):[...P,{name:v.name,initials:y1(v.name),color:v.color||x1(v.name),avatar:v.avatarUrl}];l({...e.task,assignees:M}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},S=e.type==="task"?w():C(),E={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:E,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:S.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(v1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function v1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Tg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Bg={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},O1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Og({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=react.useState(""),[p,d]=react.useState(null),[m,g]=react.useState(null),y=react.useRef(null),x=l==="es"?Rg.es:Rg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let J=v.getBoundingClientRect();g({top:J.bottom+4,right:window.innerWidth-J.right});}let P=y.current.getBoundingClientRect(),M=window.innerHeight-P.top-20;d(Math.max(300,M));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=L=>{y.current&&!y.current.contains(L.target)&&t();},P=L=>{L.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",P),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",P);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...O1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let P=a.find(L=>L.type===k);return P?.label?P.label:k},b=k=>{if(k==="name")return;let v=a.map(P=>P.id===k?{...P,visible:!P.visible}:P);o(v);},w=(k,v)=>{let P=a.find(M=>M.type===k&&(!v||M.customFieldId===v));if(P){b(P.id);return}let L={id:v||k,type:k,label:v?r.find(M=>M.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,L]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),S=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),E=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>i(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",E);},onFocus:k=>{k.currentTarget.style.borderColor=E,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(M=>M.type===k&&!M.customFieldId),P=v?.visible??false,L=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{L||(v?b(v.id):w(k));},disabled:L,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:L?.4:1,cursor:L?"not-allowed":"pointer"},onMouseEnter:M=>{L||(M.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:P?E:"transparent",border:P?`1.5px solid ${E}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${E}40`:"none"},children:P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:P?E:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:P?500:400,color:P?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),S.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:S.map(k=>{let P=a.find(L=>L.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:L=>{L.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:P?E:"transparent",border:P?`1.5px solid ${E}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:P?`0 0 6px ${E}40`:"none"},children:P&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:P?E:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Bg[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:P?500:400,color:P?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Rg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var _1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function zg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,c]=react.useState("text"),[i,p]=react.useState([""]),d=o==="es"?Hg.es:Hg.en;react.useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let m=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{p([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,p(b);},x=h=>{i.length>1&&p(i.filter((f,b)=>b!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:_1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Hg={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Vg={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Gg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),p=s==="es"?Vg.es:Vg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),p.filters,m&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:p.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function jg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Ka(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function _g({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxRuntime.jsxs("div",{className:u("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:n?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,p=e.totalExecuted??0,d=c-p,m=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(p/c*100),120):0,y=p>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ka(c)})]}),(()=>{let h=e.totalEstimatedLabor??0,f=e.totalEstimatedEquipment??0,b=e.totalEstimatedTravel??0,w=f>0||b>0,C=w?n?`Desglose del estimado:
|
|
414
|
+
\xB7 Mano de obra: ${Ka(h)}
|
|
415
|
+
\xB7 Activos: ${Ka(f)}
|
|
416
|
+
\xB7 Vi\xE1ticos: ${Ka(b)}
|
|
417
|
+
\u2500\u2500\u2500
|
|
418
|
+
Total: ${Ka(i)}`:`Estimated breakdown:
|
|
419
|
+
\xB7 Labor: ${Ka(h)}
|
|
420
|
+
\xB7 Equipment: ${Ka(f)}
|
|
421
|
+
\xB7 Travel: ${Ka(b)}
|
|
422
|
+
\u2500\u2500\u2500
|
|
423
|
+
Total: ${Ka(i)}`:void 0;return jsxRuntime.jsxs("div",{className:u("flex items-center justify-between",w&&"cursor-help"),title:C,children:[jsxRuntime.jsxs("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:[n?"Estimado":"Estimated",w&&jsxRuntime.jsx("span",{className:"ml-1 opacity-50",children:"\u24D8"})]}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ka(i)})]})})(),p>0&&(()=>{let h=e.totalExecutedLabor??0,f=e.totalExecutedEquipment??0,b=e.totalExecutedTravel??0,w=f>0||b>0,C=w?n?`Desglose del ejecutado:
|
|
424
|
+
\xB7 Mano de obra: ${Ka(h)}
|
|
425
|
+
\xB7 Activos: ${Ka(f)}
|
|
426
|
+
\xB7 Vi\xE1ticos: ${Ka(b)}
|
|
427
|
+
\u2500\u2500\u2500
|
|
428
|
+
Total: ${Ka(p)}`:`Executed breakdown:
|
|
429
|
+
\xB7 Labor: ${Ka(h)}
|
|
430
|
+
\xB7 Equipment: ${Ka(f)}
|
|
431
|
+
\xB7 Travel: ${Ka(b)}
|
|
432
|
+
\u2500\u2500\u2500
|
|
433
|
+
Total: ${Ka(p)}`:void 0;return jsxRuntime.jsxs("div",{className:u("flex items-center justify-between",w&&"cursor-help"),title:C,children:[jsxRuntime.jsxs("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:[n?"Ejecutado":"Executed",w&&jsxRuntime.jsx("span",{className:"ml-1 opacity-50",children:"\u24D8"})]}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ka(p)})]})})(),c>0&&jsxRuntime.jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:x}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[d>=0?`+${Ka(d)} ${n?"Disp.":"Avail."}`:`${Ka(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,p=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":p>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:jg(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:jg(i)})]}),i>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${p}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:u("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:u("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxRuntime.jsxs("button",{onClick:()=>s?.(c.id),className:u("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsxRuntime.jsx("span",{className:u("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,p=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!i&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let p=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:p}})})]},`${c.name}-${i}`)})})]})]})}var lw=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function Zg(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(...Zg(r.subtasks,t+1));return a}function dw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function Xn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Xn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Yn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function cw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Jg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function uc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function e0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:S=false,financialBlur:E,healthSidebar:k,lens:v="hours",hourlyRate:P=0,rateMap:L,aggregateParentHours:M=false,showProjectTotals:J=false,totalsDollarOverride:H}=t,Y=Vi(d,m),T=p==="dark",G=F=>{if(!L||!F.assignees||F.assignees.length===0)return P;let se=0,Ce=0;for(let Re of F.assignees){let tt=Re.id?L[Re.id]:void 0;if(tt==null||tt<=0)continue;let me=typeof Re.estimatedMinutes=="number"?Re.estimatedMinutes:0;me>0&&(se+=tt*me,Ce+=me);}if(Ce>0)return se/Ce;let ve=F.assignees.map(Re=>Re.id?L[Re.id]:void 0).filter(Re=>Re!=null&&Re>0);return ve.length===0?P:ve.reduce((Re,tt)=>Re+tt,0)/ve.length},te=F=>{let se=0,Ce=0,ve=0,Re=tt=>{for(let me of tt)if(me.subtasks&&me.subtasks.length>0){let Ke={s:se,a:Ce,q:ve};if(Re(me.subtasks),se-Ke.s+(Ce-Ke.a)+(ve-Ke.q)===0){let yt=G(me);se+=(me.timeLoggedMinutes??0)/60*yt,Ce+=(me.effortMinutes??0)/60*yt,ve+=(me.soldEffortMinutes??0)/60*yt;}}else {let Ke=G(me);se+=(me.timeLoggedMinutes??0)/60*Ke,Ce+=(me.effortMinutes??0)/60*Ke,ve+=(me.soldEffortMinutes??0)/60*Ke;}};return F.subtasks&&Re(F.subtasks),{dollarSpent:se,dollarAllocated:Ce,dollarQuoted:ve}},Le=react.useCallback(()=>{if(!S||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let F=localStorage.getItem(S);if(F){let se=JSON.parse(F);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(F){console.error("Error loading persisted filter:",F);}return {statusFilter:"all",hideCompleted:false}},[S]),B=react.useMemo(()=>{function F(se){let Ce=0,ve=0,Re=0,tt=0,me=0,Ke=0;for(let Ze of se)if(Ze.subtasks&&Ze.subtasks.length>0){let yt=F(Ze.subtasks);if(yt.spent+yt.allocated+yt.quoted>0)Ce+=yt.spent,ve+=yt.allocated,Re+=yt.quoted,tt+=yt.dollarSpent,me+=yt.dollarAllocated,Ke+=yt.dollarQuoted;else {let jt=Ze.timeLoggedMinutes??0,Ut=Ze.effortMinutes??0,na=Ze.soldEffortMinutes??0;Ce+=jt,ve+=Ut,Re+=na;let _t=G(Ze);tt+=jt/60*_t,me+=Ut/60*_t,Ke+=na/60*_t;}}else {let yt=Ze.timeLoggedMinutes??0,oa=Ze.effortMinutes??0,jt=Ze.soldEffortMinutes??0;Ce+=yt,ve+=oa,Re+=jt;let Ut=G(Ze);tt+=yt/60*Ut,me+=oa/60*Ut,Ke+=jt/60*Ut;}return {spent:Ce,allocated:ve,quoted:Re,dollarSpent:tt,dollarAllocated:me,dollarQuoted:Ke}}return F(e)},[e]),q=react.useMemo(()=>{let F=new Map;function se(Ce){let ve=0;for(let Re of Ce)if(Re.subtasks&&Re.subtasks.length>0){let tt=se(Re.subtasks);F.set(Re.id,tt),ve+=tt;}else ve+=Re.weight||0;return ve}return se(e),F},[e]),be=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:B.spent,totalHoursAllocatedMinutes:B.allocated}},[k,B]),[_e,$]=react.useState(true),[ee,le]=react.useState(null),[ke,xe]=react.useState("position"),[Be,He]=react.useState("asc"),[at,ue]=react.useState(""),[je,Xe]=react.useState(()=>Le().statusFilter),[he,kt]=react.useState(()=>Le().hideCompleted),[xt,nt]=react.useState(x||lw),[ze,ct]=react.useState(false),[et,Ee]=react.useState(false),[V,D]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[U,ae]=react.useState(null),[Ne,z]=react.useState(false),[oe,Ge]=react.useState(null),[ge,Ve]=react.useState(null),[Oe,Ue]=react.useState(null),lt=react.useRef(0),ot=react.useRef(false),st=!!(a.onTaskMove||a.onTaskReparent),pt=react.useCallback((F,se)=>{st&&(se.preventDefault(),lt.current=se.clientY,ae(F),ot.current=false,z(false),Ue({x:se.clientX,y:se.clientY}));},[st]),Tt=react.useCallback(F=>{if(!U||(Math.abs(F.clientY-lt.current)>5&&!ot.current&&(ot.current=true,z(true)),Ue({x:F.clientX,y:F.clientY}),!ot.current))return;let Ce=document.querySelectorAll("[data-listview-row]"),ve=null,Re=null;Ce.forEach(tt=>{let me=tt.getBoundingClientRect(),Ke=tt.getAttribute("data-listview-row");if(Ke&&Ke!==U&&F.clientY>=me.top&&F.clientY<=me.bottom){ve=Ke;let Ze=F.clientY-me.top,yt=me.height;Re=Ze<yt*.25?"above":Ze>yt*.75?"below":"child";}}),Ge(ve),Ve(Re);},[U]),Ot=react.useCallback(()=>{if(ot.current&&U&&oe&&ge){if(ge==="child"&&a.onTaskReparent)a.onTaskReparent(U,oe);else if(ge==="above"||ge==="below"){let F=(ve,Re,tt=null)=>{for(let me of ve){if(me.id===Re)return tt;if(me.subtasks){let Ke=F(me.subtasks,Re,me.id);if(Ke!==void 0)return Ke}}},se=F(e,U,null),Ce=F(e,oe,null);if(a.onTaskReparent){let ve=(yt,oa)=>{if(oa===null)return yt;for(let jt of yt){if(jt.id===oa)return jt.subtasks||[];if(jt.subtasks){let Ut=ve(jt.subtasks,oa);if(Ut.length>0||jt.subtasks.some(na=>na.id===oa))return Ut}}return []},Re=ve(e,Ce??null),tt=Re.findIndex(yt=>yt.id===oe),me=se===Ce,Ke=me?Re.findIndex(yt=>yt.id===U):-1,Ze=ge==="below"?tt+1:tt;me&&Ke!==-1&&Ke<tt&&(Ze-=1),a.onTaskReparent(U,Ce??null,Math.max(0,Ze));}}}ae(null),Ge(null),Ve(null),Ue(null),ot.current=false,z(false);},[U,oe,ge,e,a]);react.useEffect(()=>{if(U)return document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",Ot),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",Ot),document.body.style.cursor="",document.body.style.userSelect="";}},[U,Tt,Ot]);let[St,Et]=react.useState("all"),[Ft,mt]=react.useState(false),Vt=react.useRef(null),ht=react.useRef(null),it=react.useMemo(()=>{let F=0;function se(Ce,ve){for(let Re of Ce)ve>F&&(F=ve),Re.subtasks?.length&&se(Re.subtasks,ve+1);}return se(e,1),F},[e]);react.useEffect(()=>{if(!Ft)return;let F=se=>{Vt.current?.contains(se.target)||ht.current?.contains(se.target)||mt(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[Ft]),react.useEffect(()=>{if(St==="all"){let Ce=function(ve){for(let Re of ve)Re.subtasks?.length&&(Re.isExpanded===false&&a.onTaskToggleExpand?.(Re.id),Ce(Re.subtasks));};Ce(e);}else {let Ce=function(ve,Re){for(let tt of ve)if(tt.subtasks?.length){let me=Re<St,Ke=tt.isExpanded!==false;me!==Ke&&a.onTaskToggleExpand?.(tt.id),Ce(tt.subtasks,Re+1);}};Ce(e,1);}},[St]);let[ne,pe]=react.useState(null),[O,_]=react.useState(0),[De,Qe]=react.useState(0),bt=react.useRef(null),[Dt,Pt]=react.useState(null),[At,ta]=react.useState(null);react.useEffect(()=>{x&&nt(F=>{if(F.length===x.length){let se=true;for(let Ce=0;Ce<F.length;Ce++){let ve=F[Ce],Re=x[Ce];if(!ve||!Re||ve.id!==Re.id||ve.visible!==Re.visible||ve.width!==Re.width||ve.label!==Re.label){se=false;break}}if(se)return F}return x});},[x]),react.useEffect(()=>{if(!(!S||typeof window>"u"))try{localStorage.setItem(S,JSON.stringify({statusFilter:je,hideCompleted:he}));}catch(F){console.error("Error persisting filter state:",F);}},[S,je,he]);let la=react.useMemo(()=>{let F=new Set;function se(Ce){for(let ve of Ce)ve.subtasks?.length&&(ve.isExpanded!==false&&F.add(ve.id),se(ve.subtasks));}return se(e),F},[e]),Q=react.useMemo(()=>xt.filter(F=>F.visible),[xt]),$e=react.useCallback(F=>{a.onTaskToggleExpand?.(F);},[a]),Fe=react.useCallback(F=>{ke===F?He(se=>se==="asc"?"desc":"asc"):(xe(F),He("asc")),a.onSortChange?.({column:F,direction:Be==="asc"?"desc":"asc"});},[ke,Be,a]),I=react.useCallback(F=>{nt(F),a.onColumnsChange?.(F);},[a]),ye=react.useCallback(F=>{let se=xt.map(Ce=>Ce.id===F?{...Ce,visible:false}:Ce);I(se);},[xt,I]),Z=react.useCallback((F,se)=>{xe(F),He(se);},[]),N=react.useCallback((F,se,Ce)=>{b&&(F.preventDefault(),D({isOpen:true,x:F.clientX,y:F.clientY,type:se?"task":"header",task:se,columnId:Ce}));},[b]),K=react.useCallback(()=>{D(F=>({...F,isOpen:false}));},[]),Te=react.useCallback((F,se)=>{if(!f)return;F.preventDefault(),F.stopPropagation();let Ce=xt.find(ve=>ve.id===se);Ce&&(pe(se),_(F.clientX),Qe(Ce.width));},[xt,f]);react.useEffect(()=>{if(!ne)return;let F=xt,se=ve=>{let Re=ve.clientX-O,tt=Math.max(50,De+Re);F=F.map(me=>me.id===ne?{...me,width:tt}:me),nt(F);},Ce=()=>{a.onColumnsChange?.(F),pe(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",Ce);}},[ne,O,De,a]);let Pe=react.useCallback((F,se)=>{if(se==="name"){F.preventDefault();return}Pt(se),F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",se),F.currentTarget instanceof HTMLElement&&(F.currentTarget.style.opacity="0.5");},[]),$t=react.useCallback(F=>{F.currentTarget instanceof HTMLElement&&(F.currentTarget.style.opacity="1"),Pt(null),ta(null);},[]),Ct=react.useCallback((F,se)=>{F.preventDefault(),se!=="name"&&(F.dataTransfer.dropEffect="move",ta(se));},[]),Jt=react.useCallback(()=>{ta(null);},[]),Wa=react.useCallback((F,se)=>{if(F.preventDefault(),!Dt||Dt===se||se==="name")return;let Ce=[...xt],ve=Ce.findIndex(me=>me.id===Dt),Re=Ce.findIndex(me=>me.id===se);if(ve===-1||Re===-1)return;let tt=Ce.splice(ve,1);tt[0]&&(Ce.splice(Re,0,tt[0]),I(Ce),Pt(null),ta(null));},[Dt,xt,I]),ya=react.useCallback(async F=>{if(a.onCreateCustomField){let se={...F,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}Ee(false);},[a]),wa=react.useCallback(F=>F.progress===100||F.status==="completed"?"completed":F.progress&&F.progress>0||F.status==="in-progress"?"in-progress":"todo",[]),dr=react.useMemo(()=>{let F=Zg(e);if(at.trim()){let se=at.toLowerCase();F=F.filter(Ce=>Ce.name.toLowerCase().includes(se));}return je!=="all"&&(F=F.filter(se=>wa(se)===je)),he&&(F=F.filter(se=>wa(se)!=="completed")),F.sort((se,Ce)=>{let ve,Re;switch(ke){case "name":ve=se.name.toLowerCase(),Re=Ce.name.toLowerCase();break;case "startDate":ve=se.startDate?.getTime()||0,Re=Ce.startDate?.getTime()||0;break;case "endDate":ve=se.endDate?.getTime()||0,Re=Ce.endDate?.getTime()||0;break;case "progress":ve=se.progress||0,Re=Ce.progress||0;break;case "status":ve=se.status||"todo",Re=Ce.status||"todo";break;case "priority":let tt={urgent:0,high:1,medium:2,low:3,none:4};ve=tt[se.priority]??4,Re=tt[Ce.priority]??4;break;case "position":return 0;default:return 0}return ve<Re?Be==="asc"?-1:1:ve>Re?Be==="asc"?1:-1:0}),F},[e,at,je,he,ke,Be,wa]),Ar=react.useCallback((F,se)=>{let Ce=tt=>{a.onTaskUpdate?.({...F,...tt});},ve=tt=>tt?F.customFields?.find(Ke=>Ke.fieldId===tt)?.value:void 0,Re=(tt,me)=>{if(!tt)return;let Ze=[...F.customFields||[]],yt=Ze.findIndex(oa=>oa.fieldId===tt);yt>=0?Ze[yt]={fieldId:tt,value:me}:Ze.push({fieldId:tt,value:me}),Ce({customFields:Ze});};switch(se.type){case "name":return null;case "status":return jsxRuntime.jsx(Wm,{value:F.status||(F.progress===100?"completed":F.progress&&F.progress>0?"in-progress":"todo"),onChange:me=>{Ce({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:T,locale:d,translations:Y.status});case "priority":return jsxRuntime.jsx(Gm,{value:F.priority,onChange:me=>Ce({priority:me}),isDark:T,locale:d});case "assignees":{let me=F.hasChildren,Ke=F.assignees||[];if(me&&F.subtasks?.length){let Ze=new Map,yt=oa=>{(oa||[]).forEach(jt=>{(jt.assignees||[]).forEach(Ut=>{Ze.has(Ut.name)||Ze.set(Ut.name,Ut);}),jt.subtasks?.length&&yt(jt.subtasks);});};yt(F.subtasks),Ke=Array.from(Ze.values());}else me&&(Ke=[]);return jsxRuntime.jsx(qd,{value:Ke,availableUsers:l,onChange:Ze=>Ce({assignees:Ze}),isDark:T,locale:d,disabled:me})}case "startDate":return jsxRuntime.jsx(_i,{value:F.startDate,onChange:me=>Ce({startDate:me}),isDark:T,locale:d,dateField:"start",startDate:F.startDate,endDate:F.endDate});case "endDate":return jsxRuntime.jsx(_i,{value:F.endDate,onChange:me=>Ce({endDate:me}),isDark:T,locale:d,dateField:"end",startDate:F.startDate,endDate:F.endDate});case "progress":{let me=!!(F.subtasks&&F.subtasks.length>0),Ke=me?Jg(uc(F.subtasks||[])):F.progress||0;return jsxRuntime.jsx(Zm,{value:Ke,onChange:me?void 0:Ze=>{let yt=Ze===100?"completed":Ze>0?"in-progress":"todo";Ce({progress:Ze,status:yt});},isDark:T,disabled:me})}case "tags":return jsxRuntime.jsx(ug,{value:F.tags||[],isDark:T});case "text":return jsxRuntime.jsx(ag,{value:ve(se.customFieldId)||"",onChange:me=>Re(se.customFieldId,me),isDark:T});case "number":return jsxRuntime.jsx(ng,{value:ve(se.customFieldId)||0,onChange:me=>Re(se.customFieldId,me),isDark:T});case "date":let tt=ve(se.customFieldId);return jsxRuntime.jsx(_i,{value:tt?new Date(tt):void 0,onChange:me=>Re(se.customFieldId,me),isDark:T,locale:d});case "dropdown":return jsxRuntime.jsx(sg,{value:ve(se.customFieldId)||"",options:se.options||[],onChange:me=>Re(se.customFieldId,me),isDark:T});case "checkbox":return jsxRuntime.jsx(lg,{value:ve(se.customFieldId)||false,onChange:me=>Re(se.customFieldId,me),isDark:T});case "estimatedTime":{let me=F.status==="completed"||F.progress===100;return jsxRuntime.jsx(Dr,{value:F.estimatedTime,onChange:Ke=>Ce({estimatedTime:Ke}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)})}case "quotedTime":{let me=F.status==="completed"||F.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("quotedTime"));return jsxRuntime.jsx(Dr,{value:F.quotedTime,onChange:Ze=>Ce({quotedTime:Ze}),isDark:T,locale:d,disabled:me,isBlurred:Ke,lens:v,hourlyRate:G(F)})}case "elapsedTime":{let me=F.status==="completed"||F.progress===100,Ke=F.executedDollarsCanonical;return jsxRuntime.jsx(Dr,{value:F.elapsedTime,onChange:Ze=>Ce({elapsedTime:Ze}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F),financialOverride:Ke})}case "effortMinutes":{if(M&&F.subtasks&&F.subtasks.length>0){let{allocated:oa}=Xn(F);if(v==="financial"){let jt=te(F),Ut=Math.round(jt.dollarAllocated),na=Math.round(jt.dollarQuoted),_t=na-Ut;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Ut>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",Ut.toLocaleString("es-CO")]}):null,_t!==0&&Ut>0&&na>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",_t>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[_t>0?"+":"",Math.abs(_t)>=1e3?`$${(_t/1e3).toFixed(1)}K`:`$${_t}`]})]})}return jsxRuntime.jsx(Dr,{value:oa>0?oa:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:P})}let me=F.status==="completed"||F.progress===100,Ke=F.effortMinutes||0,Ze=F.soldEffortMinutes||0,yt=G(F);if(v==="financial"&&yt&&Ke>0&&Ze>0){let oa=Math.round(Ke/60*yt),Ut=Math.round(Ze/60*yt)-oa;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Dr,{value:Ke,onChange:na=>Ce({effortMinutes:na}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)}),Ut!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ut>0?"+":"",Math.abs(Ut)>=1e3?`$${(Ut/1e3).toFixed(1)}K`:`$${Ut}`]})]})}return jsxRuntime.jsx(Dr,{value:Ke,onChange:oa=>Ce({effortMinutes:oa}),isDark:T,locale:d,disabled:me,lens:v,hourlyRate:G(F)})}case "timeLoggedMinutes":{let me=F.executedDollarsCanonical;if(M&&F.subtasks&&F.subtasks.length>0){let{spent:Ze}=Xn(F);return jsxRuntime.jsx(Dr,{value:Ze>0?Ze:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F),financialOverride:me})}let Ke=F.status==="completed"||F.progress===100;return jsxRuntime.jsx(Dr,{value:F.timeLoggedMinutes,onChange:a.onLogTime?Ze=>{a.onLogTime?.(F,Ze);}:void 0,isDark:T,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:Ke,lens:v,hourlyRate:G(F),financialOverride:me})}case "soldEffortMinutes":{if(M&&F.subtasks&&F.subtasks.length>0){let{quoted:Ze}=Xn(F),yt=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:Ze>0?Ze:void 0,isDark:T,locale:d,disabled:true,isBlurred:yt,lens:v,hourlyRate:G(F)})}let me=F.status==="completed"||F.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:F.soldEffortMinutes,onChange:Ze=>Ce({soldEffortMinutes:Ze}),isDark:T,locale:d,disabled:me,isBlurred:Ke,lens:v,hourlyRate:G(F)})}case "scheduleVariance":{let me=F.effortMinutes||0,Ke=F.soldEffortMinutes||0,Ze=F.timeLoggedMinutes||0,yt=me>0||Ke>0||Ze>0;return jsxRuntime.jsx(fg,{startDate:F.startDate,endDate:F.endDate,scheduleVariance:F.scheduleVariance,isDark:T,locale:d,hasTimeAllocated:yt})}case "hoursBar":{if(M&&F.hasChildren){let{spent:me,allocated:Ke,quoted:Ze}=Xn(F),yt=me>Ke&&Ke>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",T?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",yt?"text-[#FF453A]":T?"text-white/80":"text-gray-800"),children:Yn(me)}),Ke>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:T?"text-white/60":"text-gray-600",children:Yn(Ke)})]}),Ze>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:T?"text-amber-400/70":"text-amber-600",children:Yn(Ze)})]})]})}return jsxRuntime.jsx(hg,{task:F,isDark:T,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:G(F)})}case "teamLoad":return F.hasChildren||F.subtasks&&F.subtasks.length>0?jsxRuntime.jsx(xg,{task:F,isDark:T,locale:d}):jsxRuntime.jsx(qd,{value:F.assignees||[],availableUsers:l,onChange:Ke=>{a.onTaskUpdate?.({...F,assignees:Ke});},isDark:T,locale:d});case "blockers":return jsxRuntime.jsx(wg,{blockers:F.blockers,isDark:T,locale:d});case "weight":{let me=q.get(F.id);if(me!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",me>0?T?"text-white/50":"text-gray-400":T?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?`${Number(me.toFixed(2))}%`:"\u2014"});let Ke=F.weight||0;return jsxRuntime.jsx(cw,{value:Ke,onChange:Ze=>Ce({weight:Ze}),isDark:T})}default:return jsxRuntime.jsx("span",{className:u("text-sm",T?"text-white/60":"text-gray-500"),children:"-"})}},[a,T,d,l,Y,M,q]),Zn=react.useCallback(F=>{let Ce={name:Y.columns.name,status:Y.columns.status,priority:Y.columns.priority,assignees:Y.columns.assignees,startDate:Y.columns.startDate,endDate:Y.columns.endDate,progress:Y.columns.progress,tags:Y.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:Y.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:Y.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:Y.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:Y.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:Y.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:Y.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:Y.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:Y.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:Y.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:Y.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:Y.columns.weight||(d==="es"?"Peso":"Weight")}[F.type]||F.label;return typeof Ce=="string"?Ce:String(Ce||F.type)},[Y,d]),Wr=react.useMemo(()=>{let Ce=Q.reduce((Re,tt)=>Re+tt.width,0)+(h?48:0),ve={};for(let Re of Q)ve[Re.id]=`${Re.width/Ce*100}%`;return ve},[Q,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:[Y.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:Y.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:Y.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:bt,className:u(T?"bg-[#0D0D0D]":"bg-white",ne&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",T?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",T?"text-white/60":"text-gray-600"),children:[dr.length," ",Y.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",T?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:at,onChange:F=>ue(F.target.value),placeholder:Y.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",T?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),y&&it>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Vt,onClick:()=>mt(!Ft),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",T?Ft?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ft?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),St==="all"?d==="es"?"Todos":"All":`L${St}`]}),Ft&&jsxRuntime.jsx("div",{ref:ht,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",T?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(it,5)},(F,se)=>({value:se+1,label:`L${se+1}`}))].map(F=>jsxRuntime.jsxs("button",{onClick:()=>{Et(F.value),mt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",T?St===F.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":St===F.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:F.label}),St===F.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(F.value)))})]}),jsxRuntime.jsx(Gg,{value:je,hideCompleted:he,onChange:Xe,onHideCompletedChange:kt,isDark:T,locale:d}),be?.enabled&&be.data&&!_e&&jsxRuntime.jsx("button",{onClick:()=>$(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",T?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&C&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:Y.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",T?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(F=>{let se=F.id!=="name",Ce=At===F.id&&Dt!==F.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",T?"text-white/60":"text-gray-500",se&&"cursor-grab",F.type!=="name"&&"justify-center",Dt===F.id&&"opacity-50",Ce&&(T?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Wr[F.id],minWidth:F.minWidth},draggable:se,onDragStart:se?ve=>Pe(ve,F.id):void 0,onDragEnd:se?$t:void 0,onDragOver:se?ve=>Ct(ve,F.id):void 0,onDragLeave:se?Jt:void 0,onDrop:se?ve=>Wa(ve,F.id):void 0,onContextMenu:ve=>N(ve,void 0,F.id),children:[se&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",T?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),F.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Fe(F.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Zn(F),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",ke===F.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:Zn(F)}),f&&F.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ne===F.id&&"bg-[#007BFF]"),onMouseDown:ve=>Te(ve,F.id)})]},F.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),ct(se=>!se);},className:u("p-0.5 rounded transition-colors",T?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ze&&(T?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Og,{isOpen:ze,onClose:()=>ct(false),columns:xt,customFields:c,onColumnsChange:I,onCreateCustomField:()=>{ct(false),Ee(true);},isDark:T,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:dr.map((F,se)=>{let Ce=la.has(F.id),ve=Math.min(se*.01,.2),Re=F.hasChildren&&F.level===0,tt=F.subtasks?.length||0;if(Re){let{spent:jt,allocated:Ut,quoted:na}=Xn(F),_t=dw(F);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":F.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",T?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ee===F.id&&(T?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(F),children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(Ba=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ba.type!=="name"&&"justify-center"),style:{width:Wr[Ba.id],minWidth:Ba.minWidth},children:Ba.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Nt=>{Nt.stopPropagation(),$e(F.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",T?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",T?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",T?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Nt=>{Nt.stopPropagation(),$e(F.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Ce?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:T?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:T?"#FFD60A":"#B45309"}})}),F.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:T?"#FFD60A":"#B45309"},children:F.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",T?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:F.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",T?"text-white/30":"text-gray-500"),children:["(",tt," ",d==="es"?tt===1?"Tarea":"Tareas":tt===1?"Item":"Items",")"]}),_t!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",_t>=1?"text-[#32D74B] bg-[#32D74B]/10":_t>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",_t.toFixed(2)]})]})]}):Ba.type==="timeLoggedMinutes"?v==="financial"?(()=>{let Nt=F.executedDollarsCanonical,mr=Nt!=null?Math.round(Nt):Math.round(te(F).dollarSpent);return mr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",mr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:jt>0?jt:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Ba.type==="soldEffortMinutes"?v==="financial"?(()=>{let Nt=te(F),mr=Math.round(Nt.dollarQuoted);return mr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",mr.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:na>0?na:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Ba.type==="effortMinutes"?v==="financial"?(()=>{let Nt=te(F),mr=Math.round(Nt.dollarAllocated),To=Math.round(Nt.dollarQuoted),Lr=To-mr;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[mr>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",T?"text-white/60":"text-gray-500"),children:["$",mr.toLocaleString("es-CO")]}):null,Lr!==0&&mr>0&&To>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lr>0?"+":"",Math.abs(Lr)>=1e3?`$${(Lr/1e3).toFixed(1)}K`:`$${Lr}`]})]})})():jsxRuntime.jsx(Dr,{value:Ut>0?Ut:void 0,isDark:T,locale:d,disabled:true,lens:v,hourlyRate:G(F)}):Ar(F,Ba)},Ba.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},F.id)}let me=U===F.id,Ke=oe===F.id,Ze=Ke&&ge==="above",yt=Ke&&ge==="below",oa=Ke&&ge==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":F.id,"data-listview-row":F.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-b transition-colors relative group",T?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ee===F.id&&(T?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:me?.4:1,backgroundColor:oa?T?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:oa?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(F),onDoubleClick:()=>a.onTaskDoubleClick?.(F),onContextMenu:jt=>N(jt,F),children:[Ze&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),yt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),st&&jsxRuntime.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:jt=>pt(F.id,jt),style:{color:T?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Q.map(jt=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",jt.type!=="name"&&"justify-center"),style:{width:Wr[jt.id],minWidth:jt.minWidth},children:jt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&F.level>0&&jsxRuntime.jsx("div",{style:{width:`${F.level*24}px`},className:"flex-shrink-0"}),y&&F.hasChildren&&jsxRuntime.jsx("button",{onClick:Ut=>{Ut.stopPropagation(),$e(F.id);},className:u("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",T?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",T?"text-white/60":"text-gray-400")})}),y&&!F.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(F.wbsCode||F.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[F.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",T?"text-[#007BFF]":"text-blue-600"),children:F.wbsCode}),F.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",T?"text-white/40":"text-gray-400"),children:F.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate",F.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",F.progress===100?T?"line-through text-white/50":"line-through text-gray-400":F.hasChildren?T?"text-white":"text-gray-900":T?"text-[#D1D5DB]":"text-gray-600"),children:F.name}),F.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${F.tags[0].color}20`,color:F.tags[0].color},children:F.tags[0].name})]})]}):Ar(F,jt)},jt.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},F.id)})}),J&&dr.length>0&&(()=>{let{spent:F,allocated:se,quoted:Ce}=B,ve=se-F,Re=ve<0,tt=Re?`+${Yn(Math.abs(ve))} ${d==="es"?"EXCEDIDO":"OVER"}`:`+${Yn(ve)} ${d==="es"?"AHORRADO":"SAVED"}`,me=v==="financial"&&P>0,Ke=H?.spent!=null?H.spent:B.dollarSpent,Ze=H?.allocated!=null?H.allocated:B.dollarAllocated,yt=H?.quoted!=null?H.quoted:B.dollarQuoted,oa=(na,_t)=>{if(me){let Ba=_t??na/60*P;return `$${Math.round(Ba).toLocaleString("es-CO")}`}return Yn(na)},jt=me?Math.abs(Ze-Ke):0,Ut=me?`+$${jt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Re?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:tt;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",T?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:T?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[st&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Q.map(na=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3",na.type!=="name"&&"justify-center"),style:{width:Wr[na.id],minWidth:na.minWidth},children:na.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):na.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(F,me?Ke:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(se,me?Ze:void 0)})]}),se>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Re?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:me?Ut:tt})]}):na.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ce>0?oa(Ce,me?yt:void 0):"\u2013"}):na.type==="effortMinutes"?(()=>{if(me&&Ce>0&&se>0){let _t=Math.round(yt),Ba=Math.round(Ze),Nt=_t-Ba,mr=_t>0?Math.round(Nt/_t*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oa(se,Ze)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Nt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Nt>=0?"+":"",Math.abs(Nt)>=1e3?`$${(Nt/1e3).toFixed(1)}K`:`$${Nt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",mr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?oa(se,me?Ze:void 0):"\u2013"})})():na.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",T?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:F>0?oa(F,me?Ke:void 0):"\u2013"}):na.type==="progress"?(()=>{let _t=Jg(uc(e||[]));return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",T?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_t,"%"]})})():na.type==="weight"?(()=>{let _t=e||[],Ba=[],Nt=No=>{for(let Do of No)Ba.push(Do),Do.subtasks?.length&&Nt(Do.subtasks);};Nt(_t);let To=Ba.filter(No=>!No.subtasks?.length||No.subtasks.length===0).reduce((No,Do)=>No+(Do.weight||0),0),Lr=Math.abs(To-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",Lr?T?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(To.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",T?"text-white/30":"text-gray-300"),children:"\u2013"})},na.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),dr.length===0&&at&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",T?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(T?"text-white/60":"text-gray-600"),children:Y.empty.noResults})]})})]})}),be?.enabled&&be.data&&_e&&jsxRuntime.jsx(_g,{data:be.data,isDark:T,locale:d,onClose:()=>$(false),lens:t?.lens,onUnassignedTaskClick:F=>{let se=document.querySelector(`[data-task-id="${F}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),le(F),setTimeout(()=>le(null),2e3));}})]}),jsxRuntime.jsx(Sg,{state:V,onClose:K,isDark:T,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ye,onColumnSort:Z,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ne&&Oe&&U&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Oe.x+12,top:Oe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Se.flattenTasks(e).find(Ce=>Ce.id===U);return se?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:T?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${T?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsxRuntime.jsx(zg,{isOpen:et,onClose:()=>Ee(false),onSave:ya,isDark:T,locale:d})]})}var t0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],a0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],r0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var pc={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},mc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},gc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Zi={dark:pc,light:mc,neutral:gc};function o0(e){return Zi[e]||Zi.dark}var fc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},bc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},el={en:fc,es:bc};function Ls(e){return el[e]||el.en}function tl(e,t){let a=Ls(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 n0(e){let t=Ls(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 s0(e,t=0,a=true){let r=Ls(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 Bs(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 yc(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 d0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var p0=26,yw=22,xw=10;function c0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function xc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function m0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function u0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function vw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",h=m?xc(c.effortMinutes,n,l):null,f=m?m0(c,n,l):null,b=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${p*p0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${yw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function g0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:S,onUpdateEstimate:E,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:P,onDiscardTimer:L,blurFinancials:M=false,suppressDetailModal:J=false,lens:H="hours",hourlyRate:Y=0}){let{theme:T="dark",locale:G="en",customTranslations:te,showBacklog:Le=true}=t,B=tl(G,te),q=T==="dark"||T==="neutral",[be,_e]=react.useState(r||new Date),[$,ee]=react.useState(null),[le,ke]=react.useState(null),[xe,Be]=react.useState(null),[He,at]=react.useState({}),ue=3,je=3,Xe=react.useCallback(z=>{ke(z.id),J||ee(z),h?.(z.id);},[J,h]),[he,kt]=react.useState(null),xt=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()-1,1));},[be]),nt=react.useCallback(()=>{_e(new Date(be.getFullYear(),be.getMonth()+1,1));},[be]),ze=react.useCallback(()=>{_e(new Date);},[]),ct=react.useMemo(()=>{let z=be.getFullYear(),oe=be.getMonth(),Ge=new Date(z,oe,1),ge=new Date(z,oe+1,0),Ve=Ge.getDay(),Oe=ge.getDate(),Ue=Bs(e),lt=new Date;lt.setHours(0,0,0,0);let ot=[],st=Ve,pt=new Date(z,oe,0).getDate();for(let Ot=st-1;Ot>=0;Ot--){let St=new Date(z,oe-1,pt-Ot);ot.push({date:St,isCurrentMonth:false,isToday:false,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Et=>yc(St,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}for(let Ot=1;Ot<=Oe;Ot++){let St=new Date(z,oe,Ot),Et=St.getTime()===lt.getTime();ot.push({date:St,isCurrentMonth:true,isToday:Et,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Ft=>yc(St,Ft)).map(Ft=>({id:Ft.id,title:Ft.name,start:Ft.startDate,end:Ft.endDate,task:Ft}))});}let Tt=42-ot.length;for(let Ot=1;Ot<=Tt;Ot++){let St=new Date(z,oe+1,Ot);ot.push({date:St,isCurrentMonth:false,isToday:false,isWeekend:St.getDay()===0||St.getDay()===6,events:Ue.filter(Et=>yc(St,Et)).map(Et=>({id:Et.id,title:Et.name,start:Et.startDate,end:Et.endDate,task:Et}))});}return ot},[be,e]),et=react.useMemo(()=>Bs(e).filter(z=>!z.startDate||!z.endDate),[e]),Ee=react.useMemo(()=>{let z=Bs(e),oe=0,Ge=0,ge=0,Ve=0,Oe=0;z.forEach(pt=>{pt.effortMinutes&&(oe+=pt.effortMinutes),pt.soldEffortMinutes&&(Ge+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(ge+=pt.scheduleVariance,Ve++),pt.soldEffortMinutes&&pt.effortMinutes&&(Oe+=pt.soldEffortMinutes-pt.effortMinutes);});let Ue=Ge>0?Math.min(100,Math.round(oe/Ge*100)):0,lt=Ve>0?Math.round(ge/Ve):0,st=`${Oe<0?"-":"+"}${u0(Oe,H,Y)}`;return {budgetUtil:Ue,avgVariance:lt,costDisplay:st,hasCostData:Ge>0}},[e,H,Y]),V=react.useMemo(()=>{let z=[0,0,0,0,0,0];return ct.forEach((oe,Ge)=>{let ge=Math.floor(Ge/7);oe.events.forEach(Ve=>{if(Ve.task.startDate&&Ve.task.soldEffortMinutes){let Oe=new Date(Ve.task.startDate),Ue=oe.date;Oe.getFullYear()===Ue.getFullYear()&&Oe.getMonth()===Ue.getMonth()&&Oe.getDate()===Ue.getDate()&&ge<z.length&&(z[ge]-=Ve.task.soldEffortMinutes);}});}),z},[ct]),D=react.useMemo(()=>{let z=Bs(e),oe=new Map,Ge=new Set,ge=[0,0,0,0,0,0];if(ct.length===0)return {segmentsByCell:oe,multiDayTaskIds:Ge,maxLanesPerRow:ge};let Ve=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Oe=Ve(ct[0].date),Ue=Ve(ct[ct.length-1].date),lt=[];for(let st of z){if(!st.startDate||!st.endDate)continue;let pt=Ve(st.startDate),Tt=Ve(st.endDate);if(pt.getTime()===Tt.getTime()||Tt<Oe||pt>Ue)continue;let Ot=pt<Oe?Oe:pt,St=Tt>Ue?Ue:Tt,Et=c0(Ot,Oe),Ft=c0(St,Oe);Et<0||Et>41||Ft<0||Ft>41||Et!==Ft&&(Ge.add(st.id),lt.push({task:st,startIdx:Et,endIdx:Ft}));}lt.sort((st,pt)=>st.startIdx!==pt.startIdx?st.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(st.endIdx-st.startIdx));let ot=[[],[],[],[],[],[]];for(let{task:st,startIdx:pt,endIdx:Tt}of lt){let Ot=Math.floor(pt/7),St=Math.floor(Tt/7),Et=Ve(st.startDate),Ft=Ve(st.endDate),mt=false;for(let Vt=Ot;Vt<=St;Vt++){let ht=Vt===Ot?pt%7:0,it=Vt===St?Tt%7:6,ne=it-ht+1,pe=0,O=ot[Vt]??[];for(ot[Vt]||(ot[Vt]=O);pe<O.length&&(O[pe]??-1)>=ht;)pe++;if(pe>=xw){mt=true;break}pe>=O.length?O.push(it):O[pe]=it,ge[Vt]=Math.max(ge[Vt]??0,pe+1);let _=Vt===Ot&&Et>=Oe,De=Vt===St&&Ft<=Ue,Qe=Vt*7+ht,bt={taskId:st.id,task:st,rowIndex:Vt,startCol:ht,endCol:it,spanCols:ne,lane:pe,isStart:_,isEnd:De};oe.has(Qe)||oe.set(Qe,[]),oe.get(Qe).push(bt);}mt&&(Ge.delete(st.id),oe.forEach((Vt,ht)=>{let it=Vt.filter(ne=>ne.taskId!==st.id);it.length===0?oe.delete(ht):oe.set(ht,it);}));}return {segmentsByCell:oe,multiDayTaskIds:Ge,maxLanesPerRow:ge}},[ct,e]),U=G==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ae=be.toLocaleDateString(G==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ne=ae.charAt(0).toUpperCase()+ae.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",q?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",q?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",q?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",q?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",q?"bg-[#050505]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",q?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",q?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",q?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",q?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",q?"bg-[#050505]":"bg-white",n),style:l,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",q?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",q?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",q?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",q?"text-white":"text-gray-900"),children:G==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",q?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:xt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",q?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",q?"text-white":"text-gray-900"),children:Ne}),jsxRuntime.jsx("button",{onClick:nt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",q?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",q?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:ze,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",q?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",q?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:U.map(z=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",q?"text-white/60 font-mono":"text-gray-500"),children:z},z))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",q?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>ke(null),children:ct.map((z,oe)=>{let Ge=oe%7===6,ge=oe>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ge&&(q?"border-r border-[#222]":"border-r border-gray-200"),!ge&&(q?"border-b border-[#222]":"border-b border-gray-200"),q?z.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":z.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",z.isToday&&q&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",z.isToday&&!q&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",z.isToday?q?"text-[#007FFF] font-bold":"text-blue-600 font-bold":z.isCurrentMonth?q?"text-white/60":"text-gray-900":q?"text-white/20":"text-gray-400"),children:String(z.date.getDate()).padStart(2,"0")}),(()=>{let Ve=Math.floor(oe/7),Oe=(D.maxLanesPerRow[Ve]??0)*p0,Ue=D.segmentsByCell.get(oe);return Oe===0&&!Ue?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Oe}px`,zIndex:5},children:Ue?.map(lt=>jsxRuntime.jsx(vw,{segment:lt,isDark:q,blurFinancials:M,isSelected:le===lt.taskId,t:B,lens:H,hourlyRate:Y,onClick:()=>{Xe(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let Ve=z.events.filter(Oe=>Oe.task.isMilestone&&!D.multiDayTaskIds.has(Oe.id));return Ve.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ve.slice(0,4).map(Oe=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Oe.title,onClick:Ue=>{Ue.stopPropagation(),Xe(Oe.task);}},Oe.id)),Ve.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",q?"text-white/30":"text-gray-400"),children:["+",Ve.length-4]})]})})(),(()=>{let Ve=[];z.events.forEach(Ue=>{Ue.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&Ve.push({taskId:Ue.id,type:lt.type,severity:lt.severity,variance:Ue.task.scheduleVariance});});});let Oe=Ve[0];return Oe?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Oe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Oe.type,Oe.variance?` (+${Math.abs(Oe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let Ve=z.events.filter(ot=>!D.multiDayTaskIds.has(ot.id)),Oe=He[oe]||ue,Ue=Ve.slice(0,Oe),lt=Ve.length-Oe;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ue.map(ot=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{Xe(ot.task),a.onEventClick?.(ot);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ot.task.progress===100||ot.task.status==="completed"?q?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":q?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:q?ot.task.progress===100||ot.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ot.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",ot.task.isMilestone?q?"text-amber-400":"text-amber-600":ot.task.isCriticalPath?"text-red-400":q?"text-[#1264FF]":"text-gray-400"),children:ot.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ot.title})]},ot.id)),lt>0&&jsxRuntime.jsxs("button",{onClick:ot=>{ot.stopPropagation(),at(st=>({...st,[oe]:Oe+je}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",q?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",G==="es"?"m\xE1s":"more"]}),Oe>ue&&Ve.length>ue&&jsxRuntime.jsx("button",{onClick:ot=>{ot.stopPropagation(),at(st=>({...st,[oe]:ue}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",q?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:G==="es"?"menos":"less"})]})})(),z.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ve=oe>=28,Oe=oe%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ue=>{Ue.stopPropagation(),kt(he===oe?null:oe);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",he===oe?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",q?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",he===oe&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he===oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>kt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ve?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ve?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ve?"bottom-full mb-1":"top-full mt-1",Oe?"right-0":"left-0",q?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(rn,{onSubmit:Ue=>{a.onTaskCreate?.({name:Ue.name,startDate:Ue.startDate||z.date,endDate:Ue.endDate||z.date,priority:Ue.priority,assignees:Ue.assignee?[Ue.assignee]:void 0}),kt(null);},onCancel:()=>kt(null),availableUsers:t.availableUsers,isDark:q,locale:G==="es"?"es":"en",defaultDate:z.date,dropdownDirection:Ve?"up":"down"})})]})})]})})()}),oe%7===6&&(()=>{let Ve=Math.floor(oe/7),Oe=V[Ve];if(!Oe||Oe===0)return null;let Ue=u0(Oe,H,Y);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Oe<0?"text-red-400":"text-emerald-400",M&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Oe<0?"-":"+",Ue]})})()]},oe)})})})]}),Le&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",q?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",q?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",q?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",q?"text-white/20":"text-gray-400"),children:et.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:et.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",q?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",q?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",q?"text-white/20":"text-gray-400"),children:G==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):et.map(z=>jsxRuntime.jsxs("button",{onClick:()=>{Xe(z);},className:u("w-full text-left rounded-md p-3 transition-all group/card",q?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",q?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",q?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:z.name})]}),z.tags&&z.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[z.tags.slice(0,3).map(oe=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${oe.color}15`,color:oe.color,border:`1px solid ${oe.color}30`},children:oe.name},oe.id)),z.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",q?"text-white/20":"text-gray-400"),children:["+",z.tags.length-3]})]}),(z.effortMinutes||z.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",q?"text-white/25":"text-gray-400",M&&"blur-sm select-none"),children:[xc(z.effortMinutes,H,Y)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",xc(z.effortMinutes,H,Y)]}),(()=>{let oe=m0(z,H,Y);return oe?jsxRuntime.jsx("span",{className:oe.isNegative?"text-red-400":"text-emerald-400",children:oe.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[z.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",z.priority==="urgent"||z.priority==="high"?"text-red-400":z.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(d0,{task:z,isDark:q})]}),z.assignees&&z.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,2).map((oe,Ge)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:oe.color||"#007FFF"},title:oe.name,children:oe.initials||oe.name?.slice(0,2).toUpperCase()},Ge))})]})]},z.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",q?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",q?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:z=>{z.key==="Enter"&&z.target.value.trim()&&(a.onTaskCreate?.({name:z.target.value.trim()}),z.target.value="");}})}),Ee.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",q?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",q?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",q?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",q?"text-white/60":"text-gray-700",M&&"blur-sm select-none"),children:[Ee.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",q?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ee.budgetUtil}%`,background:Ee.budgetUtil>90?"#EF4444":Ee.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",q?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",q?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Ee.avgVariance>0?"text-emerald-400":Ee.avgVariance<0?"text-red-400":q?"text-white/50":"text-gray-600"),children:[Ee.avgVariance>0?"+":"",Ee.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",q?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",q?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",Ee.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",M&&"blur-sm select-none"),children:Ee.costDisplay})]})]})]})]})]}),!J&&jsxRuntime.jsx(ho,{task:$,isOpen:!!$,onClose:()=>ee(null),onTaskUpdate:z=>{a.onTaskUpdate?.(z),ee(z);},theme:T==="dark"?"dark":"light",locale:G,availableUsers:t.availableUsers?.map(z=>({id:z.id,name:z.name,avatar:z.avatar,initials:z.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:$?p?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Bs(e).filter(z=>z.id!==$?.id),comments:d?.filter(z=>z.taskId===$?.id).map(z=>({...z,createdAt:z.createdAt instanceof Date?z.createdAt:new Date(z.createdAt),updatedAt:z.updatedAt instanceof Date?z.updatedAt:z.updatedAt?new Date(z.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:S,onEstimateUpdate:E,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:P,onTimerDiscard:L,blurFinancials:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Be(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",q?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",q?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",q?"text-white/90":"text-gray-900"),children:xe.date.toLocaleDateString(G==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Be(null),className:u("p-1 rounded",q?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:xe.events.map(z=>jsxRuntime.jsxs("button",{onClick:()=>{Be(null),Xe(z.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",q?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(d0,{task:z.task,isDark:q}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",q?"text-white/80":"text-gray-900"),children:z.title}),(z.task.priority==="high"||z.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},z.id))})]})]})})]})}var vc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},wc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},kc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},ol={dark:vc,light:wc,neutral:kc};function f0(e){return ol[e]||ol.dark}function kw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,y=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,x=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[p]),m=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var h0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Os(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 $s(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 y0(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 x0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=react.useMemo(()=>({...h0,...n}),[n]),[i,p]=react.useState(new Set),d=react.useRef(null),m=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],S=b.get(C);S?S.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((S,E)=>E.timestamp.getTime()-S.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{p(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),S=Math.floor(C/6e4),E=Math.floor(C/36e5),k=Math.floor(C/864e5);return S<1?"just now":S<60?`${S}m ago`:E<24?`${E}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=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&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[$s(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.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})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:m.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.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((w,C)=>{let S=i.has(w.id),E=s===w.id,k=y0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",S&&"expanded",E&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:$s(w.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Os(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[S?"\u25BC":"\u25B6"," Show changes"]}),S&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(P.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(P.to)})]})]},v)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([v,P])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(P)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function w0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&$s(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Os(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:Os(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Cc(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 Tc(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 k0(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 C0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ew(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,x=p.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);p.vx+=y/h*f,p.vy+=x/h*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,y=m.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,m.vx-=g*h,m.vy-=y*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function T0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=react.useRef(null),[p,d]=react.useState([]),[m,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(1),[C,S]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=Ew(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let E=react.useCallback((H,Y)=>{a.enableDragging&&(Y.stopPropagation(),g(H));},[a.enableDragging]),k=react.useCallback(H=>{if(!m||!i.current)return;let T=i.current.getBoundingClientRect(),G=(H.clientX-T.left-C.x)/b,te=(H.clientY-T.top-C.y)/b;d(Le=>Le.map(B=>B.id===m?{...B,x:G,y:te,fx:G,fy:te}:B));},[m,b,C]),v=react.useCallback(()=>{g(null);},[]),P=react.useCallback((H,Y)=>{Y.stopPropagation(),l?.({type:"node-click",node:H,position:{x:Y.clientX,y:Y.clientY}});},[l]),L=react.useCallback((H,Y)=>{Y.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:Y.clientX,y:Y.clientY}});},[l]),M=react.useCallback(H=>{let Y=p.find(T=>T.id===H);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[p]),J=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Y=H.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),S({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Cc(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[k0(H)," ",Tc(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let Y=M(typeof H.source=="string"?H.source:H.source.id),T=M(typeof H.target=="string"?H.target:H.target.id),G=C0(H.type),te=h===H.id,Le=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",te&&"hovered",Le&&"critical"),onMouseEnter:()=>f(H.id),onMouseLeave:()=>f(null),onClick:B=>L(H,B),children:[jsxRuntime.jsx("line",{x1:Y.x,y1:Y.y,x2:T.x,y2:T.y,stroke:Cc(H.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:te?1:.6,markerEnd:G?"url(#arrowhead)":void 0}),a.showEdgeLabels&&te&&jsxRuntime.jsx("text",{x:(Y.x+T.x)/2,y:(Y.y+T.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Tc(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(H=>{let Y=y===H.id,T=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",Y&&"hovered",T&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:G=>E(H.id,G),onMouseEnter:()=>x(H.id),onMouseLeave:()=>x(null),onClick:G=>P(H,G),children:[jsxRuntime.jsx("circle",{r:T?a.nodeSize*1.2:a.nodeSize,fill:J(H),stroke:T?"#fbbf24":"#ffffff",strokeWidth:T?3:2,opacity:Y?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function S0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,c]=react.useState(false),[i,p]=react.useState(null),[d,m]=react.useState(null),g=react.useRef(null),y=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),p(null),m(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),p(null),m(null);try{let b=await r(s.trim());m(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children: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})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Nc={"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 Fw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Pw={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 Aw(e,t,a){let r=Nc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Hs(e){return `$${e.toFixed(4)}`}var Dc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Aw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},gn=new Dc;function F0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(gn.getStats()),[s,n]=react.useState(gn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(gn.getStats()),n(gn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=gn.getRecentOperations(5);return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Hs(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Hs(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Hs(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function L0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[c,i]=react.useState(""),[p,d]=react.useState(""),[m,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(null),C=react.useRef(null),S=m||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let L=M=>{M.key==="Escape"&&!S&&E();};if(e)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,S]);let E=()=>{S||(l(""),i(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||S)){g(true),x(null),f(null),w(null);try{let L=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});f(L.tasks.tasks),w({from_cache:L.from_cache,tokens_used:L.tokens_used,mock_mode:L.mock_mode,similarity:L.similarity,tokens_saved:L.tokens_saved});}catch(L){x(L instanceof Error?L.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),E());};if(!e)return null;let P=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Zt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:E}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:E,disabled:S,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:h?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 (",P,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((L,M)=>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:["#",M+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:L.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),L.start," \u2192 ",L.end]}),jsxRuntime.jsxs("span",{children:[L.duration," days"]}),L.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",L.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${L.priority==="high"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:L.priority})]})},L.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:n,onChange:L=>l(L.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:S}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:L=>i(L.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]}),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:L=>d(L.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((L,M)=>jsxRuntime.jsx("button",{onClick:()=>l(L),disabled:S,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:L},M))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:S&&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:E,disabled:S,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"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||S,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:S?"Generating...":"Generate Tasks"})]})]})]})})]})}function il({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Xs(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(L=>L.id===h);if(!C)return w;let S=C.columnId,E={...C,columnId:f,position:b},k=w.cards.map(L=>L.id===h?E:L),v=w.columns.map(L=>{if(L.id===S)return {...L,cardIds:L.cardIds.filter(M=>M!==h)};if(L.id===f){let M=k.filter(J=>J.columnId===f).sort((J,H)=>J.position-H.position);return {...L,cardIds:M.map(J=>J.id)}}return L}),P={...w,cards:k,columns:v};return o(P),P});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(S=>S.id===h?{...S,...f}:S),C={...b,cards:w};return o(C),C});},[o]),l=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(E=>E.id===h.columnId?{...E,cardIds:[...E.cardIds,f]}:E),S={...b,cards:[...b.cards,w],columns:C};return o(S),S});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(E=>E.id===h);if(!b)return f;let w=f.cards.filter(E=>E.id!==h),C=f.columns.map(E=>E.id===b.columnId?{...E,cardIds:E.cardIds.filter(k=>k!==h)}:E),S={...f,cards:w,columns:C};return o(S),S});},[o]),i=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),p=react.useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(S=>S.id===h?{...S,...f}:S),C={...b,columns:w};return o(C),C});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(S=>S.columnId!==h),w=f.columns.filter(S=>S.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),m=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function B0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=il({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var zs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},O0={by:"none",order:"asc"};function $0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...zs,...e}),[s,n]=react.useState({...O0,...t}),l=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),i=react.useCallback(()=>{o(zs),n(O0);},[]),p=react.useCallback(()=>{a&&o({...zs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...zs,dateFilter:"overdue"});},[]),m=react.useCallback(()=>{o({...zs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),S=`${b}-${w}-${C}`;h=h.filter(E=>{if(!E.endDate&&!E.dueDate)return false;let k=E.endDate||E.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let P=k.getUTCFullYear(),L=String(k.getUTCMonth()+1).padStart(2,"0"),M=String(k.getUTCDate()).padStart(2,"0");v=`${P}-${L}-${M}`;}switch(r.dateFilter){case "overdue":return v<S;case "today":return v===S;case "this-week":let P=new Date(S+"T00:00:00"),L=new Date(v+"T00:00:00"),M=new Date(P);return M.setDate(M.getDate()+7),L>=P&&L<=M;case "custom":if(r.dateRange){let J=typeof k=="string"?new Date(k):k;return J>=r.dateRange.start&&J<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,S=b.createdAt?new Date(b.createdAt).getTime():0;w=C-S;break;case "priority":let E={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=E[f.priority||"LOW"],v=E[b.priority||"LOW"];w=k-v;break;case "dueDate":let P=f.endDate||f.dueDate,L=b.endDate||b.dueDate;if(!P)return 1;if(!L)return -1;let M=typeof P=="string"?new Date(P).getTime():P.getTime(),J=typeof L=="string"?new Date(L).getTime():L.getTime();w=M-J;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let H=f.estimatedTime||0,Y=b.estimatedTime||0;w=H-Y;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var z0,U0;if(typeof window<"u")try{let e=Ks("ai");z0=e.generateObject,U0=e.generateText;}catch{}function W0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(z0&&U0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Ec(){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 V0(e){let{cards:t}=e,[a,r]=Ec(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,P)=>v.position-P.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,S]=b<w?[b,w]:[w,b],E=f.slice(C,S+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...E]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:p}}var G0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function j0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...G0,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(S=>S.columnId===f).length,createdAt:new Date};n(S=>[...S,C]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),i=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),p=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),m=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(S=>S.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(S=>{S.labels&&S.labels.length>0&&S.labels.forEach(E=>{b.has(E)||b.set(E,[]),b.get(E).push(S);});}),b.forEach((S,E)=>{S.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${E}`,cardIds:S.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${S.length} cards with label "${E}"`,confidence:.85});});let w=new Map;h.forEach(S=>{S.assignedUserIds&&S.assignedUserIds.length>0&&S.assignedUserIds.forEach(E=>{w.has(E)||w.set(E,[]),w.get(E).push(S);});}),w.forEach((S,E)=>{S.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${E.slice(-4)}`,cardIds:S.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${S.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(S=>{S.priority&&(C.has(S.priority)||C.set(S.priority,[]),C.get(S.priority).push(S));}),C.forEach((S,E)=>{if(S.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[E.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${E} Priority`,cardIds:S.map(v=>v.id),columnId:x,strategy:"priority",color:E==="high"||E==="urgent"?"#ef4444":"#10b981"},reason:`${S.length} cards with ${E} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let S of h){let k=(await r.findSimilar(S,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[S.id,...k.map(L=>L.card.id)],P=k.reduce((L,M)=>L+M.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${S.title.substring(0,30)}${S.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:P});}}return f.filter(S=>S.confidence>=o.autoStackConfidenceThreshold).sort((S,E)=>E.confidence-S.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var _0=react.createContext(null);function K0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=Ks("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ks("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ks("@libxai/core");l=new c(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(_0.Provider,{value:{store:o},children:e})}function ll(){let e=react.useContext(_0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ws(){let e=ll(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),i=react.useCallback((b,w)=>{e.updateColumn(b,w);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),m=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function Y0(e){let{cards:t}=Ws();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 X0(e="position",t="asc"){let{cards:a}=Ws();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var dl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=lu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Yw=new dl;function Q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:m,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Z0(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 tf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:l}),m=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:m.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function af(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 rf(e,t=10){return e>t}var Ac={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Bc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Oc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$c={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Hc={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)"},zc={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)"},Uc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Vc={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}},cl={spacing:Ac,borderRadius:Lc,fontSize:Ic,fontWeight:Bc,lineHeight:Rc,zIndex:Oc,duration:$c,easing:Hc,shadows:zc,opacity:Uc,kanban:Wc,gantt:Vc};function of(e,t,a){return e[t]??a}function Gc(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)?Gc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function jc(e="asakaa"){let t=Gc(cl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Qw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
434
|
${a.join(`
|
|
415
435
|
`)}
|
|
416
436
|
}`}function Vs(e,t="asakaa"){let a=[],r=Gc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
@@ -439,6 +459,6 @@ ${Vs(Kc,"asakaa").split(`
|
|
|
439
459
|
`).slice(1,-1).join(`
|
|
440
460
|
`)}
|
|
441
461
|
}
|
|
442
|
-
`}var Zw=({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 sf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=
|
|
443
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=F0;exports.AI_FEATURES=Pw;exports.AI_MODELS=Nc;exports.AddCardButton=Kl;exports.AddColumnButton=Wl;exports.AttachmentUploader=
|
|
462
|
+
`}var Zw=({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 sf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=An();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Zw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
463
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=F0;exports.AI_FEATURES=Pw;exports.AI_MODELS=Nc;exports.AddCardButton=Kl;exports.AddColumnButton=Wl;exports.AttachmentUploader=lo;exports.BoardProvider=K0;exports.BulkOperationsToolbar=xi;exports.BurnDownChart=nd;exports.CUSTOM_FIELD_TYPES=r0;exports.CalendarBoard=g0;exports.Card=fo;exports.CardDetailModal=Zl;exports.CardDetailModalV2=ad;exports.CardHistoryReplay=w0;exports.CardHistoryTimeline=x0;exports.CardRelationshipsGraph=T0;exports.CardStack=kw;exports.CardTemplateSelector=pd;exports.CircuitBreaker=wl;exports.Column=Nn;exports.ColumnManager=Ni;exports.CommandPalette=Xl;exports.ConfigMenu=bd;exports.ContextMenu=Rn;exports.DEFAULT_SHORTCUTS=bs;exports.DEFAULT_TABLE_COLUMNS=t0;exports.DEFAULT_TEMPLATES=ud;exports.DateRangePicker=as;exports.DependenciesSelector=os;exports.DependencyLine=Cs;exports.DistributionCharts=sd;exports.EditableColumnTitle=Ml;exports.ErrorBoundary=En;exports.ExportDropdown=em;exports.ExportImportModal=gd;exports.FilterBar=fd;exports.GANTT_AI_SYSTEM_PROMPT=Lm;exports.GanttAIAssistant=$i;exports.GanttBoard=Mm;exports.GanttI18nContext=In;exports.GanttMilestone=Li;exports.GanttToolbar=Ti;exports.GenerateGanttTasksDialog=L0;exports.GeneratePlanModal=S0;exports.GroupBySelector=dd;exports.HealthBar=Bl;exports.KanbanBoard=Bo;exports.KanbanToolbar=zl;exports.KanbanViewAdapter=ms;exports.KeyboardShortcutsHelp=cd;exports.ListView=e0;exports.MenuIcons=ma;exports.PluginManager=dl;exports.PrioritySelector=Qo;exports.ProfitabilityReport=Rl;exports.QuickTaskCreate=rn;exports.RATE_LIMITS=Fw;exports.STANDARD_FIELDS=a0;exports.SwimlaneBoardView=id;exports.TagBadge=Pl;exports.TagList=ju;exports.TagPicker=Ao;exports.TaskBar=Ei;exports.TaskDetailModal=ho;exports.TaskFormModal=Am;exports.TaskGrid=Si;exports.ThemeModal=vd;exports.ThemeProvider=Wp;exports.ThemeSwitcher=sf;exports.TimeInputPopover=no;exports.TimePill=Al;exports.TimePopover=Ll;exports.Timeline=Bi;exports.UserAssignmentSelector=en;exports.VelocityChart=od;exports.VirtualGrid=tf;exports.VirtualList=Q0;exports.aiUsageTracker=gn;exports.borderRadius=Lc;exports.calculatePosition=Ys;exports.calendarDarkTheme=vc;exports.calendarEnTranslations=fc;exports.calendarEsTranslations=bc;exports.calendarLightTheme=wc;exports.calendarNeutralTheme=kc;exports.calendarThemes=ol;exports.calendarTranslations=el;exports.cardToGanttTask=Ui;exports.cardsToGanttTasks=zm;exports.cn=u;exports.createKanbanView=wp;exports.createRetryWrapper=$f;exports.darkTheme=hd;exports.darkTokenTheme=ul;exports.defaultTheme=wi;exports.designTokens=cl;exports.duration=$c;exports.easing=Hc;exports.exportTokensToCSS=nf;exports.findTaskByName=ko;exports.fontSize=Ic;exports.fontWeight=Bc;exports.formatCost=Hs;exports.ganttEnTranslations=Ci;exports.ganttEsTranslations=Gp;exports.ganttTaskToCardUpdate=Hm;exports.ganttThemes=gt;exports.ganttTokens=Vc;exports.ganttTranslations=wd;exports.ganttUtils=Se;exports.generateCSSVariables=jc;exports.generateCompleteCSS=qc;exports.generateInitialPositions=If;exports.generateTasksContext=Im;exports.generateThemeVariables=Vs;exports.getCalendarTheme=f0;exports.getCalendarTranslations=Ls;exports.getListViewTheme=o0;exports.getListViewTranslations=Gd;exports.getMonthNames=n0;exports.getToken=of;exports.getTranslations=jp;exports.getWeekdayNames=s0;exports.kanbanTokens=Wc;exports.lightTheme=yd;exports.lightTokenTheme=_c;exports.lineHeight=Rc;exports.listViewDarkTheme=pc;exports.listViewEnTranslations=Wd;exports.listViewEsTranslations=Vd;exports.listViewLightTheme=mc;exports.listViewNeutralTheme=gc;exports.listViewThemes=Zi;exports.listViewTranslations=Wi;exports.mergeCalendarTranslations=tl;exports.mergeListViewTranslations=Vi;exports.mergeTranslations=kd;exports.neutralTheme=xd;exports.neutralTokenTheme=Kc;exports.opacity=Uc;exports.parseLocalCommand=Om;exports.parseNaturalDate=Hd;exports.parseNaturalDuration=zd;exports.parseProgress=Ud;exports.parseStatus=Rm;exports.pluginManager=Yw;exports.retrySyncOperation=Of;exports.retryWithBackoff=Xs;exports.shadows=zc;exports.shouldVirtualizeGrid=rf;exports.spacing=Ac;exports.themes=sn;exports.useAI=W0;exports.useBoard=B0;exports.useBoardCore=Ws;exports.useBoardStore=ll;exports.useCardStacking=j0;exports.useDragState=$l;exports.useFilteredCards=Y0;exports.useFilters=$0;exports.useGanttI18n=$r;exports.useKanbanState=il;exports.useKeyboardShortcuts=Hp;exports.useMultiSelect=V0;exports.useSelectionState=Ec;exports.useSortedCards=X0;exports.useTheme=An;exports.useVirtualGrid=af;exports.useVirtualList=Z0;exports.validateAIResponse=$m;exports.withErrorBoundary=ql;exports.wouldCreateCircularDependency=Qs;exports.zIndex=Oc;//# sourceMappingURL=index.cjs.map
|
|
444
464
|
//# sourceMappingURL=index.cjs.map
|