@libxai/board 0.17.176 → 0.17.178
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
border: none !important;
|
|
69
69
|
cursor: pointer !important;
|
|
70
70
|
opacity: 0.5 !important;
|
|
71
|
-
`,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=y=>{y.stopPropagation();let f=r<a.length-1?r+1:0;n(),o(f);},l.appendChild(d),l.appendChild(i),l.appendChild(u);}l.appendChild(c),l.appendChild(p),document.body.appendChild(l),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function mm(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 um(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 Qn(e){return e.startsWith("image/")}function za({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null),u=react.useRef(e);u.current=e;let y=react.useCallback((v,L)=>{L.preventDefault(),L.stopPropagation();let T=u.current.filter(P=>Qn(P.type)),k=T.findIndex(P=>P.id===v.id),F=P=>{let H=u.current.filter(ye=>Qn(ye.type)),X=H[P];X&&Sl(X.url,X.name,H,P,F);};Sl(v.url,v.name,T,k,F);},[]),f=react.useCallback(v=>{let L=[],T=[];return e.length+v.length>s?(T.push(`Maximum ${s} files allowed`),{valid:L,errors:T}):(v.forEach(k=>{if(k.size/1048576>r){T.push(`${k.name} is too large (max ${r}MB)`);return}if(o&&!o.some(P=>k.type.match(P))){T.push(`${k.name} has invalid file type`);return}L.push(k);}),{valid:L,errors:T})},[e.length,s,r,o]),g=react.useCallback(async v=>{let{valid:L,errors:T}=f(v);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(L.length!==0){n(true),d(null);try{await t?.(L);}catch(k){d(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[f,t]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),w=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let L=Array.from(v.dataTransfer.files);g(L);},[g]),D=react.useCallback(v=>{let L=v.target.files?Array.from(v.target.files):[];g(L),i.current&&(i.current.value="");},[g]),N=react.useCallback(()=>{i.current?.click();},[]),M=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 ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:x,onDragLeave:b,onDragOver:h,onDrop:w,onClick:N,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Qn(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(v,L),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:um(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:mm(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:()=>M(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 es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:f,onEstimateEffort:g,currentUserId:x="user-1"}){let[b,h]=react.useState("details"),[w,D]=react.useState(false),[N,M]=react.useState({}),[v,L]=react.useState(""),[T,k]=react.useState(false),[F,P]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{D(false),M({}),h("details"),L(""),P({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),M({}),D(false));},[e.id,N,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),we=react.useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),L(""));},[e.id,v,m]),Ie=react.useCallback(async()=>{if(y){k(true);try{let S=await y(e);P(q=>({...q,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{k(false);}}},[e,y]),Le=react.useCallback(async()=>{if(f){k(true);try{let S=await f(e);P(q=>({...q,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{k(false);}}},[e,f]),O=react.useCallback(async()=>{if(g){k(true);try{let S=await g(e);P(q=>({...q,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{k(false);}}},[e,g]),B={...e,...N},W=s.filter(S=>B.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(tt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:N.title??B.title,onChange:S=>M({...N,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:X,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ye,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>h("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>h("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),w?jsxRuntime.jsx("textarea",{value:N.description??B.description??"",onChange:S=>M({...N,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??B.assignedUserIds??[],onChange:S=>{let q=Array.from(S.target.selectedOptions,ee=>ee.value);M({...N,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:W.length>0?W.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.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"}),w?jsxRuntime.jsxs("select",{value:N.priority??B.priority??"",onChange:S=>M({...N,priority:S.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:B.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:B.labels&&B.labels.length>0?B.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:S=>M({...N,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:S=>M({...N,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??B.estimatedTime??"",onChange:S=>M({...N,estimatedTime:S.target.value?parseFloat(S.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:B.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:B.dependencies&&B.dependencies.length>0?B.dependencies.map(S=>{let q=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):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:B.createdAt?new Date(B.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:S=>L(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:we,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(S=>{let q=s.find(ee=>ee.id===S.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:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(S.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:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(S=>{let q=s.find(ee=>ee.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.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:q?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.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(za,{cardId:e.id,attachments:n,onUpload:i?S=>i(e.id,S):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ie,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Le,disabled:T||!f,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:O,disabled:T||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),F.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),F.assignees.map((S,q)=>{let ee=s.find($=>$.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},q)})]}),F.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),F.subtasks.map((S,q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},q))]}),F.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:[F.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(F.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!F.assignees&&!F.subtasks&&!F.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,y=4,f=d.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let g=i-d.bottom,x=d.top,b;return g>=s+y?b=d.bottom+y:x>=s+y?b=d.top-s-y:g>=x?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let y=u.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(tt,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ho=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Rr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,y]=react.useState(Ho[10]||"#3B82F6"),[f,g]=react.useState({top:0,left:0}),x=react.useRef(null),b=react.useRef(null),h=react.useRef(null),w=react.useRef(null),D=t.filter(k=>k.name.toLowerCase().includes(n.toLowerCase())),N=t.some(k=>k.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&b.current){let k=b.current.getBoundingClientRect();g({top:k.bottom+6,left:k.left});}},[c]),react.useEffect(()=>{let k=F=>{let P=F.target,H=x.current?.contains(P),X=h.current?.contains(P);!H&&!X&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),react.useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let M=k=>{let F=e.some(P=>P.id===k.id);a(F?e.filter(P=>P.id!==k.id):[...e,k]);},v=async()=>{if(!(!r||!n.trim())){i(true);try{let k=await r(n.trim(),u);k&&(a([...e,k]),m(""),y(Ho[Math.floor(Math.random()*Ho.length)]||"#3B82F6"));}finally{i(false);}}},L=(k,F)=>{F.stopPropagation(),a(e.filter(P=>P.id!==k));},T={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:T,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(k=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:h,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:f.top,left:f.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:w,type:"text",value:n,onChange:k=>m(k.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:k=>{k.key==="Enter"&&n.trim()&&!N&&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(k=>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:`${k.color}20`,color:k.color},onClick:F=>L(k.id,F),children:[k.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},k.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(k=>{let F=e.some(P=>P.id===k.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:F?`${k.color}15`:"transparent",color:o.textPrimary},onMouseEnter:P=>{F||(P.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:P=>{F||(P.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.name}),F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:k.color}})]},k.id)}):n.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"})}),n.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ho.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:u===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),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:u,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 "',n.trim(),'"']})]})]})}),document.body)]})}function rs({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 Al({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(rs,{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 Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Em=["LOW","MEDIUM","HIGH","URGENT"],Pm=["todo","in-progress","review","done"];function ns({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:y=[],availableLabels:f=[],availableTags:g=[],onCreateTag:x,onUploadCoverImage:b,unsplashAccessKey:h,theme:w,onSubtasksChange:D,attachments:N=[],onUploadAttachments:M,onDeleteAttachment:v}){let L=Mr(),T=w||L?.themeName||"dark",[k,F]=react.useState(e),[P,H]=react.useState(false),[X,ye]=react.useState(e?.subtasks||[]),[we,Ie]=react.useState(false),[Le,O]=react.useState(""),[B,W]=react.useState(""),[S,q]=react.useState("all"),[ee,$]=react.useState(false),[Me,be]=react.useState(false),[qe,ue]=react.useState(false),[Qe,Te]=react.useState(false),[rt,gt]=react.useState(false),[ft,et]=react.useState(false),R=react.useRef(null),se=react.useRef(null),ve=react.useRef(null),De=react.useRef(null),Ee=react.useRef(null),Ve=react.useRef(null),Ct=react.useRef(null),Y=react.useRef(null),z=react.useRef(null),ke=react.useRef(null),We=react.useRef(null),Ue=react.useRef(null);react.useEffect(()=>{e&&!k?(F({...e}),ye(e.subtasks||[])):e&&k&&e.id!==k.id&&(F({...e}),ye(e.subtasks||[]));},[e,k]),react.useEffect(()=>{let U=ce=>{let Ce=ce.target;De.current&&!De.current.contains(Ce)&&$(false),Ee.current&&!Ee.current.contains(Ce)&&be(false),Ve.current&&!Ve.current.contains(Ce)&&ue(false),Ct.current&&!Ct.current.contains(Ce)&&Te(false);};if(ee||Me||qe||Qe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ee,Me,qe,Qe]),react.useEffect(()=>{if(!t)return;let U=ce=>{let Ce=ce.target,zt=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),ee||Me||qe||Qe||rt||ft?($(false),be(false),ue(false),Te(false),gt(false),et(false)):zt||a();return}if(zt&&ce.key!=="Escape")return;let ea=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),$(true);break;case "a":ce.preventDefault(),ue(true);break;case "p":ce.preventDefault(),be(true);break;case "l":ce.preventDefault(),Te(true);break;case "d":ea||(ce.preventDefault(),gt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":ea||(ce.preventDefault(),et(true));break;case "i":ce.preventDefault(),H(true),setTimeout(()=>se.current?.focus(),0);break;case "t":ce.preventDefault(),Ie(true);break;case "c":ce.preventDefault(),ve.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,ee,Me,qe,Qe,rt,ft]);let ht=react.useCallback(U=>{let ce=U.currentTarget.textContent?.trim()||"";if(k&&ce!==k.title){let Ce={...k,title:ce};F(Ce),r?.(k.id,{title:ce});}},[k,r]),Z=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=k?.title||"",U.currentTarget.blur());},[k]),te=react.useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),H(false);},[k,e,r]),xe=react.useCallback(U=>{if(k){let ce={...k,columnId:U};F(ce),r?.(k.id,{columnId:U}),$(false);}},[k,r]),Pe=react.useCallback(U=>{if(k){let ce={...k,priority:U};F(ce),r?.(k.id,{priority:U}),be(false);}},[k,r]),J=react.useCallback(U=>{if(k){let ce=k.assignedUserIds||[],Ce=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],zt={...k,assignedUserIds:Ce};F(zt),r?.(k.id,{assignedUserIds:Ce});}},[k,r]),Ae=react.useCallback(U=>{if(k){let ce=k.labels||[],Ce=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],zt={...k,labels:Ce};F(zt),r?.(k.id,{labels:Ce});}},[k,r]),he=react.useCallback(U=>{if(k){let ce={...k,tags:U};F(ce),r?.(k.id,{tags:U});}},[k,r]),Ne=react.useCallback(U=>{if(k){let ce=U.target.value,Ce={...k,endDate:ce};F(Ce),r?.(k.id,{endDate:ce}),gt(false);}},[k,r]),de=react.useCallback(U=>{if(k){let ce={...k,estimatedTime:parseFloat(U)||0};F(ce),r?.(k.id,{estimatedTime:parseFloat(U)||0});}},[k,r]),Re=react.useCallback(()=>{if(Le.trim()&&k){let U={id:`subtask-${Date.now()}`,title:Le.trim(),completed:false,createdAt:new Date},ce=[...X,U];ye(ce),O(""),Ie(false),D?.(k.id,ce);}},[Le,X,k,D]),Fe=react.useCallback(U=>{let ce=X.map(Ce=>Ce.id===U?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);ye(ce),k&&D?.(k.id,ce);},[X,k,D]),Oe=react.useCallback(U=>{let ce=X.filter(Ce=>Ce.id!==U);ye(ce),k&&D?.(k.id,ce);},[X,k,D]),_=react.useCallback(()=>{B.trim()&&k&&p&&(p(k.id,B.trim()),W(""));},[B,k,p]),j=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),_());},[_]),nt=U=>jsxRuntime.jsx(Dm__default.default,{remarkPlugins:[Nm__default.default],rehypePlugins:[Sm__default.default],components:{a:({node:ce,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:U}),He=c.filter(U=>S==="comments"?U.type.includes("COMMENT"):S==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let ge=k||e,Vt=s.filter(U=>ge.assignedUserIds?.includes(U.id)),Tt=X.filter(U=>U.completed).length;return jsxRuntime.jsx(tt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:R,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ht,onKeyDown:Z,children:ge.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:De,children:[jsxRuntime.jsxs("button",{ref:z,className:"modal-v2-field",onClick:()=>$(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ge.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:z,isOpen:ee,onClose:()=>$(false),width:250,estimatedHeight:200,children:(y.length>0?y:Pm.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ge.columnId===U.id?"active":""}`,onClick:()=>xe(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ve,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>ue(!qe),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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:ke,isOpen:qe,onClose:()=>ue(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>J(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,ge.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>be(!Me),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:ge.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:We,isOpen:Me,onClose:()=>be(false),width:180,estimatedHeight:220,children:[Em.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${ge.priority===U?"active":""}`,onClick:()=>Pe(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),g.length>0||x?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(Rr,{selectedTags:ge.tags||[],availableTags:g,onChange:he,onCreateTag:x,theme:Ge[T]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ct,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>Te(!Qe),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:ge.labels&&ge.labels.length>0?jsxRuntime.jsx("span",{children:ge.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Ue,isOpen:Qe,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.labels?.includes(U)?"active":""}`,onClick:()=>Ae(U),children:[U,ge.labels?.includes(U)&&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"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{gt(!rt),setTimeout(()=>Y.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ge.endDate?new Date(ge.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Y,type:"date",value:typeof ge.endDate=="string"?ge.endDate.split("T")[0]:ge.endDate?(()=>{let U=new Date(ge.endDate),ce=U.getUTCFullYear(),Ce=String(U.getUTCMonth()+1).padStart(2,"0"),zt=String(U.getUTCDate()).padStart(2,"0");return `${ce}-${Ce}-${zt}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>et(!ft),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:ge.estimatedTime?`${ge.estimatedTime}h`:"Not set"})]}),ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ge.estimatedTime||"",onChange:U=>de(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>et(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),P?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ge.description||"",onChange:U=>{if(k){let ce={...k,description:U.target.value};F(ce);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ge.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:nt(ge.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"}),X.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",X.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ie(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:[X.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Fe(U.id),children:U.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:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Oe(U.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"})]})})]},U.id)),we&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Le,onChange:U=>O(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Re(),U.key==="Escape"&&(Ie(false),O(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(za,{cardId:ge.id,attachments:N,onUpload:M?U=>M(ge.id,U):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 ${S==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ve,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:B,onChange:U=>W(U.target.value),onKeyDown:j,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:_,disabled:!B.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[He.map(U=>{let ce=s.find(zt=>zt.id===U.userId);if(U.type.includes("COMMENT")){let zt=l.find(ea=>ea.id===U.metadata?.commentId);return zt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:zt.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),He.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function zm({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 is({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Km({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 ls({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Km,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var au={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},zl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ru({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function $l({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 ds({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||au[p.name]||zl[e.indexOf(p)%zl.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?ru:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx($l,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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($l,{})}),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:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var _o=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let y=e.map(w=>w.id),f=w=>{r.onBulkUpdate?.(y,{priority:w}),c(false);},g=w=>{r.onBulkMove?.(y,w),n(false),a();},x=w=>{r.onBulkUpdate?.(y,{assignedUserIds:w}),d(false);},b=w=>{let D=new Set;e.forEach(M=>{M.labels?.forEach(v=>D.add(v));});let N=Array.from(new Set([...D,...w]));r.onBulkUpdate?.(y,{labels:N}),u(false);},h=()=>{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:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(w),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:h,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});_o.displayName="BulkOperationsToolbar";function lu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let y=a?.find(f=>f.id===u);l=`assignee-${u}`,c=y?.name||`User ${u}`,p=y?.color,n=y?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function cs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>lu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ps=[{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 ms({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=ps.find(n=>n.value===e)||ps[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:C("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:ps.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var co=[{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 pu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function _l(e={}){let{shortcuts:t=co,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 l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(pu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function uu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function gu(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 fu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=gu(e),r=t?uu(t):"";return a?`${a} + ${r}`:r}function hu(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 us({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=hu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:fu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var gs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
71
|
+
`,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=y=>{y.stopPropagation();let f=r<a.length-1?r+1:0;n(),o(f);},l.appendChild(d),l.appendChild(i),l.appendChild(u);}l.appendChild(c),l.appendChild(p),document.body.appendChild(l),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function mm(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 um(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 Qn(e){return e.startsWith("image/")}function za({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null),u=react.useRef(e);u.current=e;let y=react.useCallback((v,L)=>{L.preventDefault(),L.stopPropagation();let T=u.current.filter(P=>Qn(P.type)),k=T.findIndex(P=>P.id===v.id),F=P=>{let H=u.current.filter(ye=>Qn(ye.type)),X=H[P];X&&Sl(X.url,X.name,H,P,F);};Sl(v.url,v.name,T,k,F);},[]),f=react.useCallback(v=>{let L=[],T=[];return e.length+v.length>s?(T.push(`Maximum ${s} files allowed`),{valid:L,errors:T}):(v.forEach(k=>{if(k.size/1048576>r){T.push(`${k.name} is too large (max ${r}MB)`);return}if(o&&!o.some(P=>k.type.match(P))){T.push(`${k.name} has invalid file type`);return}L.push(k);}),{valid:L,errors:T})},[e.length,s,r,o]),g=react.useCallback(async v=>{let{valid:L,errors:T}=f(v);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(L.length!==0){n(true),d(null);try{await t?.(L);}catch(k){d(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[f,t]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),w=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let L=Array.from(v.dataTransfer.files);g(L);},[g]),D=react.useCallback(v=>{let L=v.target.files?Array.from(v.target.files):[];g(L),i.current&&(i.current.value="");},[g]),N=react.useCallback(()=>{i.current?.click();},[]),M=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 ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:x,onDragLeave:b,onDragOver:h,onDrop:w,onClick:N,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Qn(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(v,L),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:um(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:mm(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:()=>M(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 es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:f,onEstimateEffort:g,currentUserId:x="user-1"}){let[b,h]=react.useState("details"),[w,D]=react.useState(false),[N,M]=react.useState({}),[v,L]=react.useState(""),[T,k]=react.useState(false),[F,P]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{D(false),M({}),h("details"),L(""),P({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),M({}),D(false));},[e.id,N,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),we=react.useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),L(""));},[e.id,v,m]),Ie=react.useCallback(async()=>{if(y){k(true);try{let S=await y(e);P(q=>({...q,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{k(false);}}},[e,y]),Le=react.useCallback(async()=>{if(f){k(true);try{let S=await f(e);P(q=>({...q,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{k(false);}}},[e,f]),O=react.useCallback(async()=>{if(g){k(true);try{let S=await g(e);P(q=>({...q,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{k(false);}}},[e,g]),B={...e,...N},W=s.filter(S=>B.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(tt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:N.title??B.title,onChange:S=>M({...N,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:X,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ye,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>h("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>h("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>h("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),w?jsxRuntime.jsx("textarea",{value:N.description??B.description??"",onChange:S=>M({...N,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??B.assignedUserIds??[],onChange:S=>{let q=Array.from(S.target.selectedOptions,ee=>ee.value);M({...N,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:W.length>0?W.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.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"}),w?jsxRuntime.jsxs("select",{value:N.priority??B.priority??"",onChange:S=>M({...N,priority:S.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:B.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:B.labels&&B.labels.length>0?B.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:S=>M({...N,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:S=>M({...N,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??B.estimatedTime??"",onChange:S=>M({...N,estimatedTime:S.target.value?parseFloat(S.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:B.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:B.dependencies&&B.dependencies.length>0?B.dependencies.map(S=>{let q=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):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:B.createdAt?new Date(B.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:S=>L(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:we,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(S=>{let q=s.find(ee=>ee.id===S.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:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(S.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:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(S=>{let q=s.find(ee=>ee.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.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:q?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.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(za,{cardId:e.id,attachments:n,onUpload:i?S=>i(e.id,S):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ie,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Le,disabled:T||!f,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:O,disabled:T||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),F.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),F.assignees.map((S,q)=>{let ee=s.find($=>$.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},q)})]}),F.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),F.subtasks.map((S,q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},q))]}),F.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:[F.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(F.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!F.assignees&&!F.subtasks&&!F.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,y=4,f=d.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let g=i-d.bottom,x=d.top,b;return g>=s+y?b=d.bottom+y:x>=s+y?b=d.top-s-y:g>=x?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let y=u.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(tt,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ho=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Rr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,y]=react.useState(Ho[10]||"#3B82F6"),[f,g]=react.useState({top:0,left:0}),x=react.useRef(null),b=react.useRef(null),h=react.useRef(null),w=react.useRef(null),D=t.filter(k=>k.name.toLowerCase().includes(n.toLowerCase())),N=t.some(k=>k.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&b.current){let k=b.current.getBoundingClientRect();g({top:k.bottom+6,left:k.left});}},[c]),react.useEffect(()=>{let k=F=>{let P=F.target,H=x.current?.contains(P),X=h.current?.contains(P);!H&&!X&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),react.useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let M=k=>{let F=e.some(P=>P.id===k.id);a(F?e.filter(P=>P.id!==k.id):[...e,k]);},v=async()=>{if(!(!r||!n.trim())){i(true);try{let k=await r(n.trim(),u);k&&(a([...e,k]),m(""),y(Ho[Math.floor(Math.random()*Ho.length)]||"#3B82F6"));}finally{i(false);}}},L=(k,F)=>{F.stopPropagation(),a(e.filter(P=>P.id!==k));},T={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:T,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(k=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:h,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:f.top,left:f.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:w,type:"text",value:n,onChange:k=>m(k.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:k=>{k.key==="Enter"&&n.trim()&&!N&&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(k=>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:`${k.color}20`,color:k.color},onClick:F=>L(k.id,F),children:[k.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},k.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(k=>{let F=e.some(P=>P.id===k.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:F?`${k.color}15`:"transparent",color:o.textPrimary},onMouseEnter:P=>{F||(P.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:P=>{F||(P.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.name}),F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:k.color}})]},k.id)}):n.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"})}),n.trim()&&!N&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ho.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:u===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),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:u,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 "',n.trim(),'"']})]})]})}),document.body)]})}function rs({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 Al({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(rs,{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 Ge={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#DC2626",todayLight:"rgba(220, 38, 38, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Em=["LOW","MEDIUM","HIGH","URGENT"],Pm=["todo","in-progress","review","done"];function ns({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:y=[],availableLabels:f=[],availableTags:g=[],onCreateTag:x,onUploadCoverImage:b,unsplashAccessKey:h,theme:w,onSubtasksChange:D,attachments:N=[],onUploadAttachments:M,onDeleteAttachment:v}){let L=Mr(),T=w||L?.themeName||"dark",[k,F]=react.useState(e),[P,H]=react.useState(false),[X,ye]=react.useState(e?.subtasks||[]),[we,Ie]=react.useState(false),[Le,O]=react.useState(""),[B,W]=react.useState(""),[S,q]=react.useState("all"),[ee,$]=react.useState(false),[Me,be]=react.useState(false),[qe,ue]=react.useState(false),[Qe,Te]=react.useState(false),[rt,gt]=react.useState(false),[ft,et]=react.useState(false),R=react.useRef(null),se=react.useRef(null),ve=react.useRef(null),De=react.useRef(null),Ee=react.useRef(null),Ve=react.useRef(null),Ct=react.useRef(null),Y=react.useRef(null),z=react.useRef(null),ke=react.useRef(null),We=react.useRef(null),Ue=react.useRef(null);react.useEffect(()=>{e&&!k?(F({...e}),ye(e.subtasks||[])):e&&k&&e.id!==k.id&&(F({...e}),ye(e.subtasks||[]));},[e,k]),react.useEffect(()=>{let U=ce=>{let Ce=ce.target;De.current&&!De.current.contains(Ce)&&$(false),Ee.current&&!Ee.current.contains(Ce)&&be(false),Ve.current&&!Ve.current.contains(Ce)&&ue(false),Ct.current&&!Ct.current.contains(Ce)&&Te(false);};if(ee||Me||qe||Qe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ee,Me,qe,Qe]),react.useEffect(()=>{if(!t)return;let U=ce=>{let Ce=ce.target,zt=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),ee||Me||qe||Qe||rt||ft?($(false),be(false),ue(false),Te(false),gt(false),et(false)):zt||a();return}if(zt&&ce.key!=="Escape")return;let ea=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),$(true);break;case "a":ce.preventDefault(),ue(true);break;case "p":ce.preventDefault(),be(true);break;case "l":ce.preventDefault(),Te(true);break;case "d":ea||(ce.preventDefault(),gt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":ea||(ce.preventDefault(),et(true));break;case "i":ce.preventDefault(),H(true),setTimeout(()=>se.current?.focus(),0);break;case "t":ce.preventDefault(),Ie(true);break;case "c":ce.preventDefault(),ve.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,ee,Me,qe,Qe,rt,ft]);let ht=react.useCallback(U=>{let ce=U.currentTarget.textContent?.trim()||"";if(k&&ce!==k.title){let Ce={...k,title:ce};F(Ce),r?.(k.id,{title:ce});}},[k,r]),Z=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=k?.title||"",U.currentTarget.blur());},[k]),te=react.useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),H(false);},[k,e,r]),xe=react.useCallback(U=>{if(k){let ce={...k,columnId:U};F(ce),r?.(k.id,{columnId:U}),$(false);}},[k,r]),Pe=react.useCallback(U=>{if(k){let ce={...k,priority:U};F(ce),r?.(k.id,{priority:U}),be(false);}},[k,r]),J=react.useCallback(U=>{if(k){let ce=k.assignedUserIds||[],Ce=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],zt={...k,assignedUserIds:Ce};F(zt),r?.(k.id,{assignedUserIds:Ce});}},[k,r]),Ae=react.useCallback(U=>{if(k){let ce=k.labels||[],Ce=ce.includes(U)?ce.filter(ea=>ea!==U):[...ce,U],zt={...k,labels:Ce};F(zt),r?.(k.id,{labels:Ce});}},[k,r]),he=react.useCallback(U=>{if(k){let ce={...k,tags:U};F(ce),r?.(k.id,{tags:U});}},[k,r]),Ne=react.useCallback(U=>{if(k){let ce=U.target.value,Ce={...k,endDate:ce};F(Ce),r?.(k.id,{endDate:ce}),gt(false);}},[k,r]),de=react.useCallback(U=>{if(k){let ce={...k,estimatedTime:parseFloat(U)||0};F(ce),r?.(k.id,{estimatedTime:parseFloat(U)||0});}},[k,r]),Re=react.useCallback(()=>{if(Le.trim()&&k){let U={id:`subtask-${Date.now()}`,title:Le.trim(),completed:false,createdAt:new Date},ce=[...X,U];ye(ce),O(""),Ie(false),D?.(k.id,ce);}},[Le,X,k,D]),Fe=react.useCallback(U=>{let ce=X.map(Ce=>Ce.id===U?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);ye(ce),k&&D?.(k.id,ce);},[X,k,D]),Oe=react.useCallback(U=>{let ce=X.filter(Ce=>Ce.id!==U);ye(ce),k&&D?.(k.id,ce);},[X,k,D]),_=react.useCallback(()=>{B.trim()&&k&&p&&(p(k.id,B.trim()),W(""));},[B,k,p]),j=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),_());},[_]),nt=U=>jsxRuntime.jsx(Dm__default.default,{remarkPlugins:[Nm__default.default],rehypePlugins:[Sm__default.default],components:{a:({node:ce,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:U}),He=c.filter(U=>S==="comments"?U.type.includes("COMMENT"):S==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let ge=k||e,Vt=s.filter(U=>ge.assignedUserIds?.includes(U.id)),Tt=X.filter(U=>U.completed).length;return jsxRuntime.jsx(tt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:R,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ht,onKeyDown:Z,children:ge.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:De,children:[jsxRuntime.jsxs("button",{ref:z,className:"modal-v2-field",onClick:()=>$(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ge.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:z,isOpen:ee,onClose:()=>$(false),width:250,estimatedHeight:200,children:(y.length>0?y:Pm.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ge.columnId===U.id?"active":""}`,onClick:()=>xe(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ve,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>ue(!qe),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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:ke,isOpen:qe,onClose:()=>ue(false),width:280,estimatedHeight:300,children:s.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>J(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,ge.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:We,className:"modal-v2-field",onClick:()=>be(!Me),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:ge.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:We,isOpen:Me,onClose:()=>be(false),width:180,estimatedHeight:220,children:[Em.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${ge.priority===U?"active":""}`,onClick:()=>Pe(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),g.length>0||x?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(Rr,{selectedTags:ge.tags||[],availableTags:g,onChange:he,onCreateTag:x,theme:Ge[T]||Ge.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ct,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>Te(!Qe),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:ge.labels&&ge.labels.length>0?jsxRuntime.jsx("span",{children:ge.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Ue,isOpen:Qe,onClose:()=>Te(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.labels?.includes(U)?"active":""}`,onClick:()=>Ae(U),children:[U,ge.labels?.includes(U)&&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"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{gt(!rt),setTimeout(()=>Y.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ge.endDate?new Date(ge.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Y,type:"date",value:typeof ge.endDate=="string"?ge.endDate.split("T")[0]:ge.endDate?(()=>{let U=new Date(ge.endDate),ce=U.getUTCFullYear(),Ce=String(U.getUTCMonth()+1).padStart(2,"0"),zt=String(U.getUTCDate()).padStart(2,"0");return `${ce}-${Ce}-${zt}`})():"",onChange:Ne,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>et(!ft),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:ge.estimatedTime?`${ge.estimatedTime}h`:"Not set"})]}),ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ge.estimatedTime||"",onChange:U=>de(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>et(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),P?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ge.description||"",onChange:U=>{if(k){let ce={...k,description:U.target.value};F(ce);}},onBlur:te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ge.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:nt(ge.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"}),X.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Tt,"/",X.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ie(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:[X.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Fe(U.id),children:U.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:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Oe(U.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"})]})})]},U.id)),we&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Le,onChange:U=>O(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Re(),U.key==="Escape"&&(Ie(false),O(""));},onBlur:Re,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||N.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(za,{cardId:ge.id,attachments:N,onUpload:M?U=>M(ge.id,U):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 ${S==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ve,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:B,onChange:U=>W(U.target.value),onKeyDown:j,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:_,disabled:!B.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[He.map(U=>{let ce=s.find(zt=>zt.id===U.userId);if(U.type.includes("COMMENT")){let zt=l.find(ea=>ea.id===U.metadata?.commentId);return zt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:zt.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:ce?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),He.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function zm({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 is({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Km({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 ls({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Km,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var au={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},zl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ru({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function $l({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 ds({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||au[p.name]||zl[e.indexOf(p)%zl.length]})),c=l.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?ru:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx($l,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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($l,{})}),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:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var _o=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let y=e.map(w=>w.id),f=w=>{r.onBulkUpdate?.(y,{priority:w}),c(false);},g=w=>{r.onBulkMove?.(y,w),n(false),a();},x=w=>{r.onBulkUpdate?.(y,{assignedUserIds:w}),d(false);},b=w=>{let D=new Set;e.forEach(M=>{M.labels?.forEach(v=>D.add(v));});let N=Array.from(new Set([...D,...w]));r.onBulkUpdate?.(y,{labels:N}),u(false);},h=()=>{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:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(w),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:h,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});_o.displayName="BulkOperationsToolbar";function lu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let y=a?.find(f=>f.id===u);l=`assignee-${u}`,c=y?.name||`User ${u}`,p=y?.color,n=y?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function cs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>lu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ps=[{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 ms({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=ps.find(n=>n.value===e)||ps[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:C("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:ps.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var co=[{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 pu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function _l(e={}){let{shortcuts:t=co,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 l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(pu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function uu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function gu(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 fu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=gu(e),r=t?uu(t):"";return a?`${a} + ${r}`:r}function hu(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 us({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=hu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:fu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var gs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
72
72
|
1.
|
|
73
73
|
|
|
74
74
|
**Expected behavior:**
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${p}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ne.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let y=t.find(f=>f.id===u);if(y){o(y);let f=r.get(u)?.ef||0;d=Math.max(d,f);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),i=s;if(d.length>0)for(let y of d){c(y);let f=l.get(y.id)?.ls||0;i=Math.min(i,f);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ne.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ne.calculateCriticalPath(e).includes(t))return 0;let o=ne.getDependentTasks(e,t);if(o.length===0){let c=ne.getLatestEndDate(e);if(!c)return null;let p=ne.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ne.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ne.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ne.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ne.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ne.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ne.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ne.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,y,f=new Set)=>{if(f.has(u))return;f.add(u);let g=ne.getDependentTasks(e,u);for(let x of g){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(k=>k.id===x.id);if(b===-1)continue;let h=x.startDate.getTime(),D=(x.endDate.getTime()-h)/m,M=(h-n)/m*s,v=M+y*s,L=Math.max(D*s,s),T=c+b*l+12;p.push({taskId:x.id,taskName:x.name,originalX:M,previewX:v,width:L,y:T,rowIndex:b,daysDelta:y,color:x.color}),i(x.id,y,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ne.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 l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[f,g]=react.useState([]),[x,b]=react.useState(null),[h,w]=react.useState(null),D=react.useCallback(O=>{b(O);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,v=N*M*l,L=O=>{let B=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),W=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-W);let S=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-S.getTime())/864e5+1)/7)},T=O=>{let B=O.getDay();return B===0||B===6},k=react.useCallback(O=>{let B=Math.round(O/(M*l)),W=new Date(o);return W.setDate(W.getDate()+B),W},[o,M,l]),F=react.useCallback((O,B)=>{if(B.startDate&&B.endDate)return;let W=O.currentTarget.ownerSVGElement;if(!W)return;let S=W.createSVGPoint();S.x=O.clientX,S.y=O.clientY;let q=S.matrixTransform(W.getScreenCTM()?.inverse()),ee=k(q.x),$=new Date(ee);$.setDate($.getDate()+1),d?.(B,ee,$);},[k,d]),P=react.useMemo(()=>{let O=q=>q.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let $=O(ee.subtasks),Me=$.filter(be=>be.startDate&&be.endDate);if(Me.length>0){let be=Me.map(Te=>Te.startDate.getTime()),qe=Me.map(Te=>Te.endDate.getTime()),ue=new Date(Math.min(...be)),Qe=new Date(Math.max(...qe));return {...ee,subtasks:$,startDate:ue,endDate:Qe}}return {...ee,subtasks:$}}return ee}),B=(q,ee=[])=>{for(let $ of q)ee.push($),$.subtasks&&$.subtasks.length>0&&($.isExpanded===void 0||$.isExpanded)&&B($.subtasks,ee);return ee},W=O(e);return B(W)},[e]),H=react.useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let B=O.startDate.getTime(),W=O.endDate.getTime(),S=o.getTime(),q=(B-S)/(1e3*60*60*24),ee=(W-B)/(1e3*60*60*24),$=q*M*l,Me=Math.max(M*l,40),be=Math.max(ee*M*l,Me);return {x:$,width:be}},[o,M,l]),X=react.useMemo(()=>P.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:B,width:W}=H(O),q=P.findIndex(ee=>ee.id===O.id)*a+12;return {id:O.id,x:B,y:q,width:W,height:32}}),[P,H]),ye=react.useCallback((O,B,W)=>{if(!W||B===0){g([]);return}let S=ne.calculateCascadePreview(e,O,B,P,o,M*l,a,48);g(S);},[e,P,o,M,l,a,48]),we=react.useMemo(()=>{let O=[],B=new Date(o);for(;B<=s;){let q=(B.getTime()-o.getTime())/864e5*M*l;if(r==="day")O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:q}),B.setDate(B.getDate()+1);else if(r==="week"){let ee=L(B);O.push({date:new Date(B),label:`Week ${ee}`,x:q}),B.setDate(B.getDate()+7);}else O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:q}),B.setMonth(B.getMonth()+1);}return O},[o,s,r,M,l]),Ie=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*l,[o,M,l]),Le=Math.max(P.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:48,fill:t.bgGrid}),we.map((O,B)=>jsxRuntime.jsxs("g",{children:[B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${B}`)),Ie>=0&&Ie<=v&&jsxRuntime.jsx("circle",{cx:Ie,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:Le,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:Le,fill:t.bgPrimary}),we.map((O,B)=>{let W=we[B+1]?.x||v,S=T(O.date);return jsxRuntime.jsxs("g",{children:[S&&jsxRuntime.jsx("rect",{x:O.x,y:0,width:W-O.x,height:P.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:P.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),Ie>=0&&Ie<=v&&jsxRuntime.jsx("line",{x1:Ie,y1:0,x2:Ie,y2:P.length*a,stroke:t.today,strokeWidth:2,opacity:1}),P.map((O,B)=>{let W=O.startDate&&O.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:v,height:a,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${O.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:v,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:S=>F(S,O),onMouseEnter:S=>{S.currentTarget.setAttribute("fill",t.accentLight),S.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:S=>{S.currentTarget.setAttribute("fill","transparent"),S.currentTarget.setAttribute("opacity","1");}},`clickable-${O.id}`),jsxRuntime.jsx("text",{x:Ie>0?Ie:100,y:B*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${O.id}`)]})]},`row-group-${O.id}`)}),P.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(W=>{let S=P.find(Me=>Me.id===W);if(!S||!S.startDate||!S.endDate)return null;let q=P.findIndex(Me=>Me.id===W),ee=H(S),$=H(O);return jsxRuntime.jsx(rn,{x1:ee.x+ee.width,y1:q*a+a/2,x2:$.x,y2:B*a+a/2,theme:t},`dep-${W}-${O.id}`)})),P.map((O,B)=>{if(!O.startDate||!O.endDate)return null;let{x:W,width:S}=H(O),q=B*a+12,ee=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;return O.isMilestone?jsxRuntime.jsx(nn,{task:O,x:W+S/2,y:q+16,theme:t,onClick:p},O.id):ee?jsxRuntime.jsxs("g",{onClick:()=>p?.(O),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),m?.(O,$);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:q,width:S,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:q,x2:W+S,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:q,x2:W,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+S,y1:q,x2:W+S,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:q+32,x2:W+S,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),S>60&&jsxRuntime.jsx("text",{x:W+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:O.name})]},O.id):jsxRuntime.jsx(en,{task:O,x:W,y:q,width:S,theme:t,dayWidth:M*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:X,onDragMove:ye,onHoverChange:D},O.id)}),P.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(W=>{let S=P.find(ve=>ve.id===W);if(!S||!S.startDate||!S.endDate)return null;let q=P.findIndex(ve=>ve.id===W),ee=H(S),$=H(O),Me=ee.x+ee.width,be=q*a+a/2,qe=$.x,ue=B*a+a/2,Qe=qe-Me,Te=Me+Qe/2,rt=ve=>{let De=1-ve,Ee=De*De,Ve=Ee*De,Ct=ve*ve,Y=Ct*ve,z=Ve*Me+3*Ee*ve*Te+3*De*Ct*Te+Y*qe,ke=Ve*be+3*Ee*ve*be+3*De*Ct*ue+Y*ue;return {x:z,y:ke}},gt=20,ft=[];for(let ve=0;ve<=gt;ve++){let De=.1+ve/gt*.8;ft.push(rt(De));}let et=ft[0],R=`M ${et.x} ${et.y} `+ft.slice(1).map(ve=>`L ${ve.x} ${ve.y}`).join(" ");return h&&h.x1===Me&&h.y1===be&&h.x2===qe&&h.y2===ue?null:jsxRuntime.jsx("path",{d:R,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{w({x1:Me,y1:be,x2:qe,y2:ue,onDelete:()=>u?.(O.id,W)});}},`dep-hover-${W}-${O.id}`)})),f.map(O=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:32,rx:8,fill:O.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(O.daysDelta)>0&&jsxRuntime.jsx("text",{x:O.previewX+O.width/2,y:O.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),h&&(()=>{let{x1:O,y1:B,x2:W,y2:S,onDelete:q}=h,ee=W-O,$=S-B,Me=O+ee/2,be=(B+S)/2,qe=`M ${O} ${B} C ${Me} ${B}, ${Me} ${S}, ${W} ${S}`,ue=6,Qe=Math.atan2($,ee),Te=W-ue*Math.cos(Qe-Math.PI/6),rt=S-ue*Math.sin(Qe-Math.PI/6),gt=W-ue*Math.cos(Qe+Math.PI/6),ft=S-ue*Math.sin(Qe+Math.PI/6),et=t.dependency,R="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>w(null),children:[jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:be,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:et,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:et,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${S} L ${Te} ${rt} M ${W} ${S} L ${gt} ${ft}`,fill:"none",stroke:et,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:S,r:4,fill:et,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ve=>{ve.stopPropagation(),w(null),q();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:be,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:R,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:be-3,x2:Me+3,y2:be+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:be-3,x2:Me-3,y2:be+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(wd,{tooltipData:x,theme:t})]})]})}var dn=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Ws=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Hs=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function cn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:y}){let f=[...Ws,...n.filter(R=>!Ws.some(se=>se.id===R.id))],g=Ge[p]||Ge.dark,[x,b]=react.useState(false),[h,w]=react.useState(false),[D,N]=react.useState(false),[M,v]=react.useState(false),[L,T]=react.useState({top:0,left:0}),[k,F]=react.useState(null),[P,H]=react.useState(new Date),[X,ye]=react.useState({top:0,left:0}),[we,Ie]=react.useState(false),[Le,O]=react.useState([]),B=react.useRef(null),W=react.useRef(null),S=react.useRef(null),q=react.useRef(null),ee=react.useRef(null),[$,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[be,qe]=react.useState({});react.useEffect(()=>{a?(Me({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ie(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ie(false),O([]));},[a,e]),react.useEffect(()=>{let R=se=>{B.current&&!B.current.contains(se.target)&&b(false),W.current&&!W.current.contains(se.target)&&w(false),S.current&&!S.current.contains(se.target)&&N(false),q.current&&!q.current.contains(se.target)&&v(false);};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);let ue=()=>{let R={};return $.name.trim()||(R.name="El nombre es requerido"),$.startDate&&$.endDate&&$.startDate>$.endDate&&(R.endDate="La fecha de fin debe ser posterior a la de inicio"),qe(R),Object.keys(R).length===0},Qe=async R=>{if(R.preventDefault(),!!ue())try{let se=c==="create"&&Le.length>0?{...$,pendingFiles:Le}:$;await s(se),O([]),t();}catch(se){console.error("Error submitting task:",se);}},Te=(R,se)=>{Me(ve=>{let De={...ve,[R]:se};if(R==="status"){let Ee=se;Ee==="todo"?De.progress=0:Ee==="in-progress"?(ve.progress===0||ve.progress===100)&&(De.progress=50):Ee==="completed"||Ee==="closed"?De.progress=100:(Ee==="in-review"||Ee==="review")&&(De.progress=75);}if(R==="progress"){let Ee=typeof se=="number"?se:parseInt(se,10);Ee===100&&ve.status!=="completed"?De.status="completed":Ee>0&&Ee<100&&ve.status==="todo"?De.status="in-progress":Ee===0&&ve.status!=="todo"&&(De.status="todo");}return De}),be[R]&&qe(ve=>{let De={...ve};return delete De[R],De});},rt=f.find(R=>R.id===$.status)??Ws[0],gt=Hs.find(R=>R.id===$.priority)??Hs[1],ft=dn.find(R=>R.value===$.color)??dn[0],et={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:R=>R.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:R=>{R.currentTarget.style.backgroundColor=g.hoverBg,R.currentTarget.style.color=g.textPrimary;},onMouseLeave:R=>{R.currentTarget.style.backgroundColor="transparent",R.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Qe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:$.name,onChange:R=>Te("name",R.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),be.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),be.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:$.description||"",onChange:R=>Te("description",R.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:B,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&b(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...et,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsxRuntime.jsx("span",{style:{color:rt.color},children:rt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:f.map(R=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",R.id),b(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:R.color}}),R.title,$.status===R.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},R.id))})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{children:gt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Hs.map(R=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",R.id),w(false);},children:[jsxRuntime.jsx("span",{children:R.icon}),R.label,$.priority===R.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},R.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:S,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[$.assignees&&$.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:$.assignees.slice(0,3).map((R,se)=>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:R.color||g.accent,borderColor:g.bgSecondary},children:R.initials},se))}),$.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",$.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(R=>{let se=$.assignees?.some(ve=>ve.name===R.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ve=se?($.assignees||[]).filter(De=>De.name!==R.name):[...$.assignees||[],{name:R.name,avatar:R.avatar,initials:R.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Te("assignees",ve);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:R.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:R.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},R.id)})})})]}),jsxRuntime.jsxs("div",{ref:q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(M)v(false);else {if(q.current){let R=q.current.getBoundingClientRect(),se=window.innerHeight,ve=120,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;T({top:Ee,left:R.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:$.color}}),jsxRuntime.jsx("span",{children:ft.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(tt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(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:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:R=>R.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:dn.slice(0,18).map(R=>{let se=$.color===R.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{Te("color",R.value),v(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:R.value,outline:se?`2px solid ${R.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:R.name},R.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Rr,{selectedTags:$.tags||[],availableTags:m,onChange:R=>Te("tags",R),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(k==="start")F(null);else {if(ee.current){let R=ee.current.getBoundingClientRect(),se=window.innerHeight,ve=320,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;ye({top:Ee,left:R.left});}F("start"),H($.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.startDate?$.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(k==="end")F(null);else {if(ee.current){let R=ee.current.getBoundingClientRect(),se=window.innerHeight,ve=320,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;ye({top:Ee,left:R.left});}F("end"),H($.endDate||$.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.endDate?$.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(tt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:R=>R.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let R=new Date,se=new Date(R);se.setDate(R.getDate()+1);let ve=new Date(R);ve.setDate(R.getDate()+7);let De=new Date(R);return De.setDate(R.getDate()+14),[{label:"Hoy",date:R},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:De}].map((Ve,Ct)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{k==="start"?(Te("startDate",Ve.date),(!$.endDate||Ve.date>$.endDate)&&Te("endDate",Ve.date),F("end")):(Te("endDate",Ve.date),(!$.startDate||Ve.date<$.startDate)&&Te("startDate",Ve.date),F(null));},children:Ve.label},Ct))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:R=>R.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),F(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:()=>H(new Date(P.getFullYear(),P.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:P.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((R,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:R},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let R=P.getFullYear(),se=P.getMonth(),ve=new Date(R,se,1).getDay(),De=new Date(R,se+1,0).getDate(),Ee=new Date,Ve=[];for(let Y=ve-1;Y>=0;Y--)Ve.push({day:new Date(R,se,-Y).getDate(),date:new Date(R,se-1,new Date(R,se,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=De;Y++)Ve.push({day:Y,date:new Date(R,se,Y),isCurrentMonth:true});let Ct=42-Ve.length;for(let Y=1;Y<=Ct;Y++)Ve.push({day:Y,date:new Date(R,se+1,Y),isCurrentMonth:false});return Ve.map((Y,z)=>{let ke=Y.date.toDateString()===Ee.toDateString(),We=$.startDate?.toDateString()===Y.date.toDateString(),Ue=$.endDate?.toDateString()===Y.date.toDateString(),ht=$.startDate&&$.endDate&&Y.date>=$.startDate&&Y.date<=$.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:Y.isCurrentMonth?We||Ue?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:We?"#3B82F6":Ue?"#7C3AED":ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ke&&!We&&!Ue?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{k==="start"?(Te("startDate",Y.date),$.endDate&&Y.date>$.endDate&&Te("endDate",Y.date),F("end")):(Te("endDate",Y.date),$.startDate&&Y.date<$.startDate&&Te("startDate",Y.date),F(null));},children:Y.day},z)})})()})]})]})]})})]}),be.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:be.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:$.progress,onChange:R=>Te("progress",parseInt(R.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"}20`,color:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},children:[$.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",c==="create"?Le.length>0&&`(${Le.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx(za,{cardId:"pending",attachments:Le.map((R,se)=>({id:`pending-${se}`,cardId:"pending",name:R.name,size:R.size,type:R.type,url:URL.createObjectURL(R),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:R=>O(se=>[...se,...R]),onDelete:R=>{let se=parseInt(R.replace("pending-",""),10);O(ve=>ve.filter((De,Ee)=>Ee!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(za,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?R=>u(a.id,R):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),c==="create"&&Le.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Le.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ie(!we),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${we?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:$.isMilestone,onChange:R=>Te("isMilestone",R.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter(R=>R.id!==a?.id).map(R=>{let se=$.dependencies?.includes(R.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ve=se?($.dependencies||[]).filter(De=>De!==R.id):[...$.dependencies||[],R.id];Te("dependencies",ve);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:se?`${g.accent}30`:g.bgPrimary,color:se?g.accent:g.textSecondary,border:`1px solid ${se?g.accent:g.borderLight}`},disabled:l,children:R.name},R.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:R=>!l&&(R.currentTarget.style.opacity="0.9"),onMouseLeave:R=>!l&&(R.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var rf=['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"'],Sd=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),of=()=>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"})}),nf=()=>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"})}),sf=()=>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"})}),lf=()=>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 pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,y]=react.useState([]),[f,g]=react.useState(""),[x,b]=react.useState(false),[h,w]=react.useState(true),D=react.useRef(null),N=react.useRef(null),M=react.useRef(null),{enabled:v=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:k,suggestions:F=rf,maxHistory:P=50,persistHistory:H}=a,X=H?.storageKey||"gantt-ai-history",ye=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(X);if(W){let q=JSON.parse(W).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));y(q.slice(-ye));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,X,ye]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let W=u.filter(S=>!S.isLoading).slice(-ye);localStorage.setItem(X,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[u,H?.enabled,X,ye]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,d]);let we=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&l?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&c?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&p?.(W.taskId,W.dependencyFrom);break}},[o,s,l,c,p]),Ie=react.useCallback(async W=>{if(!W.trim()||x)return;let S={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};y(ee=>[...ee.slice(-(P-1)),S]),g(""),w(false),b(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(ee=>[...ee,q]);try{if(k){let ee=await k(W,e);y($=>{let Me=$.filter(qe=>!qe.isLoading),be={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...Me,be]}),we(ee);}else y(ee=>[...ee.filter(Me=>!Me.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(ee){y($=>[...$.filter(be=>!be.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,P,k,e,we]),Le=W=>{W.preventDefault(),Ie(f);},O=W=>{g(W),D.current?.focus();};if(react.useEffect(()=>{let W=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),m(q=>!q),n||i(false)),S.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),react.useEffect(()=>{if(!n)return;let W=q=>{let ee=q.target;M.current&&!M.current.contains(ee)&&m(false);},S=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",W);}},[n]),!v)return null;let B={"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(tt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${B[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(Sd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,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 ${B[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Sd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(W=>!W),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(nf,{})})]})]}),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:[u.length===0&&h&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:F.slice(0,4).map((W,S)=>jsxRuntime.jsx("button",{onClick:()=>O(W),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:W.length>30?W.slice(0,30)+"...":W},S))})]}),u.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:W.role==="user"?"white":t.textPrimary},children:[W.isLoading?jsxRuntime.jsx(lf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:W.command.success?"#10B981":"#EF4444"},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:W=>g(W.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(of,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ed(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Pd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var mf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ne.formatDate(e.startDate)} - ${ne.formatDate(e.endDate)}`);let a=ne.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=>ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Md(e){return {...mf,...e}}var vf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Ld=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:u,locale:y="en",customTranslations:f,showCreateTaskButton:g=false,createTaskLabel:x,onCreateTask:b,onThemeChange:h,onTaskClick:w,onTaskDblClick:D,onTaskContextMenu:N,onTaskUpdate:M,onProgressChange:v,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:k,onTaskSetInProgress:F,onDependencyCreate:P,onDependencyDelete:H,onBeforeTaskAdd:X,onAfterTaskAdd:ye,onBeforeTaskUpdate:we,onAfterTaskUpdate:Ie,onBeforeTaskDelete:Le,onAfterTaskDelete:O}=a,W=react.useContext(Ko)?.theme,[S,q]=react.useState(W||s||"dark"),[ee,$]=react.useState(l),[Me,be]=react.useState(c),[qe,ue]=react.useState(1),[Qe,Te]=react.useState(0),[rt,gt]=react.useState(false),[ft,et]=react.useState(null),[R,se]=react.useState({isOpen:false,x:0,y:0,task:null}),[ve,De]=react.useState(null),[Ee,Ve]=react.useState(null);react.useEffect(()=>{W&&W!==S&&q(W);},[W]),react.useEffect(()=>{s&&s!==S&&q(s);},[s]);let Ct=react.useCallback(E=>{q(E),h?.(E);},[h]),{state:Y,setState:z,undo:ke,redo:We,canUndo:Ue,canRedo:ht,clearHistory:Z}=Ed(t,50),te=react.useRef(new Map);react.useEffect(()=>{let E=A=>A.map(K=>{let ae=te.current.get(K.id),le=ae!==void 0?{...K,isExpanded:ae}:K;return le.subtasks?.length?{...le,subtasks:E(le.subtasks)}:le});te.current.size>0?z(E(t)):z(t);},[t,z]);let xe=react.useRef(t),Pe=react.useRef(true);react.useEffect(()=>{if(Pe.current){Pe.current=false,xe.current=Y;return}if(!r)return;let E=JSON.stringify(xe.current),A=JSON.stringify(Y);E!==A&&(xe.current=Y,r(Y));},[Y,r]);let J=react.useMemo(()=>Ds(y,f),[y,f]),Ae=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[he,Ne]=react.useState(()=>Ae(J));react.useEffect(()=>{Ne(E=>E.map(A=>({...A,label:J.columns[A.id==="name"?"taskName":A.id]||A.label})));},[J]);let de=react.useMemo(()=>{let E=he.filter(ae=>ae.visible),A=E.some(ae=>ae.id!=="name");return E.reduce((ae,le)=>ae+le.width,0)+(A?20:0)},[he]);react.useEffect(()=>{ft!==null&&ft>de&&(he.filter(K=>K.visible).some(K=>K.id!=="name")||et(null));},[he,de,ft]);let Re=react.useMemo(()=>ft!==null?Math.max(280,ft,de):Math.max(280,de),[ft,de]),Fe=react.useRef(null),Oe=react.useRef(null),_=react.useRef(null),j=react.useMemo(()=>Yl(S),[S]),nt=react.useMemo(()=>({theme:j,themeName:S}),[j,S]),He=react.useMemo(()=>Md(d),[d]),ge=react.useMemo(()=>{if(!i)return Y;let E=ne.calculateCriticalPath(Y),A=K=>K.map(ae=>({...ae,isCriticalPath:E.includes(ae.id),subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(Y)},[Y,i]),Vt=vf(Me);Pd({undo:ke,redo:We,canUndo:Ue,canRedo:ht,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ne.findTaskById(Y,E),addTask:(E,A)=>{z(K=>{if(!A)return [...K,{...E,level:0}];let ae=le=>le.map(Se=>Se.id===A?{...Se,subtasks:[...Se.subtasks||[],{...E,parentId:A,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},updateTask:(E,A)=>{z(K=>{let ae=le=>le.map(Se=>Se.id===E?{...Se,...A}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},deleteTask:E=>{z(A=>{let K=ae=>ae.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=K(le.subtasks)),true));return K(A)});},deleteTasks:E=>{z(A=>Is(A,E));},duplicateTask:E=>{z(A=>Ls(A,[E]));},splitTask:(E,A,K=3)=>{z(ae=>ne.splitTask(ae,E,A,K));},calculateEndDate:ne.calculateEndDate,calculateDuration:ne.calculateDuration,validateDependency:(E,A)=>!ne.validateDependencies(Y,E,A),getAllTasks:()=>ne.flattenTasks(Y),getTasksByStatus:E=>ne.flattenTasks(Y).filter(A=>A.status===E),getTasksByParent:E=>E?ne.findTaskById(Y,E)?.subtasks||[]:Y.filter(K=>!K.parentId),getCriticalPath:()=>ne.flattenTasks(Y).filter(E=>E.isCriticalPath),indentTask:E=>{z(A=>Ps(A,[E]));},outdentTask:E=>{z(A=>Ms(A,[E]));},moveTask:(E,A)=>{z(K=>As(K,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:K}=Rs(Y,E);if(X){let ae=X({...K,parentId:E});if((ae instanceof Promise?await ae:ae)===false)return}z(A),ye&&ye({...K,parentId:E});},scrollToTask:E=>{let K=ne.flattenTasks(Y).findIndex(ae=>ae.id===E);if(K!==-1&&Fe.current){let ae=K*Vt;Fe.current.scrollTo({top:ae,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{z(A=>{let K=ae=>ae.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},collapseTask:E=>{z(A=>{let K=ae=>ae.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},expandAll:()=>{z(E=>{let A=K=>K.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(E)});},collapseAll:()=>{z(E=>{let A=K=>K.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(E)});},undo:ke,redo:We,canUndo:()=>Ue,canRedo:()=>ht,clearHistory:Z,exportToPNG:async()=>{if(!_.current)throw new Error("Gantt container not found");let E=await Id__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2});return new Promise((A,K)=>{E.toBlob(ae=>{ae?A(ae):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async E=>{await ne.exportToPDF(Y,E);},exportToExcel:async E=>{await ne.exportToExcel(Y,E);},exportToJSON:()=>ne.exportToJSON(Y),exportToCSV:()=>ne.exportToCSV(Y),importFromJSON:E=>{let A=ne.importFromJSON(E);z(A);},getTasks:()=>Y,refresh:()=>{z(E=>[...E]);},clearAll:()=>{z([]);}}),[Y,ke,We,Ue,ht,Z,j,Vt]);let Tt=react.useCallback(E=>{Ne(A=>A.map(K=>K.id===E?{...K,visible:!K.visible}:K));},[]),U=react.useCallback((E,A)=>{Ne(K=>K.map(ae=>{if(ae.id!==E)return ae;let le=ae.minWidth??100,Se=ae.maxWidth??800,Bt=Math.max(le,Math.min(Se,A));return {...ae,width:Bt}}));},[]),ce=react.useCallback(E=>{z(A=>{let K=Bs(A,E),ae=le=>{for(let Se of le){if(Se.id===E){te.current.set(E,Se.isExpanded??true);return}Se.subtasks?.length&&ae(Se.subtasks);}};return ae(K),K}),a.onTaskToggleExpand?.(E);},[a]),Ce=react.useCallback((E,A)=>{if(we&&we(E,A)===false)return;let ae=ne.findTaskById(Y,E)?.progress,le=Bt=>Bt.map(Ht=>Ht.id===E?{...Ht,...A}:Ht.subtasks?{...Ht,subtasks:le(Ht.subtasks)}:Ht);z(le(Y));let Se=ne.findTaskById(le(Y),E);Se&&(M?.(Se),Ie?.(Se),A.progress!==void 0&&ae!==void 0&&A.progress!==ae&&v?.(E,ae,A.progress));},[Y,M,we,Ie,v]),zt=react.useCallback(E=>{E.length!==0&&(z(A=>Ps(A,E)),a.onTaskIndent?.(E[0]));},[a]),ea=react.useCallback(E=>{E.length!==0&&(z(A=>Ms(A,E)),a.onTaskOutdent?.(E[0]));},[a]),qa=react.useCallback((E,A,K)=>{z(ae=>gd(ae,E,A,K)),a.onTaskReparent?.(E,A,K);},[a]),Xr=react.useCallback((E,A)=>{E.length!==0&&(z(K=>As(K,E,A)),a.onTaskMove?.(E[0],A));},[a]),ie=react.useCallback(async E=>{let A=[];for(let K of E)Le&&await Promise.resolve(Le(K))===false||A.push(K);A.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(A):(z(K=>Is(K,A)),A.forEach(K=>a.onTaskDelete?.(K))),O&&A.forEach(K=>O(K)));},[a,Le,O]),Dt=react.useCallback(E=>{z(A=>Ls(A,E)),E.forEach(A=>a.onTaskDuplicate?.(A));},[a]),Jt=react.useCallback((E,A)=>{z(K=>{let{tasks:ae,newTask:le}=ud(K,E,A);return X&&X(le)===false?K:(a.onTaskCreate?.(le.parentId,le.position||0),ye?.(le),ae)});},[a,X,ye]),Sr=react.useCallback((E,A)=>{z(K=>Fs(K,E,A)),a.onTaskRename?.(E,A);},[a]),Er=react.useCallback(E=>{z(A=>{let{tasks:K}=Rs(A,E);return a.onTaskCreate?.(E,0),K});},[a]),Pr=react.useCallback((E,A,K)=>{let ae=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/864e5):0,le=Ht=>Ht.map(Zt=>Zt.id===E.id?{...Zt,startDate:A,endDate:K,...E.segments&&{segments:E.segments}}:Zt.subtasks?{...Zt,subtasks:le(Zt.subtasks)}:Zt),Se=le(Y);Se=ne.autoScheduleDependents(Se,E.id,ae),z(Se);let Bt={...E,startDate:A,endDate:K};M?.(Bt);},[Y,M]),Wa=react.useCallback((E,A)=>{N?.(E,A),se({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[N]),ir=react.useCallback((E,A)=>{let K=ne.splitTask(Y,E.id,A);z(K),se({isOpen:false,x:0,y:0,task:null});},[Y]),Et=react.useCallback(E=>{let A=ne.findTaskById(Y,E.id)||E;D?.(A),L||De(A);},[Y,D,L]),So=react.useCallback((E,A,K)=>{let ae=new Map,le=Da=>{Da.forEach(Ha=>{Ha.dependencies&&ae.set(Ha.id,Ha.dependencies),Ha.subtasks&&le(Ha.subtasks);});};le(K);let Se=ae.get(A)||[];ae.set(A,[...Se,E]);let Bt=new Set,Ht=new Set,Zt=Da=>{if(!Bt.has(Da)){Bt.add(Da),Ht.add(Da);let Ha=ae.get(Da)||[];for(let lr of Ha){if(!Bt.has(lr)&&Zt(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(Da),false};return Zt(A)},[]),Eo=react.useCallback((E,A)=>{if(So(E.id,A,Y)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ne.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let y=t.find(f=>f.id===u);if(y){o(y);let f=r.get(u)?.ef||0;d=Math.max(d,f);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),i=s;if(d.length>0)for(let y of d){c(y);let f=l.get(y.id)?.ls||0;i=Math.min(i,f);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=ne.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ne.calculateCriticalPath(e).includes(t))return 0;let o=ne.getDependentTasks(e,t);if(o.length===0){let c=ne.getLatestEndDate(e);if(!c)return null;let p=ne.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=ne.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ne.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ne.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=ne.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=ne.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=ne.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=ne.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,y,f=new Set)=>{if(f.has(u))return;f.add(u);let g=ne.getDependentTasks(e,u);for(let x of g){if(!x.startDate||!x.endDate)continue;let b=r.findIndex(k=>k.id===x.id);if(b===-1)continue;let h=x.startDate.getTime(),D=(x.endDate.getTime()-h)/m,M=(h-n)/m*s,v=M+y*s,L=Math.max(D*s,s),T=c+b*l+12;p.push({taskId:x.id,taskName:x.name,originalX:M,previewX:v,width:L,y:T,rowIndex:b,daysDelta:y,color:x.color}),i(x.id,y,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ne.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 l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[f,g]=react.useState([]),[x,b]=react.useState(null),[h,w]=react.useState(null),D=react.useCallback(O=>{b(O);},[]),N=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,v=N*M*l,L=O=>{let B=new Date(Date.UTC(O.getFullYear(),O.getMonth(),O.getDate())),W=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-W);let S=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-S.getTime())/864e5+1)/7)},T=O=>{let B=O.getDay();return B===0||B===6},k=react.useCallback(O=>{let B=Math.round(O/(M*l)),W=new Date(o);return W.setDate(W.getDate()+B),W},[o,M,l]),F=react.useCallback((O,B)=>{if(B.startDate&&B.endDate)return;let W=O.currentTarget.ownerSVGElement;if(!W)return;let S=W.createSVGPoint();S.x=O.clientX,S.y=O.clientY;let q=S.matrixTransform(W.getScreenCTM()?.inverse()),ee=k(q.x),$=new Date(ee);$.setDate($.getDate()+1),d?.(B,ee,$);},[k,d]),P=react.useMemo(()=>{let O=q=>q.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let $=O(ee.subtasks),Me=$.filter(be=>be.startDate&&be.endDate);if(Me.length>0){let be=Me.map(Te=>Te.startDate.getTime()),qe=Me.map(Te=>Te.endDate.getTime()),ue=new Date(Math.min(...be)),Qe=new Date(Math.max(...qe));return {...ee,subtasks:$,startDate:ue,endDate:Qe}}return {...ee,subtasks:$}}return ee}),B=(q,ee=[])=>{for(let $ of q)ee.push($),$.subtasks&&$.subtasks.length>0&&($.isExpanded===void 0||$.isExpanded)&&B($.subtasks,ee);return ee},W=O(e);return B(W)},[e]),H=react.useCallback(O=>{if(!O.startDate||!O.endDate)return {x:0,width:0};let B=O.startDate.getTime(),W=O.endDate.getTime(),S=o.getTime(),q=(B-S)/(1e3*60*60*24),ee=(W-B)/(1e3*60*60*24),$=q*M*l,Me=Math.max(M*l,40),be=Math.max(ee*M*l,Me);return {x:$,width:be}},[o,M,l]),X=react.useMemo(()=>P.filter(O=>O.startDate&&O.endDate).map(O=>{let{x:B,width:W}=H(O),q=P.findIndex(ee=>ee.id===O.id)*a+12;return {id:O.id,x:B,y:q,width:W,height:32}}),[P,H]),ye=react.useCallback((O,B,W)=>{if(!W||B===0){g([]);return}let S=ne.calculateCascadePreview(e,O,B,P,o,M*l,a,48);g(S);},[e,P,o,M,l,a,48]),we=react.useMemo(()=>{let O=[],B=new Date(o);for(;B<=s;){let q=(B.getTime()-o.getTime())/864e5*M*l;if(r==="day")O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:q}),B.setDate(B.getDate()+1);else if(r==="week"){let ee=L(B);O.push({date:new Date(B),label:`Week ${ee}`,x:q}),B.setDate(B.getDate()+7);}else O.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:q}),B.setMonth(B.getMonth()+1);}return O},[o,s,r,M,l]),Ie=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*l,[o,M,l]),Le=Math.max(P.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:48,fill:t.bgGrid}),we.map((O,B)=>jsxRuntime.jsxs("g",{children:[B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:O.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:O.label})]},`header-${B}`)),Ie>=0&&Ie<=v&&jsxRuntime.jsx("circle",{cx:Ie,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:Le,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:Le,fill:t.bgPrimary}),we.map((O,B)=>{let W=we[B+1]?.x||v,S=T(O.date);return jsxRuntime.jsxs("g",{children:[S&&jsxRuntime.jsx("rect",{x:O.x,y:0,width:W-O.x,height:P.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:O.x,y1:0,x2:O.x,y2:P.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),P.map((O,B)=>{let W=O.startDate&&O.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:v,height:a,fill:B%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${O.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:v,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:S=>F(S,O),onMouseEnter:S=>{S.currentTarget.setAttribute("fill",t.accentLight),S.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:S=>{S.currentTarget.setAttribute("fill","transparent"),S.currentTarget.setAttribute("opacity","1");}},`clickable-${O.id}`),jsxRuntime.jsx("text",{x:Ie>0?Ie:100,y:B*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${O.id}`)]})]},`row-group-${O.id}`)}),P.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(W=>{let S=P.find(Me=>Me.id===W);if(!S||!S.startDate||!S.endDate)return null;let q=P.findIndex(Me=>Me.id===W),ee=H(S),$=H(O);return jsxRuntime.jsx(rn,{x1:ee.x+ee.width,y1:q*a+a/2,x2:$.x,y2:B*a+a/2,theme:t},`dep-${W}-${O.id}`)})),P.map((O,B)=>{if(!O.startDate||!O.endDate)return null;let{x:W,width:S}=H(O),q=B*a+12,ee=O.subtasks&&O.subtasks.length>0&&!O.isMilestone;return O.isMilestone?jsxRuntime.jsx(nn,{task:O,x:W+S/2,y:q+16,theme:t,onClick:p},O.id):ee?jsxRuntime.jsxs("g",{onClick:()=>p?.(O),onContextMenu:$=>{$.preventDefault(),$.stopPropagation(),m?.(O,$);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:q,width:S,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:q,x2:W+S,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:q,x2:W,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+S,y1:q,x2:W+S,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:q+32,x2:W+S,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),S>60&&jsxRuntime.jsx("text",{x:W+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:O.name})]},O.id):jsxRuntime.jsx(en,{task:O,x:W,y:q,width:S,theme:t,dayWidth:M*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:X,onDragMove:ye,onHoverChange:D},O.id)}),P.map((O,B)=>!O.dependencies||O.dependencies.length===0||!O.startDate||!O.endDate?null:O.dependencies.map(W=>{let S=P.find(ve=>ve.id===W);if(!S||!S.startDate||!S.endDate)return null;let q=P.findIndex(ve=>ve.id===W),ee=H(S),$=H(O),Me=ee.x+ee.width,be=q*a+a/2,qe=$.x,ue=B*a+a/2,Qe=qe-Me,Te=Me+Qe/2,rt=ve=>{let De=1-ve,Ee=De*De,Ve=Ee*De,Ct=ve*ve,Y=Ct*ve,z=Ve*Me+3*Ee*ve*Te+3*De*Ct*Te+Y*qe,ke=Ve*be+3*Ee*ve*be+3*De*Ct*ue+Y*ue;return {x:z,y:ke}},gt=20,ft=[];for(let ve=0;ve<=gt;ve++){let De=.1+ve/gt*.8;ft.push(rt(De));}let et=ft[0],R=`M ${et.x} ${et.y} `+ft.slice(1).map(ve=>`L ${ve.x} ${ve.y}`).join(" ");return h&&h.x1===Me&&h.y1===be&&h.x2===qe&&h.y2===ue?null:jsxRuntime.jsx("path",{d:R,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{w({x1:Me,y1:be,x2:qe,y2:ue,onDelete:()=>u?.(O.id,W)});}},`dep-hover-${W}-${O.id}`)})),f.map(O=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:O.previewX,y:O.y-48,width:O.width,height:32,rx:8,fill:O.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(O.daysDelta)>0&&jsxRuntime.jsx("text",{x:O.previewX+O.width/2,y:O.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:O.daysDelta>0?`+${O.daysDelta}d`:`${O.daysDelta}d`})]},`cascade-preview-${O.taskId}`)),h&&(()=>{let{x1:O,y1:B,x2:W,y2:S,onDelete:q}=h,ee=W-O,$=S-B,Me=O+ee/2,be=(B+S)/2,qe=`M ${O} ${B} C ${Me} ${B}, ${Me} ${S}, ${W} ${S}`,ue=6,Qe=Math.atan2($,ee),Te=W-ue*Math.cos(Qe-Math.PI/6),rt=S-ue*Math.sin(Qe-Math.PI/6),gt=W-ue*Math.cos(Qe+Math.PI/6),ft=S-ue*Math.sin(Qe+Math.PI/6),et=t.dependency,R="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>w(null),children:[jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Me,cy:be,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:et,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:qe,fill:"none",stroke:et,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${W} ${S} L ${Te} ${rt} M ${W} ${S} L ${gt} ${ft}`,fill:"none",stroke:et,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:W,cy:S,r:4,fill:et,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ve=>{ve.stopPropagation(),w(null),q();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Me,cy:be,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:R,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Me-3,y1:be-3,x2:Me+3,y2:be+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Me+3,y1:be-3,x2:Me-3,y2:be+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Ie>=0&&Ie<=v&&jsxRuntime.jsx("line",{x1:Ie,y1:0,x2:Ie,y2:Le,stroke:t.today,strokeWidth:2,opacity:1,style:{pointerEvents:"none"}}),x&&jsxRuntime.jsx(wd,{tooltipData:x,theme:t})]})]})}var dn=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Ws=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Hs=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function cn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:y}){let f=[...Ws,...n.filter(R=>!Ws.some(se=>se.id===R.id))],g=Ge[p]||Ge.dark,[x,b]=react.useState(false),[h,w]=react.useState(false),[D,N]=react.useState(false),[M,v]=react.useState(false),[L,T]=react.useState({top:0,left:0}),[k,F]=react.useState(null),[P,H]=react.useState(new Date),[X,ye]=react.useState({top:0,left:0}),[we,Ie]=react.useState(false),[Le,O]=react.useState([]),B=react.useRef(null),W=react.useRef(null),S=react.useRef(null),q=react.useRef(null),ee=react.useRef(null),[$,Me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[be,qe]=react.useState({});react.useEffect(()=>{a?(Me({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ie(true)):(Me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ie(false),O([]));},[a,e]),react.useEffect(()=>{let R=se=>{B.current&&!B.current.contains(se.target)&&b(false),W.current&&!W.current.contains(se.target)&&w(false),S.current&&!S.current.contains(se.target)&&N(false),q.current&&!q.current.contains(se.target)&&v(false);};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);let ue=()=>{let R={};return $.name.trim()||(R.name="El nombre es requerido"),$.startDate&&$.endDate&&$.startDate>$.endDate&&(R.endDate="La fecha de fin debe ser posterior a la de inicio"),qe(R),Object.keys(R).length===0},Qe=async R=>{if(R.preventDefault(),!!ue())try{let se=c==="create"&&Le.length>0?{...$,pendingFiles:Le}:$;await s(se),O([]),t();}catch(se){console.error("Error submitting task:",se);}},Te=(R,se)=>{Me(ve=>{let De={...ve,[R]:se};if(R==="status"){let Ee=se;Ee==="todo"?De.progress=0:Ee==="in-progress"?(ve.progress===0||ve.progress===100)&&(De.progress=50):Ee==="completed"||Ee==="closed"?De.progress=100:(Ee==="in-review"||Ee==="review")&&(De.progress=75);}if(R==="progress"){let Ee=typeof se=="number"?se:parseInt(se,10);Ee===100&&ve.status!=="completed"?De.status="completed":Ee>0&&Ee<100&&ve.status==="todo"?De.status="in-progress":Ee===0&&ve.status!=="todo"&&(De.status="todo");}return De}),be[R]&&qe(ve=>{let De={...ve};return delete De[R],De});},rt=f.find(R=>R.id===$.status)??Ws[0],gt=Hs.find(R=>R.id===$.priority)??Hs[1],ft=dn.find(R=>R.value===$.color)??dn[0],et={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:R=>R.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:R=>{R.currentTarget.style.backgroundColor=g.hoverBg,R.currentTarget.style.color=g.textPrimary;},onMouseLeave:R=>{R.currentTarget.style.backgroundColor="transparent",R.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Qe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:$.name,onChange:R=>Te("name",R.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),be.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),be.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:$.description||"",onChange:R=>Te("description",R.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:B,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&b(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...et,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsxRuntime.jsx("span",{style:{color:rt.color},children:rt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:f.map(R=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",R.id),b(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:R.color}}),R.title,$.status===R.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},R.id))})})]}),jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsxRuntime.jsx("span",{children:gt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Hs.map(R=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",R.id),w(false);},children:[jsxRuntime.jsx("span",{children:R.icon}),R.label,$.priority===R.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},R.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:S,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[$.assignees&&$.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:$.assignees.slice(0,3).map((R,se)=>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:R.color||g.accent,borderColor:g.bgSecondary},children:R.initials},se))}),$.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",$.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(R=>{let se=$.assignees?.some(ve=>ve.name===R.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ve=se?($.assignees||[]).filter(De=>De.name!==R.name):[...$.assignees||[],{name:R.name,avatar:R.avatar,initials:R.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Te("assignees",ve);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:g.accent},children:R.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:R.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},R.id)})})})]}),jsxRuntime.jsxs("div",{ref:q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(M)v(false);else {if(q.current){let R=q.current.getBoundingClientRect(),se=window.innerHeight,ve=120,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;T({top:Ee,left:R.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:et,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:$.color}}),jsxRuntime.jsx("span",{children:ft.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(tt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(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:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:R=>R.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:dn.slice(0,18).map(R=>{let se=$.color===R.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{Te("color",R.value),v(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:R.value,outline:se?`2px solid ${R.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:R.name},R.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Rr,{selectedTags:$.tags||[],availableTags:m,onChange:R=>Te("tags",R),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(k==="start")F(null);else {if(ee.current){let R=ee.current.getBoundingClientRect(),se=window.innerHeight,ve=320,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;ye({top:Ee,left:R.left});}F("start"),H($.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.startDate?$.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!$.isMilestone)if(k==="end")F(null);else {if(ee.current){let R=ee.current.getBoundingClientRect(),se=window.innerHeight,ve=320,Ee=se-R.bottom<ve?R.top-ve-8:R.bottom+8;ye({top:Ee,left:R.left});}F("end"),H($.endDate||$.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...et,opacity:$.isMilestone?.5:1,cursor:$.isMilestone?"not-allowed":"pointer"},disabled:l||$.isMilestone,children:$.endDate?$.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(tt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:R=>R.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let R=new Date,se=new Date(R);se.setDate(R.getDate()+1);let ve=new Date(R);ve.setDate(R.getDate()+7);let De=new Date(R);return De.setDate(R.getDate()+14),[{label:"Hoy",date:R},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:ve},{label:"2 semanas",date:De}].map((Ve,Ct)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{k==="start"?(Te("startDate",Ve.date),(!$.endDate||Ve.date>$.endDate)&&Te("endDate",Ve.date),F("end")):(Te("endDate",Ve.date),(!$.startDate||Ve.date<$.startDate)&&Te("startDate",Ve.date),F(null));},children:Ve.label},Ct))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:R=>R.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),F(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:()=>H(new Date(P.getFullYear(),P.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:P.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(P.getFullYear(),P.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((R,se)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:R},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let R=P.getFullYear(),se=P.getMonth(),ve=new Date(R,se,1).getDay(),De=new Date(R,se+1,0).getDate(),Ee=new Date,Ve=[];for(let Y=ve-1;Y>=0;Y--)Ve.push({day:new Date(R,se,-Y).getDate(),date:new Date(R,se-1,new Date(R,se,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=De;Y++)Ve.push({day:Y,date:new Date(R,se,Y),isCurrentMonth:true});let Ct=42-Ve.length;for(let Y=1;Y<=Ct;Y++)Ve.push({day:Y,date:new Date(R,se+1,Y),isCurrentMonth:false});return Ve.map((Y,z)=>{let ke=Y.date.toDateString()===Ee.toDateString(),We=$.startDate?.toDateString()===Y.date.toDateString(),Ue=$.endDate?.toDateString()===Y.date.toDateString(),ht=$.startDate&&$.endDate&&Y.date>=$.startDate&&Y.date<=$.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:Y.isCurrentMonth?We||Ue?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:We?"#3B82F6":Ue?"#7C3AED":ht?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ke&&!We&&!Ue?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{k==="start"?(Te("startDate",Y.date),$.endDate&&Y.date>$.endDate&&Te("endDate",Y.date),F("end")):(Te("endDate",Y.date),$.startDate&&Y.date<$.startDate&&Te("startDate",Y.date),F(null));},children:Y.day},z)})})()})]})]})]})})]}),be.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:be.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:$.progress,onChange:R=>Te("progress",parseInt(R.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"}20`,color:$.progress<30?"#EF4444":$.progress<70?"#F59E0B":"#10B981"},children:[$.progress,"%"]})]})]}),(u||i.length>0||c==="create")&&jsxRuntime.jsxs("div",{className:"pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",c==="create"?Le.length>0&&`(${Le.length})`:i.length>0&&`(${i.length})`]})]}),c==="create"?jsxRuntime.jsx(za,{cardId:"pending",attachments:Le.map((R,se)=>({id:`pending-${se}`,cardId:"pending",name:R.name,size:R.size,type:R.type,url:URL.createObjectURL(R),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:R=>O(se=>[...se,...R]),onDelete:R=>{let se=parseInt(R.replace("pending-",""),10);O(ve=>ve.filter((De,Ee)=>Ee!==se));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(za,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?R=>u(a.id,R):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),c==="create"&&Le.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Le.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ie(!we),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${we?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:$.isMilestone,onChange:R=>Te("isMilestone",R.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter(R=>R.id!==a?.id).map(R=>{let se=$.dependencies?.includes(R.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ve=se?($.dependencies||[]).filter(De=>De!==R.id):[...$.dependencies||[],R.id];Te("dependencies",ve);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:se?`${g.accent}30`:g.bgPrimary,color:se?g.accent:g.textSecondary,border:`1px solid ${se?g.accent:g.borderLight}`},disabled:l,children:R.name},R.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:R=>!l&&(R.currentTarget.style.opacity="0.9"),onMouseLeave:R=>!l&&(R.currentTarget.style.opacity="1"),children:l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var rf=['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"'],Sd=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),of=()=>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"})}),nf=()=>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"})}),sf=()=>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"})}),lf=()=>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 pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,y]=react.useState([]),[f,g]=react.useState(""),[x,b]=react.useState(false),[h,w]=react.useState(true),D=react.useRef(null),N=react.useRef(null),M=react.useRef(null),{enabled:v=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:k,suggestions:F=rf,maxHistory:P=50,persistHistory:H}=a,X=H?.storageKey||"gantt-ai-history",ye=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let W=localStorage.getItem(X);if(W){let q=JSON.parse(W).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));y(q.slice(-ye));}}catch(W){console.warn("[GanttAIAssistant] Failed to load persisted history:",W);}},[H?.enabled,X,ye]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let W=u.filter(S=>!S.isLoading).slice(-ye);localStorage.setItem(X,JSON.stringify(W));}catch(W){console.warn("[GanttAIAssistant] Failed to persist history:",W);}},[u,H?.enabled,X,ye]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,d]);let we=react.useCallback(W=>{if(W.success)switch(W.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":W.taskId&&W.updates&&o?.(W.taskId,W.updates);break;case "create_task":W.newTask&&s?.(W.newTask);break;case "delete_task":W.taskId&&l?.(W.taskId);break;case "link_tasks":W.dependencyFrom&&W.dependencyTo&&c?.(W.dependencyFrom,W.dependencyTo);break;case "unlink_tasks":W.taskId&&W.dependencyFrom&&p?.(W.taskId,W.dependencyFrom);break}},[o,s,l,c,p]),Ie=react.useCallback(async W=>{if(!W.trim()||x)return;let S={id:`user-${Date.now()}`,role:"user",content:W,timestamp:new Date};y(ee=>[...ee.slice(-(P-1)),S]),g(""),w(false),b(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(ee=>[...ee,q]);try{if(k){let ee=await k(W,e);y($=>{let Me=$.filter(qe=>!qe.isLoading),be={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...Me,be]}),we(ee);}else y(ee=>[...ee.filter(Me=>!Me.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(ee){y($=>[...$.filter(be=>!be.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,P,k,e,we]),Le=W=>{W.preventDefault(),Ie(f);},O=W=>{g(W),D.current?.focus();};if(react.useEffect(()=>{let W=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),m(q=>!q),n||i(false)),S.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),react.useEffect(()=>{if(!n)return;let W=q=>{let ee=q.target;M.current&&!M.current.contains(ee)&&m(false);},S=setTimeout(()=>{document.addEventListener("mousedown",W);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",W);}},[n]),!v)return null;let B={"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(tt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${B[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(Sd,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,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 ${B[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Sd,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(W=>!W),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(nf,{})})]})]}),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:[u.length===0&&h&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:F.slice(0,4).map((W,S)=>jsxRuntime.jsx("button",{onClick:()=>O(W),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:W.length>30?W.slice(0,30)+"...":W},S))})]}),u.map(W=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${W.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${W.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:W.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:W.role==="user"?"white":t.textPrimary},children:[W.isLoading?jsxRuntime.jsx(lf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content}),W.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:W.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:W.command.success?"#10B981":"#EF4444"},children:[W.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:W.command.type.replace(/_/g," ")})]})]})},W.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:Le,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:W=>g(W.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(of,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Ed(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Pd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var mf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ne.formatDate(e.startDate)} - ${ne.formatDate(e.endDate)}`);let a=ne.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=>ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Md(e){return {...mf,...e}}var vf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Ld=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:u,locale:y="en",customTranslations:f,showCreateTaskButton:g=false,createTaskLabel:x,onCreateTask:b,onThemeChange:h,onTaskClick:w,onTaskDblClick:D,onTaskContextMenu:N,onTaskUpdate:M,onProgressChange:v,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:k,onTaskSetInProgress:F,onDependencyCreate:P,onDependencyDelete:H,onBeforeTaskAdd:X,onAfterTaskAdd:ye,onBeforeTaskUpdate:we,onAfterTaskUpdate:Ie,onBeforeTaskDelete:Le,onAfterTaskDelete:O}=a,W=react.useContext(Ko)?.theme,[S,q]=react.useState(W||s||"dark"),[ee,$]=react.useState(l),[Me,be]=react.useState(c),[qe,ue]=react.useState(1),[Qe,Te]=react.useState(0),[rt,gt]=react.useState(false),[ft,et]=react.useState(null),[R,se]=react.useState({isOpen:false,x:0,y:0,task:null}),[ve,De]=react.useState(null),[Ee,Ve]=react.useState(null);react.useEffect(()=>{W&&W!==S&&q(W);},[W]),react.useEffect(()=>{s&&s!==S&&q(s);},[s]);let Ct=react.useCallback(E=>{q(E),h?.(E);},[h]),{state:Y,setState:z,undo:ke,redo:We,canUndo:Ue,canRedo:ht,clearHistory:Z}=Ed(t,50),te=react.useRef(new Map);react.useEffect(()=>{let E=A=>A.map(K=>{let ae=te.current.get(K.id),le=ae!==void 0?{...K,isExpanded:ae}:K;return le.subtasks?.length?{...le,subtasks:E(le.subtasks)}:le});te.current.size>0?z(E(t)):z(t);},[t,z]);let xe=react.useRef(t),Pe=react.useRef(true);react.useEffect(()=>{if(Pe.current){Pe.current=false,xe.current=Y;return}if(!r)return;let E=JSON.stringify(xe.current),A=JSON.stringify(Y);E!==A&&(xe.current=Y,r(Y));},[Y,r]);let J=react.useMemo(()=>Ds(y,f),[y,f]),Ae=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[he,Ne]=react.useState(()=>Ae(J));react.useEffect(()=>{Ne(E=>E.map(A=>({...A,label:J.columns[A.id==="name"?"taskName":A.id]||A.label})));},[J]);let de=react.useMemo(()=>{let E=he.filter(ae=>ae.visible),A=E.some(ae=>ae.id!=="name");return E.reduce((ae,le)=>ae+le.width,0)+(A?20:0)},[he]);react.useEffect(()=>{ft!==null&&ft>de&&(he.filter(K=>K.visible).some(K=>K.id!=="name")||et(null));},[he,de,ft]);let Re=react.useMemo(()=>ft!==null?Math.max(280,ft,de):Math.max(280,de),[ft,de]),Fe=react.useRef(null),Oe=react.useRef(null),_=react.useRef(null),j=react.useMemo(()=>Yl(S),[S]),nt=react.useMemo(()=>({theme:j,themeName:S}),[j,S]),He=react.useMemo(()=>Md(d),[d]),ge=react.useMemo(()=>{if(!i)return Y;let E=ne.calculateCriticalPath(Y),A=K=>K.map(ae=>({...ae,isCriticalPath:E.includes(ae.id),subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(Y)},[Y,i]),Vt=vf(Me);Pd({undo:ke,redo:We,canUndo:Ue,canRedo:ht,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>ne.findTaskById(Y,E),addTask:(E,A)=>{z(K=>{if(!A)return [...K,{...E,level:0}];let ae=le=>le.map(Se=>Se.id===A?{...Se,subtasks:[...Se.subtasks||[],{...E,parentId:A,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},updateTask:(E,A)=>{z(K=>{let ae=le=>le.map(Se=>Se.id===E?{...Se,...A}:Se.subtasks?{...Se,subtasks:ae(Se.subtasks)}:Se);return ae(K)});},deleteTask:E=>{z(A=>{let K=ae=>ae.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=K(le.subtasks)),true));return K(A)});},deleteTasks:E=>{z(A=>Is(A,E));},duplicateTask:E=>{z(A=>Ls(A,[E]));},splitTask:(E,A,K=3)=>{z(ae=>ne.splitTask(ae,E,A,K));},calculateEndDate:ne.calculateEndDate,calculateDuration:ne.calculateDuration,validateDependency:(E,A)=>!ne.validateDependencies(Y,E,A),getAllTasks:()=>ne.flattenTasks(Y),getTasksByStatus:E=>ne.flattenTasks(Y).filter(A=>A.status===E),getTasksByParent:E=>E?ne.findTaskById(Y,E)?.subtasks||[]:Y.filter(K=>!K.parentId),getCriticalPath:()=>ne.flattenTasks(Y).filter(E=>E.isCriticalPath),indentTask:E=>{z(A=>Ps(A,[E]));},outdentTask:E=>{z(A=>Ms(A,[E]));},moveTask:(E,A)=>{z(K=>As(K,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:K}=Rs(Y,E);if(X){let ae=X({...K,parentId:E});if((ae instanceof Promise?await ae:ae)===false)return}z(A),ye&&ye({...K,parentId:E});},scrollToTask:E=>{let K=ne.flattenTasks(Y).findIndex(ae=>ae.id===E);if(K!==-1&&Fe.current){let ae=K*Vt;Fe.current.scrollTo({top:ae,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{z(A=>{let K=ae=>ae.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},collapseTask:E=>{z(A=>{let K=ae=>ae.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},expandAll:()=>{z(E=>{let A=K=>K.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(E)});},collapseAll:()=>{z(E=>{let A=K=>K.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?A(ae.subtasks):void 0}));return A(E)});},undo:ke,redo:We,canUndo:()=>Ue,canRedo:()=>ht,clearHistory:Z,exportToPNG:async()=>{if(!_.current)throw new Error("Gantt container not found");let E=await Id__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2});return new Promise((A,K)=>{E.toBlob(ae=>{ae?A(ae):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async E=>{await ne.exportToPDF(Y,E);},exportToExcel:async E=>{await ne.exportToExcel(Y,E);},exportToJSON:()=>ne.exportToJSON(Y),exportToCSV:()=>ne.exportToCSV(Y),importFromJSON:E=>{let A=ne.importFromJSON(E);z(A);},getTasks:()=>Y,refresh:()=>{z(E=>[...E]);},clearAll:()=>{z([]);}}),[Y,ke,We,Ue,ht,Z,j,Vt]);let Tt=react.useCallback(E=>{Ne(A=>A.map(K=>K.id===E?{...K,visible:!K.visible}:K));},[]),U=react.useCallback((E,A)=>{Ne(K=>K.map(ae=>{if(ae.id!==E)return ae;let le=ae.minWidth??100,Se=ae.maxWidth??800,Bt=Math.max(le,Math.min(Se,A));return {...ae,width:Bt}}));},[]),ce=react.useCallback(E=>{z(A=>{let K=Bs(A,E),ae=le=>{for(let Se of le){if(Se.id===E){te.current.set(E,Se.isExpanded??true);return}Se.subtasks?.length&&ae(Se.subtasks);}};return ae(K),K}),a.onTaskToggleExpand?.(E);},[a]),Ce=react.useCallback((E,A)=>{if(we&&we(E,A)===false)return;let ae=ne.findTaskById(Y,E)?.progress,le=Bt=>Bt.map(Ht=>Ht.id===E?{...Ht,...A}:Ht.subtasks?{...Ht,subtasks:le(Ht.subtasks)}:Ht);z(le(Y));let Se=ne.findTaskById(le(Y),E);Se&&(M?.(Se),Ie?.(Se),A.progress!==void 0&&ae!==void 0&&A.progress!==ae&&v?.(E,ae,A.progress));},[Y,M,we,Ie,v]),zt=react.useCallback(E=>{E.length!==0&&(z(A=>Ps(A,E)),a.onTaskIndent?.(E[0]));},[a]),ea=react.useCallback(E=>{E.length!==0&&(z(A=>Ms(A,E)),a.onTaskOutdent?.(E[0]));},[a]),qa=react.useCallback((E,A,K)=>{z(ae=>gd(ae,E,A,K)),a.onTaskReparent?.(E,A,K);},[a]),Xr=react.useCallback((E,A)=>{E.length!==0&&(z(K=>As(K,E,A)),a.onTaskMove?.(E[0],A));},[a]),ie=react.useCallback(async E=>{let A=[];for(let K of E)Le&&await Promise.resolve(Le(K))===false||A.push(K);A.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(A):(z(K=>Is(K,A)),A.forEach(K=>a.onTaskDelete?.(K))),O&&A.forEach(K=>O(K)));},[a,Le,O]),Dt=react.useCallback(E=>{z(A=>Ls(A,E)),E.forEach(A=>a.onTaskDuplicate?.(A));},[a]),Jt=react.useCallback((E,A)=>{z(K=>{let{tasks:ae,newTask:le}=ud(K,E,A);return X&&X(le)===false?K:(a.onTaskCreate?.(le.parentId,le.position||0),ye?.(le),ae)});},[a,X,ye]),Sr=react.useCallback((E,A)=>{z(K=>Fs(K,E,A)),a.onTaskRename?.(E,A);},[a]),Er=react.useCallback(E=>{z(A=>{let{tasks:K}=Rs(A,E);return a.onTaskCreate?.(E,0),K});},[a]),Pr=react.useCallback((E,A,K)=>{let ae=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/864e5):0,le=Ht=>Ht.map(Zt=>Zt.id===E.id?{...Zt,startDate:A,endDate:K,...E.segments&&{segments:E.segments}}:Zt.subtasks?{...Zt,subtasks:le(Zt.subtasks)}:Zt),Se=le(Y);Se=ne.autoScheduleDependents(Se,E.id,ae),z(Se);let Bt={...E,startDate:A,endDate:K};M?.(Bt);},[Y,M]),Wa=react.useCallback((E,A)=>{N?.(E,A),se({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[N]),ir=react.useCallback((E,A)=>{let K=ne.splitTask(Y,E.id,A);z(K),se({isOpen:false,x:0,y:0,task:null});},[Y]),Et=react.useCallback(E=>{let A=ne.findTaskById(Y,E.id)||E;D?.(A),L||De(A);},[Y,D,L]),So=react.useCallback((E,A,K)=>{let ae=new Map,le=Da=>{Da.forEach(Ha=>{Ha.dependencies&&ae.set(Ha.id,Ha.dependencies),Ha.subtasks&&le(Ha.subtasks);});};le(K);let Se=ae.get(A)||[];ae.set(A,[...Se,E]);let Bt=new Set,Ht=new Set,Zt=Da=>{if(!Bt.has(Da)){Bt.add(Da),Ht.add(Da);let Ha=ae.get(Da)||[];for(let lr of Ha){if(!Bt.has(lr)&&Zt(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(Da),false};return Zt(A)},[]),Eo=react.useCallback((E,A)=>{if(So(E.id,A,Y)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
343
343
|
|
|
344
344
|
Task dependencies must flow in one direction only.`);return}let K=ae=>ae.map(le=>{if(le.id===A){let Se=le.dependencies||[];if(!Se.includes(E.id))return {...le,dependencies:[...Se,E.id]}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});z(K(Y)),P?.(E.id,A);},[Y,P,So]),An=react.useCallback((E,A)=>{let K=ae=>ae.map(le=>{if(le.id===E&&le.dependencies){let Se=le.dependencies.filter(Bt=>Bt!==A);return {...le,dependencies:Se}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});z(K(Y)),H?.(E,A);},[Y,H]),{startDate:Jr,endDate:Kc}=react.useMemo(()=>{let E=Y.filter(Se=>Se.startDate&&Se.endDate);if(E.length===0){let Se=new Date,Bt=new Date(Se);Bt.setDate(Bt.getDate()-30);let Ht=new Date(Se);return Ht.setDate(Ht.getDate()+60),{startDate:Bt,endDate:Ht}}let A=E.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),K=new Date(Math.min(...A.map(Se=>Se.getTime()))),ae=new Date(Math.max(...A.map(Se=>Se.getTime()))),le=ee==="day"?7:ee==="week"?14:30;return K.setDate(K.getDate()-le),ae.setDate(ae.getDate()+le),{startDate:K,endDate:ae}},[Y,ee]),Yc=react.useCallback(async()=>{if(!_.current)return;let E=await Id__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2}),A=document.createElement("a");A.download="gantt-chart.png",A.href=E.toDataURL("image/png"),A.click();},[j]),qc=react.useCallback(async()=>{await ne.exportToPDF(Y);},[Y]),Xc=react.useCallback(async()=>{await ne.exportToExcel(Y);},[Y]),Jc=react.useCallback(()=>{let E=ne.exportToCSV(Y),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(A),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[Y]),Zc=react.useCallback(()=>{let E=ne.exportToJSON(Y),A=new Blob([E],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(A),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[Y]),Qc=react.useCallback(()=>{ne.exportToMSProject(Y,"Gantt Project","project.xml");},[Y]),ep=E=>{E.preventDefault(),gt(true);};return react.useEffect(()=>{let E=Oe.current,A=Fe.current;if(!E||!A)return;let K=A.querySelector(".gantt-taskgrid-content"),ae=()=>{let Zt=E.scrollTop;Te(Zt),K&&(K.style.transform=`translateY(-${Zt}px)`);},le=Zt=>{if(rt&&A){let Ha=A.parentElement?.getBoundingClientRect()?.left||0,lr=Zt.clientX-Ha,tp=280,ap=Math.min(window.innerWidth-300,800);lr>=tp&&lr<=ap&&et(lr);}},Se=()=>{gt(false);},Bt=A.querySelector(".gantt-grid-scroll")||A,Ht=Zt=>{let Da=Zt;Da.deltaY!==0&&(E.scrollTop+=Da.deltaY,Zt.preventDefault());};return E.addEventListener("scroll",ae),Bt.addEventListener("wheel",Ht,{passive:false}),document.addEventListener("mousemove",le),document.addEventListener("mouseup",Se),()=>{E.removeEventListener("scroll",ae),Bt.removeEventListener("wheel",Ht),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Se);}},[rt]),jsxRuntime.jsx(Wr.Provider,{value:J,children:jsxRuntime.jsx(Rn.Provider,{value:nt,children:jsxRuntime.jsxs("div",{ref:_,className:"flex flex-col h-full w-full",style:{backgroundColor:j.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(qo,{theme:j,timeScale:ee,onTimeScaleChange:$,zoom:qe,onZoomChange:ue,currentTheme:S,onThemeChange:Ct,rowDensity:Me,onRowDensityChange:be,showThemeSelector:p,showCreateTaskButton:g,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Yc:void 0,onExportPDF:n?qc:void 0,onExportExcel:n?Xc:void 0,onExportCSV:n?Jc:void 0,onExportJSON:n?Zc:void 0,onExportMSProject:n?Qc:void 0}),jsxRuntime.jsxs("div",{ref:Fe,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Re,overflow:"hidden"},children:jsxRuntime.jsx(Qo,{tasks:ge,theme:j,rowHeight:Vt,availableUsers:m,templates:He,onTaskClick:w,onTaskDblClick:Et,onTaskContextMenu:N,onTaskToggle:ce,scrollTop:Qe,columns:he,onToggleColumn:Tt,onColumnResize:U,onTaskUpdate:Ce,onTaskIndent:zt,onTaskOutdent:ea,onTaskMove:Xr,onMultiTaskDelete:ie,onTaskDuplicate:Dt,onTaskCreate:Jt,onTaskRename:Sr,onCreateSubtask:Er,onOpenTaskModal:w?E=>w(E):void 0,onDeleteRequest:(E,A)=>Ve({taskId:E,taskName:A}),onTaskReparent:qa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:ep}),jsxRuntime.jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ln,{tasks:ge,theme:j,rowHeight:Vt,timeScale:ee,startDate:Jr,endDate:Kc,zoom:qe,templates:He,onTaskClick:w,onTaskDblClick:Et,onTaskContextMenu:Wa,onTaskDateChange:Pr,onDependencyCreate:Eo,onDependencyDelete:An})})]}),R.task&&jsxRuntime.jsx(Hr,{isOpen:R.isOpen,x:R.x,y:R.y,theme:j,onClose:()=>se({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=R.task;if(!E)return [];let A=ne.findTaskById(Y,E.id)||E;return A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?T(A):Er(A.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:A.id,taskName:A.name});}}]:[{id:"edit",label:J.contextMenu?.editTask||"Edit Task",icon:kt.Pencil,onClick:()=>{L?L(A):De(A);}},{id:"addSubtask",label:J.contextMenu?.addSubtask||"Add Subtask",icon:kt.Add,onClick:()=>{T?T(A):Er(A.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:J.contextMenu?.markIncomplete||"Mark Incomplete",icon:kt.MarkIncomplete,onClick:()=>{k?k(A):Ce(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:J.contextMenu?.setInProgress||"Set In Progress",icon:kt.SetInProgress,onClick:()=>{F?F(A):Ce(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:J.contextMenu?.markComplete||"Mark Complete",icon:kt.MarkComplete,onClick:()=>{Ce(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:J.contextMenu?.splitTask||"Split Task",icon:kt.Split,onClick:()=>{if(!A.startDate||!A.endDate){console.warn("Cannot split task without dates");return}let ae=A.startDate.getTime(),le=A.endDate.getTime(),Se=ae+(le-ae)/2,Bt=new Date(Se);ir(A,Bt);},disabled:!A.startDate||!A.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:J.contextMenu?.deleteTask||"Delete Task",icon:kt.Delete,onClick:()=>{Ve({taskId:A.id,taskName:A.name});}}]})()}),ve&&jsxRuntime.jsx(cn,{isOpen:true,onClose:()=>De(null),task:ve,onSubmit:E=>{Ce(ve.id,E),De(null);},mode:"edit",theme:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&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:()=>Ve(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:j.bgSecondary,border:`1px solid ${j.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${j.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:j.textPrimary,fontFamily:"Inter, sans-serif"},children:[J.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:j.textPrimary},children:['"',Ee.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:j.bgPrimary,borderTop:`1px solid ${j.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Ve(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=j.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ie([Ee.taskId]),Ve(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(pn,{tasks:Y,theme:j,config:u,onTasksUpdate:z,onTaskUpdate:Ce,onTaskCreate:E=>{z(A=>[...A,E]);},onTaskDelete:E=>{ie([E]);},onDependencyCreate:(E,A)=>{let K=ne.findTaskById(Y,E);K&&Eo(K,A);},onDependencyDelete:An})]})})})});var Fd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
345
345
|
|