zegantt 0.2.7 → 0.2.8
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/zegantt.js +3 -3
- package/dist/zegantt.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/zegantt.js
CHANGED
|
@@ -1181,21 +1181,21 @@ function St() {
|
|
|
1181
1181
|
/* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: 2, padding: "8px 6px" }, children: [
|
|
1182
1182
|
/* @__PURE__ */ r("button", { onClick: () => {
|
|
1183
1183
|
xe?.(We(o)), ve();
|
|
1184
|
-
}, className: "zg-popup-btn", children: [
|
|
1184
|
+
}, className: "zg-popup-btn", style: { display: "flex", alignItems: "center", gap: 10, width: "100%", padding: "8px 10px", borderRadius: 7, border: "none", background: "transparent", cursor: "pointer", fontSize: 13, fontWeight: 500, color: e.textPrimary, textAlign: "left" }, children: [
|
|
1185
1185
|
/* @__PURE__ */ t(at, { size: 15 }),
|
|
1186
1186
|
" ",
|
|
1187
1187
|
/* @__PURE__ */ t("span", { style: { flex: 1, textAlign: "left" }, children: C("gantt.popup.viewDetails", "View details") })
|
|
1188
1188
|
] }),
|
|
1189
1189
|
/* @__PURE__ */ r("button", { onClick: () => {
|
|
1190
1190
|
B?.(We(o)), ve();
|
|
1191
|
-
}, className: "zg-popup-btn", children: [
|
|
1191
|
+
}, className: "zg-popup-btn", style: { display: "flex", alignItems: "center", gap: 10, width: "100%", padding: "8px 10px", borderRadius: 7, border: "none", background: "transparent", cursor: "pointer", fontSize: 13, fontWeight: 500, color: e.textPrimary, textAlign: "left" }, children: [
|
|
1192
1192
|
/* @__PURE__ */ t(st, { size: 15 }),
|
|
1193
1193
|
" ",
|
|
1194
1194
|
/* @__PURE__ */ t("span", { style: { flex: 1, textAlign: "left" }, children: C("gantt.popup.edit", "Edit") })
|
|
1195
1195
|
] }),
|
|
1196
1196
|
/* @__PURE__ */ r("button", { onClick: () => {
|
|
1197
1197
|
O?.(o.id), ve();
|
|
1198
|
-
}, className: "zg-popup-btn zg-popup-btn-danger", children: [
|
|
1198
|
+
}, className: "zg-popup-btn zg-popup-btn-danger", style: { display: "flex", alignItems: "center", gap: 10, width: "100%", padding: "8px 10px", borderRadius: 7, border: "none", background: "transparent", cursor: "pointer", fontSize: 13, fontWeight: 500, color: "#ef4444", textAlign: "left" }, children: [
|
|
1199
1199
|
/* @__PURE__ */ t(dt, { size: 15 }),
|
|
1200
1200
|
" ",
|
|
1201
1201
|
/* @__PURE__ */ t("span", { style: { flex: 1, textAlign: "left" }, children: C("gantt.popup.delete", "Delete") })
|
package/dist/zegantt.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(R,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","lucide-react"],e):(R=typeof globalThis<"u"?globalThis:R||self,e(R.ZeGantt={},R.jsxRuntime,R.React,R.lucideReact))})(this,(function(R,e,h,L){"use strict";const Ee=h.createContext(void 0);function Pe({children:o,value:p}){return e.jsx(Ee.Provider,{value:p,children:o})}function ge(){const o=h.useContext(Ee);if(!o)throw new Error("useGanttContext must be used within a GanttProvider");return o}const U={white:"#FFFFFF",dark_gray:"#4F4F4F",gray:"#7B7B7B",light_gray:"#D9D9D9",dark_green:"#1A3C30",water_green:"#7ab7a3",light_green:"#A0D8A8",orange:"#CD6200",yellow:"#FFBB1C",red:"#FF0000"},t={pageBg:"#F8FAFB",surface:U.white,surfaceAlt:"#F7FAF8",headerBg:"#F2F5F3",textTitle:U.dark_green,textPrimary:U.dark_gray,textSecondary:U.gray,textMuted:U.light_gray,group:U.dark_green,groupLight:U.water_green,milestone:U.dark_green,milestoneRing:U.light_green,event:U.orange,note:U.yellow,border:U.light_gray,borderLight:"#ECECEC",weekendBg:"#F4F6F5",today:U.red,todayBg:"#FF000008",arrow:U.gray,arrowHover:U.dark_green},X=50,he=32,Ne=he*2,Ye=460,ee=26,de=28,Me=120,Oe=40,Xe=3.5,te=[{bar:"#D1D8A0",barBorder:"#A0D8A8",progress:"#1A3C30"},{bar:"#A0D8C8",barBorder:"#6BBFA8",progress:"#14534A"},{bar:"#B8C9E8",barBorder:"#8AAAD6",progress:"#2C4A70"},{bar:"#E8C9A0",barBorder:"#D6AA7A",progress:"#6B4510"},{bar:"#D8A0C8",barBorder:"#C47AAE",progress:"#6B2058"},{bar:"#A0C8D8",barBorder:"#74ACBF",progress:"#1A4F60"},{bar:"#C8D8A0",barBorder:"#A8BF74",progress:"#3F5014"},{bar:"#D8B0A0",barBorder:"#C4907A",progress:"#6B3020"},{bar:"#B0A0D8",barBorder:"#937ACE",progress:"#3A2070"},{bar:"#A0D8B0",barBorder:"#70C888",progress:"#1A5030"}],$e={step:"Steps",milestone:"Milestones",event:"Events",note:"Notes"};function _e(){const{props:o,t:p,viewMode:g,setViewMode:m,visibleTypes:f,setVisibleTypes:w,newActionOpen:b,setNewActionOpen:M,newActionRef:I}=ge(),{projectName:y,onAddNewStage:D,onAddMilestone:v,onAddEvent:$,onAddNote:S}=o,z=n=>{w(s=>{const k=new Set(s);return k.has(n)?k.delete(n):k.add(n),k})};return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${t.border}`,background:`linear-gradient(180deg, ${t.headerBg} 0%, ${t.surface} 100%)`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,fontSize:14,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:t.textTitle},children:p("planning.gantt","Project Planning")}),e.jsx("div",{style:{height:2.5,width:64,marginTop:6,borderRadius:9999,background:`linear-gradient(90deg, ${t.group}, ${t.milestoneRing})`}})]}),y&&e.jsx("span",{style:{fontSize:12,fontWeight:500,padding:"4px 12px",borderRadius:9999,color:t.textSecondary,background:t.surface,border:`1px solid ${t.border}`},children:y})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:["day","month"].map(n=>e.jsx("button",{onClick:()=>m(n),style:{padding:"6px 20px",fontSize:12,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...g===n?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{background:"transparent",color:t.textSecondary}},children:n==="day"?p("charts.gantt.month","Month"):p("charts.gantt.year","Year")},n))}),e.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,gap:2,background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:[{type:"step",label:p("gantt.filter.steps","Steps"),icon:e.jsx("div",{style:{width:10,height:10,borderRadius:2,background:te[0].bar,border:`1px solid ${te[0].barBorder}`}})},{type:"milestone",label:p("gantt.filter.milestones","Milestones"),icon:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})},{type:"event",label:p("gantt.filter.events","Events"),icon:e.jsx(L.Clock,{size:11,style:{color:t.event}})},{type:"note",label:p("gantt.filter.notes","Notes"),icon:e.jsx(L.MessageCircle,{size:11,style:{color:t.note}})}].map(n=>{const s=f.has(n.type);return e.jsxs("button",{onClick:()=>z(n.type),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",fontSize:11,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...s?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{background:"transparent",color:t.textMuted,opacity:.5}},children:[n.icon,e.jsx("span",{children:n.label})]},n.type)})}),D&&e.jsxs("div",{ref:I,style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>M(n=>!n),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:600,color:"#fff",border:"none",cursor:"pointer",background:`linear-gradient(135deg, ${t.group}, ${t.group}dd)`,transition:"all 0.2s"},children:[e.jsx(L.Plus,{size:16}),e.jsx("span",{children:p("charts.gantt.newAction","New Action")}),e.jsx(L.ChevronDown,{size:14,style:{opacity:.7,transform:b?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),b&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:n=>n.stopPropagation(),children:[{label:p("gantt.newAction.step","Step"),icon:e.jsx("div",{style:{width:14,height:14,borderRadius:3,background:te[0].bar,border:`1.5px solid ${te[0].barBorder}`,flexShrink:0}}),action:()=>{D(),M(!1)}},{label:p("gantt.newAction.milestone","Milestone"),icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})}),action:()=>{v?.(),M(!1)}},{label:p("gantt.newAction.event","Event"),icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.event}18`,border:`1.5px solid ${t.event}55`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:11,style:{color:t.event}})}),action:()=>{$?.(),M(!1)}},{label:p("gantt.newAction.note","Note"),icon:e.jsx("div",{style:{width:16,height:20,background:t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible",flexShrink:0},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),action:()=>{S?.(),M(!1)}}].map(n=>e.jsxs("button",{onClick:n.action,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left",transition:"background 0.12s"},onMouseEnter:s=>{s.currentTarget.style.background=t.headerBg},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[n.icon,n.label]},n.label))})]})]})]})}const Ae=864e5,J=(o,p)=>new Date(o.getTime()+p*Ae),le=(o,p)=>Math.round((p.getTime()-o.getTime())/Ae),ze=o=>new Date(o.getFullYear(),o.getMonth(),1),De=o=>new Date(o.getFullYear(),o.getMonth()+1,0),Z=o=>`${String(o.getDate()).padStart(2,"0")}/${String(o.getMonth()+1).padStart(2,"0")}/${o.getFullYear()}`,We=(o,p="en")=>new Intl.DateTimeFormat(p,{month:"long"}).format(o).toUpperCase();function Ge(){const{props:o,t:p,displayRows:g,leftBodyRef:m,handleLeftScroll:f,toggleProject:w,toggleGroup:b,hoveredTaskId:M,setHoveredTaskId:I,selectedTaskId:y,setSelectedTaskId:D,delayedIds:v,criticalIds:$,relatedIds:S}=ge(),z=n=>({id:n.id,name:n.name,start:n.start,end:n.end,type:n.originalType==="step"?"task":"milestone",progress:n.progress});return e.jsxs("div",{style:{width:Ye,flexShrink:0,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",height:Ne,background:t.headerBg,borderBottom:`1px solid ${t.border}`},children:[e.jsx("div",{style:{flex:1,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:t.textSecondary},children:p("charts.gantt.stepName","STEP NAME")}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:t.textSecondary},children:p("charts.gantt.start","START")}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:t.textSecondary},children:p("charts.gantt.end","END")})]}),e.jsx("div",{ref:m,onScroll:f,className:"zg-no-scrollbar",style:{overflowY:"auto",overflowX:"hidden",flex:1},children:e.jsx("div",{style:{height:Math.max(g.length*X,400)+80,position:"relative"},children:g.map(n=>{if(n.kind==="projectHeader")return e.jsx("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",height:X,borderBottom:`1.5px solid ${t.group}44`,background:`${t.group}0E`},onClick:()=>w(n.projectId),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[n.collapsed?e.jsx(L.ChevronRight,{size:15,style:{color:t.group,flexShrink:0}}):e.jsx(L.ChevronDown,{size:15,style:{color:t.group,flexShrink:0}}),e.jsx("span",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:t.group,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.projectTitle})]})},`ph-${n.projectId}`);if(n.kind==="group"){const A=n.projectId?`${n.projectId}-${n.groupType}`:n.groupType;return e.jsx("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",height:X,borderBottom:`1px solid ${t.border}`,background:t.headerBg},onClick:()=>b(A),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[n.collapsed?e.jsx(L.ChevronRight,{size:14,style:{color:t.textSecondary,flexShrink:0}}):e.jsx(L.ChevronDown,{size:14,style:{color:t.textSecondary,flexShrink:0}}),e.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:t.textTitle},children:p(`gantt.group.${n.groupType}`,n.label)}),e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:9999,background:"rgba(0,0,0,0.06)",color:t.textSecondary},children:n.count})]})},`g-${A}`)}const s=n.task,k=y===s.id,c=M===s.id,C=s.originalType!=="step",u=v.has(s.id),T=$.has(s.id),i=y!==null&&s.id!==y&&!S.has(s.id),x=y!==null&&S.has(s.id),N=u?"#FFF5F5":k?t.groupLight:x?`${t.groupLight}99`:c?t.pageBg:t.surface;return e.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",transition:"opacity 0.18s, background 0.15s",height:X,borderBottom:`1px solid ${t.borderLight}`,background:N,borderLeft:k?`3px solid ${t.group}`:x?`3px solid ${t.group}66`:T?`3px solid ${t.today}`:void 0,opacity:i?.3:1},onClick:()=>D(A=>A===s.id?null:s.id),onDoubleClick:()=>o.onTaskClick?.(z(s)),onMouseEnter:()=>I(s.id),onMouseLeave:()=>I(null),children:[e.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,paddingRight:8},children:[s.originalType==="step"&&e.jsx("div",{style:{flexShrink:0,borderRadius:4,width:14,height:14,background:te[s.colorIdx??0].bar,border:`1.5px solid ${te[s.colorIdx??0].barBorder}`}}),s.originalType==="milestone"&&e.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`},children:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})}),s.originalType==="event"&&e.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:`${t.event}18`,border:`1.5px solid ${t.event}55`},children:e.jsx(L.Clock,{size:11,style:{color:t.event}})}),s.originalType==="note"&&e.jsx("div",{style:{flexShrink:0,width:16,height:20,background:s.noteColor||t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible"},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,lineHeight:1.25,color:k?t.group:u?t.today:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.originalType==="note"&&s.noteProjectTitle&&e.jsx("span",{style:{fontSize:10,color:t.textSecondary,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.noteProjectTitle})]}),s.originalType==="note"&&(s.filesCount||0)>0&&e.jsxs("span",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:2,fontSize:10,padding:"2px 6px",borderRadius:9999,color:t.textSecondary,background:t.headerBg,border:`1px solid ${t.borderLight}`},children:[e.jsx(L.Paperclip,{size:9}),s.filesCount]}),u&&e.jsx(L.AlertTriangle,{size:12,style:{flexShrink:0,color:t.today}})]}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:u?t.today:t.textMuted},children:Z(s.start)}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:u?t.today:t.textMuted},children:C?"—":Z(s.end)})]},s.id)})})})]})}function He(o,p,g="en"){const m=p==="day"?Oe:Xe,f=(n,s)=>{const k=[],c=new Date().toDateString();let C=-1;for(let u=0;u<s;u++){const T=J(n,u),i=T.toDateString()===c;i&&(C=u),k.push({date:T,isToday:i,isWeekend:T.getDay()===0||T.getDay()===6})}return{daysArr:k,todayIndex:C}};if(o.length===0){const n=new Date,s=ze(n),k=De(n),c=le(s,k)+1,{daysArr:C,todayIndex:u}=f(s,c);return{start:s,end:k,totalDays:c,dayWidth:m,totalWidth:c*m,months:[{date:s,label:`${We(s,g)} ${s.getFullYear()}`,startDay:0,days:c,width:c*m}],years:[{label:s.getFullYear().toString(),width:c*m}],days:C,todayIndex:u}}let w=new Date(o[0].start),b=new Date(o[0].end);o.forEach(n=>{n.start<w&&(w=new Date(n.start)),n.end>b&&(b=new Date(n.end))});const M=ze(J(w,-14)),I=De(J(b,14)),y=le(M,I)+1,D=[];let v=new Date(M);for(;v<=I;){const n=De(v),s=n>I?I:n,k=le(M,v),c=le(v,s)+1;D.push({date:new Date(v),label:`${We(v,g)} ${v.getFullYear()}`,startDay:k,days:c,width:c*m}),v=new Date(v.getFullYear(),v.getMonth()+1,1)}const{daysArr:$,todayIndex:S}=f(M,y),z=[];if(p==="month"){let n="",s=0;for(const k of D){const c=k.date.getFullYear().toString();c!==n?(n&&z.push({label:n,width:s*m}),n=c,s=k.days):s+=k.days}n&&z.push({label:n,width:s*m})}return{start:M,end:I,totalDays:y,dayWidth:m,totalWidth:y*m,months:D,years:z,days:$,todayIndex:S}}function re(o,p){return le(p.start,o)*p.dayWidth}function Ve({task:o,x:p,y:g,w:m,progW:f,isHov:w,isDrag:b,isResize:M,isCritical:I,isDelayed:y,isConnectTarget:D,showDots:v,isBarDimmed:$,isBarHighlighted:S,commonEvents:z,handleResizeMouseDown:n,handleConnectDotMouseDown:s}){const{timeline:k,viewMode:c}=ge();if(o.originalType==="step"){const C=te[o.colorIdx??0],u=g+(X-ee)/2,T=!!(o.previsionStart&&o.previsionEnd),i=T?re(o.previsionStart,k):0,x=T?Math.max(re(o.previsionEnd,k)-i,c==="month"?k.dayWidth:6):0,N=u+ee+3;return e.jsxs(e.Fragment,{children:[T&&e.jsx("div",{title:`Previsto: ${Z(o.previsionStart)} → ${Z(o.previsionEnd)}`,style:{position:"absolute",left:i,top:N,width:x,height:5,borderRadius:3,background:`${C.progress}33`,border:`1.5px solid ${C.progress}66`,boxShadow:`inset 0 0 0 1px ${C.progress}22`,pointerEvents:"none",zIndex:5}}),e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p,top:u,width:m,height:ee,borderRadius:ee/2,background:y?"linear-gradient(135deg, #fdd, #fee)":C.bar,border:I?`2px solid ${t.today}`:y?`1.5px solid ${t.today}88`:`1.5px solid ${C.barBorder}`,cursor:b||M?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${C.progress}22`:"none",transform:w?"scaleY(1.06)":"scaleY(1)",opacity:$?.15:1,transition:b||M?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[e.jsxs("div",{style:{position:"absolute",left:0,top:0,width:m,height:"100%",borderRadius:ee/2,overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,width:f,height:"100%",background:y?`linear-gradient(90deg, ${t.today}cc, ${t.today}88)`:`linear-gradient(90deg, ${C.progress}, ${C.progress}cc)`,borderRadius:`${ee/2}px 0 0 ${ee/2}px`,transition:b||M?"none":"width 0.3s"}}),m>50&&e.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:o.progress>50?"#fff":y?t.today:C.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(o.progress),"%"]})]}),e.jsx("div",{onMouseDown:A=>n(A,o,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${ee/2}px 0 0 ${ee/2}px`}}),e.jsx("div",{onMouseDown:A=>n(A,o,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${ee/2}px ${ee/2}px 0`}}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:A=>s(A,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:A=>s(A,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})]})}if(o.originalType==="milestone"){const C=g+(X-de)/2;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p-6,top:C,height:de,minWidth:Me,borderRadius:de/2,background:I?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #e8f5ee, #f0f8f4)",border:D?`2px solid ${t.group}`:I?`2px solid ${t.today}`:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${t.milestone}22`:"0 1px 3px rgba(0,0,0,0.06)",opacity:$?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:I?t.today:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:11,color:"#fff",strokeWidth:2.5})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:I?t.today:t.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:o.name}),o.progress>=100&&e.jsx("span",{style:{fontSize:9,fontWeight:700,color:"#fff",background:t.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="event"){const C=g+(X-de)/2;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p-6,top:C,height:de,minWidth:Me,borderRadius:de/2,background:I?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #fff7ed, #ffedd5)",border:D?`2px solid ${t.group}`:I?`2px solid ${t.today}`:`1.5px solid ${t.event}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${t.event}33`:"0 1px 3px rgba(0,0,0,0.06)",opacity:$?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:I?t.today:t.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:11,color:"#fff",strokeWidth:2.5})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:I?t.today:t.event,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:o.name}),o.progress>=100&&e.jsx("span",{style:{fontSize:9,fontWeight:700,color:"#fff",background:t.event,borderRadius:6,padding:"1px 5px"},children:"✓"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="note"){const u=g+4,T=o.noteColor||"#FEF08A",i=o.filesCount||0;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p,top:u,width:148,minHeight:72,background:T,borderRadius:3,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 4px 6px 16px rgba(0,0,0,0.22)`:S&&!w?`0 0 0 2px ${t.group}99, 3px 4px 14px rgba(0,0,0,0.18)`:w?"4px 6px 18px rgba(0,0,0,0.22)":"2px 3px 8px rgba(0,0,0,0.13)",opacity:$?.2:1,transition:b?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"rotate(-1.5deg) scale(1.03) translateY(-2px)":"rotate(0deg)",border:"1px solid rgba(0,0,0,0.06)",padding:"12px 10px 10px",display:"flex",flexDirection:"column",gap:2,userSelect:"none"},children:[e.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:11,background:"rgba(255,255,255,0.55)",borderRadius:2,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"}}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#1a1a1a",lineHeight:"1.3",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o.name}),o.projectTitle&&e.jsx("span",{style:{fontSize:10,fontWeight:400,color:"rgba(0,0,0,0.55)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.projectTitle}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[e.jsx("span",{style:{fontSize:9,fontWeight:500,color:"rgba(0,0,0,0.45)"},children:Z(o.start)}),i>0&&e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:9,color:"rgba(0,0,0,0.45)"},children:[e.jsx(L.Paperclip,{size:8})," ",i]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:x=>s(x,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:x=>s(x,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}return null}function Ue(){const{arrows:o,hoveredTaskId:p,selectedTaskId:g,relatedIds:m}=ge();return e.jsx(e.Fragment,{children:o.map((f,w)=>{const b=p===f.predId||p===f.succId,M=!g||f.predId===g||f.succId===g||m.has(f.predId)||m.has(f.succId),I=g!==null&&M,y=b?t.arrowHover:I?t.group:t.arrow;return e.jsxs("g",{style:{opacity:M?I?1:void 0:.08,transition:"opacity 0.18s"},children:[e.jsx("path",{d:f.path,fill:"none",stroke:y,strokeWidth:I?2.5:b?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),e.jsx("polygon",{points:`${f.headX},${f.headY} ${f.headX-6},${f.headY-4} ${f.headX-6},${f.headY+4}`,fill:y,style:{transition:"fill 0.2s"}})]},w)})})}const Ce=o=>({id:o.id,name:o.name,start:o.start,end:o.end,type:o.originalType==="step"?"task":o.originalType,progress:o.progress}),fe=(o,p)=>{switch(o){case"step":return e.jsx("div",{style:{width:12,height:12,borderRadius:2,background:te[p??0].bar,border:`1.5px solid ${te[p??0].barBorder}`,flexShrink:0}});case"milestone":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:8,color:"#fff"})});case"event":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:8,color:"#fff"})});case"note":return e.jsx("div",{style:{width:12,height:14,background:t.note,borderRadius:2,boxShadow:"1px 1px 2px rgba(0,0,0,0.1)",flexShrink:0}});default:return null}};function qe(){const{props:o,viewMode:p,timeline:g,displayRows:m,dragState:f,resizeState:w,connectState:b,pendingConnection:M,setPendingConnection:I,depModalType:y,setDepModalType:D,depModalLag:v,setDepModalLag:$,depCreating:S,deletingDepId:z,setDeletingDepId:n,chartMenu:s,setChartMenu:k,rightBodyRef:c,timeHeaderRef:C,handleChartMouseDown:u,handleChartWheel:T,openChartMenu:i,handleRightScroll:x,hoveredTaskId:N,setHoveredTaskId:A,selectedTaskId:q,setSelectedTaskId:Y,tooltip:a,setTooltip:O,popupState:G,setPopupState:K,criticalIds:V,delayedIds:se,relatedIds:ce,handleBarMouseDown:we,handleResizeMouseDown:ue,handleConnectDotMouseDown:Se,handleCreateDependency:ke}=ge(),{translations:ie,onViewStage:ye,onEditStage:j,onDeleteStage:_,onDeleteDependency:xe,onAddNewStage:me,onAddMilestone:Ie,onAddEvent:Te,onAddNote:ae}=o,F=(r,d)=>ie?typeof ie=="function"?ie(r,d):ie[r]||d:d,be=(r,d)=>Math.round((d.getTime()-r.getTime())/864e5)+1,oe=Math.max(m.length*X,400)+80,ve=()=>K({isOpen:!1,position:{x:0,y:0},task:null});return e.jsxs("div",{style:{flex:1,width:"100%",background:"#FAFAFA",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",borderLeft:`1px solid ${t.borderLight}`},children:[e.jsx("div",{ref:C,style:{boxSizing:"border-box",height:he*2,background:t.headerBg,borderBottom:`1px solid ${t.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:"0 1px 3px rgba(0,0,0,0.02)"},onWheel:T,children:e.jsxs("div",{style:{width:g.totalWidth,height:"100%",position:"relative"},children:[e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:he,display:"flex"},children:[p==="day"&&g.months.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:r.label})},d)),p==="month"&&g.years?.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:r.label})},d))]}),e.jsxs("div",{style:{position:"absolute",top:he,left:0,right:0,height:he,display:"flex"},children:[p==="day"&&g.days.map((r,d)=>{const l=r.isToday;return e.jsx("div",{style:{width:g.dayWidth,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:l?800:500,color:l?t.today:t.textSecondary,letterSpacing:"-0.03em"},children:r.date.getDate().toString().padStart(2,"0")})},d)}),p==="month"&&g.months.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:r.label.substring(0,3)})},d))]})]})}),e.jsx("div",{ref:c,className:"zg-no-scrollbar",style:{flex:1,overflow:"auto",background:"#fff",position:"relative"},onScroll:x,onMouseDown:u,onWheel:T,onContextMenu:i,children:e.jsxs("div",{style:{width:g.totalWidth,height:oe,position:"relative"},children:[e.jsxs("svg",{width:g.totalWidth,height:oe,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsxs("defs",{children:[e.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:g.dayWidth,height:X,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:g.dayWidth,y1:"0",x2:g.dayWidth,y2:X,stroke:t.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),e.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:g.dayWidth,height:X,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:"0",y1:X,x2:g.dayWidth,y2:X,stroke:t.borderLight,strokeWidth:"1"})})]}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),p==="day"&&g.days.map((r,d)=>r.isWeekend?e.jsx("rect",{x:d*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.weekendBg,opacity:.6},`we-${d}`):null),p==="month"&&g.days.map((r,d)=>r.isWeekend?e.jsx("rect",{x:d*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.weekendBg,opacity:.3},`wem-${d}`):null),g.todayIndex>=0&&e.jsxs("g",{children:[e.jsx("rect",{x:g.todayIndex*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.todayBg}),e.jsx("line",{x1:(g.todayIndex+.5)*g.dayWidth,y1:0,x2:(g.todayIndex+.5)*g.dayWidth,y2:oe,stroke:t.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),m.map((r,d)=>r.kind==="group"||r.kind==="projectHeader"?e.jsx("div",{style:{boxSizing:"border-box",position:"absolute",left:0,top:d*X,width:"100%",height:X,background:r.kind==="projectHeader"?t.headerBg:`${t.groupLight}15`,borderBottom:`1px solid ${t.borderLight}`,pointerEvents:"none"}},`bg-${d}`):null),e.jsxs("div",{style:{position:"absolute",inset:0},children:[m.map((r,d)=>{if(r.kind!=="task")return null;const l=r.task,E=f?.task.id===l.id,B=w?.task.id===l.id,P=E||B&&w.edge==="left"?J(l.start,E?f.offsetDays:w.offsetDays):l.start,W=E||B&&w.edge==="right"?J(l.end,E?f.offsetDays:w.offsetDays):l.end,pe=l.originalType!=="step";let ne=re(P,g),H=0,Le=0;pe||(H=Math.max(re(W,g)-ne,g.dayWidth),Le=H*(l.progress/100));const je=N===l.id,Fe=q===l.id,rt=se.has(l.id),nt=V.has(l.id),st=!!q&&!Fe&&!ce.has(l.id),at=Fe||!!q&&ce.has(l.id),it=b?.hoverTargetId===l.id,dt=je||Fe,lt=d*X,ct={onMouseEnter:Q=>{A(l.id),!f&&!w&&O({task:l,x:Q.clientX,y:Q.clientY})},onMouseMove:Q=>{N===l.id&&!f&&!w&&O({task:l,x:Q.clientX,y:Q.clientY})},onMouseLeave:()=>{A(null),O(null)},onClick:Q=>{Q.stopPropagation(),Y(l.id),Q.detail===2&&ye?.(Ce(l)),K(!G.isOpen||G.task?.id!==l.id?{isOpen:!0,position:{x:Q.clientX,y:Q.clientY},task:l}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:Q=>we(Q,l)};return e.jsx(Ve,{task:l,x:ne,y:lt,w:H,progW:Le,isHov:je,isDrag:E,isResize:B,isCritical:nt,isDelayed:rt,isConnectTarget:it,showDots:dt,isBarDimmed:st,isBarHighlighted:at,commonEvents:ct,handleResizeMouseDown:ue,handleConnectDotMouseDown:Se},l.id)}),e.jsx("svg",{width:g.totalWidth,height:oe,style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx(Ue,{})}),a&&!f&&e.jsx("div",{style:{position:"fixed",left:a.x+16,top:a.y-10,zIndex:9999,pointerEvents:"none"},children:e.jsxs("div",{style:{borderRadius:12,padding:"12px 16px",minWidth:220,maxWidth:340,background:`${t.surface}f5`,border:`1px solid ${t.borderLight}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[fe(a.task.originalType,a.task.colorIdx),e.jsx("span",{style:{fontSize:12,fontWeight:700,color:t.textTitle,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.task.name})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:t.textSecondary},children:a.task.originalType==="step"?e.jsxs(e.Fragment,{children:[a.task.previsionStart&&a.task.previsionEnd&&e.jsxs("div",{style:{background:`${t.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:`${t.textSecondary}44`,border:`1.5px solid ${t.textSecondary}66`}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t.textSecondary},children:F("gantt.tooltip.planned","Planned")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.previsionStart)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.end","End"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.previsionEnd)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.duration","Duration"),":"]}),e.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:[be(a.task.previsionStart,a.task.previsionEnd),"d"]})]})]}),e.jsxs("div",{style:{background:a.task.hasActualDates?`${t.groupLight}22`:"transparent",borderRadius:6,padding:"4px 6px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:te[a.task.colorIdx??0].progress}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:a.task.hasActualDates?t.group:t.textSecondary},children:a.task.hasActualDates?F("gantt.tooltip.actual","Actual"):F("gantt.tooltip.plannedInUse","Planned (in use)")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.end","End"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.end)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.duration","Duration"),":"]}),e.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:[be(a.task.start,a.task.end),"d"]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,paddingTop:4,marginTop:4,borderTop:`1px solid ${t.borderLight}`},children:[e.jsxs("span",{children:[F("charts.gantt.progress","Progress"),":"]}),e.jsxs("span",{style:{fontWeight:700,color:t.group},children:[Math.round(a.task.progress),"%"]})]})]}):a.task.originalType==="note"?e.jsxs(e.Fragment,{children:[a.task.noteProjectTitle&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[e.jsx("div",{style:{width:8,height:8,borderRadius:2,background:a.task.noteColor||t.note,flexShrink:0}}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.task.noteProjectTitle})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.date","Date"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]}),(a.task.filesCount||0)>0&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.attachments","Attachments"),":"]}),e.jsxs("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:4,color:t.textPrimary},children:[e.jsx(L.Paperclip,{size:10}),a.task.filesCount]})]})]}):e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("charts.gantt.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]})})]})})]})]})}),G.task&&G.isOpen&&(()=>{const r=G.task,d=(o.dependencies||[]).filter(W=>W.predecessorId===r.id||W.successorId===r.id),l={FS:F("gantt.depType.fs","Finish to Start"),SS:F("gantt.depType.ss","Start to Start"),FF:F("gantt.depType.ff","Finish to Finish"),SF:F("gantt.depType.sf","Start to Finish")},E=d.length>0?300:220,B=Math.min(G.position.x,window.innerWidth-E-16),P=G.position.y+8;return e.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:B,top:P,zIndex:9999,background:"#fff",borderRadius:4,boxShadow:"0 12px 40px rgba(0,0,0,0.14), 0 3px 10px rgba(0,0,0,0.07)",border:`1.5px solid ${t.borderLight}`,width:E,overflow:"hidden"},onMouseDown:W=>W.stopPropagation(),children:[e.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${t.borderLight}`},children:e.jsx("p",{style:{fontSize:13,fontWeight:700,color:t.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:r.name,children:r.name})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[e.jsxs("button",{onClick:()=>{ye?.(Ce(r)),ve()},className:"zg-popup-btn",children:[e.jsx(L.Eye,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.viewDetails","View details")})]}),e.jsxs("button",{onClick:()=>{j?.(Ce(r)),ve()},className:"zg-popup-btn",children:[e.jsx(L.Edit2,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.edit","Edit")})]}),e.jsxs("button",{onClick:()=>{_?.(r.id),ve()},className:"zg-popup-btn zg-popup-btn-danger",children:[e.jsx(L.Trash2,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.delete","Delete")})]})]}),d.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${t.borderLight}`,padding:"10px 14px 12px"},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:[F("gantt.popup.relations","Relations")," (",d.length,")"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:d.map(W=>{const pe=W.predecessorId===r.id,ne=pe?W.successorName:W.predecessorName,H=z===W.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"#f8fafb",border:`1px solid ${t.borderLight}`},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.group,marginBottom:2},children:[e.jsx("span",{style:{background:`${t.group}15`,borderRadius:4,padding:"1px 5px"},children:W.type})," ",e.jsx("span",{style:{color:t.textSecondary,fontWeight:500},children:pe?"→ ":"← "}),e.jsx("span",{style:{color:t.textMuted,fontWeight:400,fontSize:9},children:l[W.type]??W.type})]}),e.jsx("div",{style:{fontSize:11,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:ne,children:ne})]}),xe&&e.jsx("button",{disabled:!!H,onClick:async()=>{n(W.id);try{await xe(W.id)}finally{n(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:H?"#fee2e2":"transparent",cursor:H?"wait":"pointer",color:"#ef4444",fontSize:14,opacity:H?.5:1,transition:"background 0.12s"},children:H?"⟳":"🗑"})]},W.id)})})]})]})})(),s&&e.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(s.x,window.innerWidth-220),top:Math.min(s.y,window.innerHeight-220),zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden"},onClick:r=>r.stopPropagation(),children:[e.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${t.borderLight}`,background:t.headerBg},children:e.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:[F("gantt.chart.addOn","Add on")," ",Z(s.date)]})}),e.jsx("div",{style:{padding:"5px 5px"},children:[{label:F("gantt.newAction.step","Step"),icon:fe("step",0),action:()=>{me?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.milestone","Milestone"),icon:fe("milestone"),action:()=>{Ie?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.event","Event"),icon:fe("event"),action:()=>{Te?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.note","Note"),icon:fe("note"),action:()=>{ae?.(s.date,s.projectId),k(null)}}].map(r=>e.jsxs("button",{onClick:r.action,className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[r.icon," ",r.label]},r.label))})]}),b&&e.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[e.jsx("defs",{children:e.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:e.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:t.group})})}),e.jsx("line",{x1:b.fromScreenX,y1:b.fromScreenY,x2:b.currentScreenX,y2:b.currentScreenY,stroke:t.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"zg-dash 0.5s linear infinite"}})]}),M&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>I(null),children:e.jsxs("div",{style:{background:"#fff",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"0 24px 80px rgba(0,0,0,0.18), 0 6px 24px rgba(0,0,0,0.08)"},onClick:r=>r.stopPropagation(),children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:700,color:t.textTitle,marginBottom:4},children:F("gantt.depModal.title","Relation Type")}),e.jsx("p",{style:{fontSize:13,color:t.textSecondary},children:F("gantt.depModal.subtitle","Choose how the two tasks relate")})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:F("gantt.depModal.fs","Finish to Start"),desc:F("gantt.depModal.fsDesc","B starts when A finishes")},{type:"SS",label:F("gantt.depModal.ss","Start to Start"),desc:F("gantt.depModal.ssDesc","A and B start together")},{type:"FF",label:F("gantt.depModal.ff","Finish to Finish"),desc:F("gantt.depModal.ffDesc","A and B finish together")},{type:"SF",label:F("gantt.depModal.sf","Start to Finish"),desc:F("gantt.depModal.sfDesc","B finishes when A starts")}].map(r=>e.jsxs("button",{onClick:()=>D(r.type),style:{border:y===r.type?`2px solid ${t.group}`:`1.5px solid ${t.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:y===r.type?`${t.group}0d`:"#fafafa"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:t.group,marginBottom:4,background:y===r.type?`${t.group}20`:`${t.group}0d`,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:r.type}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:2},children:r.label}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:r.desc})]},r.type))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:6},children:F("gantt.depModal.lagLabel","Lag (days)")}),e.jsx("input",{type:"number",value:v,onChange:r=>$(parseInt(r.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${t.borderLight}`,borderRadius:8,fontSize:14}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:()=>I(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${t.borderLight}`,background:"#fff",cursor:"pointer",fontWeight:600},children:F("gantt.depModal.cancel","Cancel")}),e.jsx("button",{onClick:ke,disabled:S,style:{padding:"10px 16px",borderRadius:8,border:"none",background:t.group,color:"#fff",cursor:S?"wait":"pointer",fontWeight:600},children:S?F("gantt.depModal.saving","Saving..."):F("gantt.depModal.create","Create Dependency")})]})]})})]})}function Ke(o){const p=h.useRef(null),g=h.useRef(null),m=h.useRef(null),f=h.useRef(!1),w=h.useCallback(()=>{if(f.current)return;f.current=!0;const y=g.current;y&&p.current&&(p.current.scrollTop=y.scrollTop),y&&m.current&&(m.current.scrollLeft=y.scrollLeft),f.current=!1},[]),b=h.useCallback(()=>{f.current||(f.current=!0,p.current&&g.current&&(g.current.scrollTop=p.current.scrollTop),f.current=!1)},[]),M=h.useRef(!1);h.useEffect(()=>{if(M.current||!o.totalWidth)return;const y=g.current;if(!y)return;const D=re(new Date,o);if(D>=0&&D<=o.totalWidth){const v=D-y.clientWidth/2;y.scrollLeft=Math.max(0,v),m.current&&(m.current.scrollLeft=y.scrollLeft),M.current=!0}},[o]);const I=h.useCallback(y=>{const D=g.current;if(D)if(y.preventDefault(),y.shiftKey||Math.abs(y.deltaX)>Math.abs(y.deltaY)){const v=y.shiftKey?y.deltaY:y.deltaX;D.scrollLeft+=v,m.current&&(m.current.scrollLeft=D.scrollLeft)}else D.scrollTop+=y.deltaY,p.current&&(p.current.scrollTop=D.scrollTop)},[]);return{leftBodyRef:p,rightBodyRef:g,timeHeaderRef:m,handleRightScroll:w,handleLeftScroll:b,handleChartWheel:I}}function Je(o,p,g,m){const f=new Map;return o.forEach(w=>f.set(w.id,w)),p.map(w=>{const b=f.get(w.predecessorId),M=f.get(w.successorId);if(!b||!M)return null;const I=m.get(b.id),y=m.get(M.id);if(I==null||y==null)return null;const D=b.originalType!=="step",v=M.originalType!=="step",$=D?re(b.start,g)+Me:re(b.end,g),S=I*X+X/2,z=v?re(M.start,g)-10:re(M.start,g),n=y*X+X/2,s=14,k=Math.max($+s,z-s),c=S===n?`M${$},${S} L${z-6},${n}`:`M${$},${S} L${k},${S} L${k},${n} L${z-6},${n}`;return{predId:b.id,succId:M.id,path:c,headX:z-6,headY:n}}).filter(Boolean)}function Ze(o,p){if(o.length===0||p.length===0)return new Set;const g=new Map;o.forEach(c=>g.set(c.id,c));const m=new Set(o.map(c=>c.id)),f=p.filter(c=>m.has(c.predecessorId)&&m.has(c.successorId));if(f.length===0)return new Set;const w=new Map,b=new Map;f.forEach(c=>{w.has(c.predecessorId)||w.set(c.predecessorId,[]),w.get(c.predecessorId).push(c.successorId),b.has(c.successorId)||b.set(c.successorId,[]),b.get(c.successorId).push(c.predecessorId)});const M=c=>Math.max(1,le(c.start,c.end)),I=new Set,y=[];function D(c){I.has(c)||(I.add(c),(w.get(c)||[]).forEach(D),y.unshift(c))}o.forEach(c=>D(c.id));const v=new Map,$=new Map;for(const c of y){const C=g.get(c),u=b.get(c)||[];let T=0;for(const x of u)T=Math.max(T,$.get(x)||0);const i=u.length>0?T:0;v.set(c,i),$.set(c,i+M(C))}let S=0;$.forEach(c=>{c>S&&(S=c)});const z=new Map,n=new Map;for(let c=y.length-1;c>=0;c--){const C=y[c],u=g.get(C),T=w.get(C)||[];let i=S;for(const x of T)i=Math.min(i,z.get(x)??S);n.set(C,T.length>0?i:S),z.set(C,(n.get(C)||0)-M(u))}const s=new Set;f.forEach(c=>{s.add(c.predecessorId),s.add(c.successorId)});const k=new Set;for(const c of y){if(!s.has(c))continue;const C=(z.get(c)||0)-(v.get(c)||0);Math.abs(C)<.5&&k.add(c)}return k}function Qe({steps:o,milestones:p,events:g,notes:m,dependencies:f,viewMode:w,locale:b,groupByProject:M,visibleTypes:I,collapsedGroups:y,collapsedProjects:D,selectedTaskId:v}){const $=h.useMemo(()=>{const u=[];let T=0;return o.forEach(i=>{const x=!!(i.startDate&&i.finishDate),N=i.startDate||i.previsionStartDate,A=i.finishDate||i.previsionFinishDate;if(!N||!A)return;const q=new Date(N),Y=new Date(A);if(isNaN(q.getTime())||isNaN(Y.getTime()))return;Y<=q&&Y.setDate(Y.getDate()+1);let a,O;if(i.previsionStartDate&&i.previsionFinishDate){const V=new Date(i.previsionStartDate),se=new Date(i.previsionFinishDate);!isNaN(V.getTime())&&!isNaN(se.getTime())&&(a=V,O=se<=V?J(V,1):se)}const G=f?.filter(V=>V.successorId===i.id).map(V=>V.predecessorId)||[],K=i.conclusionPercent!=null?Number(i.conclusionPercent):0;u.push({id:i.id,name:i.name,start:q,end:Y,progress:K>1?Math.min(K,100):K*100,originalType:"step",deps:G,colorIdx:T%te.length,previsionStart:a,previsionEnd:O,hasActualDates:x,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0}),T++}),p?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);if(isNaN(x.getTime()))return;const N=f?.filter(A=>A.successorId===i.id).map(A=>A.predecessorId)||[];u.push({id:i.id,name:i.name,start:x,end:x,progress:i.finished?100:0,originalType:"milestone",deps:N,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),g?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);if(isNaN(x.getTime()))return;const N=f?.filter(A=>A.successorId===i.id).map(A=>A.predecessorId)||[];u.push({id:i.id,name:i.title,start:x,end:x,progress:i.finished?100:0,originalType:"event",deps:N,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),m?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);isNaN(x.getTime())||u.push({id:i.id,name:i.title||"Note",start:x,end:x,progress:0,originalType:"note",deps:[],noteCount:1,noteColor:i.color||t.note,filesCount:i.filesCount||0,noteProjectTitle:i.projectTitle||void 0,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),u},[o,p,g,m,f]),S=h.useMemo(()=>He($,w,b),[$,w,b]),z=h.useMemo(()=>{const u=[],T=["step","milestone","event","note"];if(M){const i=new Map;$.forEach(x=>{x.projectId&&!i.has(x.projectId)&&i.set(x.projectId,x.projectTitle||x.projectId)});for(const[x,N]of Array.from(i.entries())){const A=D.has(x);if(u.push({kind:"projectHeader",projectId:x,projectTitle:N,collapsed:A}),!A){const q=$.filter(Y=>Y.projectId===x);for(const Y of T){if(!I.has(Y))continue;const a=q.filter(K=>K.originalType===Y);if(a.length===0)continue;const O=`${x}-${Y}`,G=y.has(O);u.push({kind:"group",groupType:Y,label:$e[Y],count:a.length,collapsed:G,projectId:x}),G||a.forEach(K=>u.push({kind:"task",task:K}))}}}}else for(const i of T){if(!I.has(i))continue;const x=$.filter(A=>A.originalType===i);if(x.length===0)continue;const N=y.has(i);u.push({kind:"group",groupType:i,label:$e[i],count:x.length,collapsed:N}),N||x.forEach(A=>u.push({kind:"task",task:A}))}return u},[$,I,y,D,M]),n=h.useMemo(()=>{const u=new Map;return z.forEach((T,i)=>{T.kind==="task"&&u.set(T.task.id,i)}),u},[z]),s=h.useMemo(()=>Je($,f||[],S,n),[$,f,S,n]),k=h.useMemo(()=>Ze($,f||[]),[$,f]),c=h.useMemo(()=>{const u=new Set,T=new Date;return $.forEach(i=>{i.originalType==="step"&&i.end<T&&i.progress<100&&u.add(i.id)}),u},[$]),C=h.useMemo(()=>{if(!v||!f?.length)return new Set;const u=new Set,T=[v];for(;T.length;){const i=T.shift();for(const x of f)x.predecessorId===i&&!u.has(x.successorId)&&(u.add(x.successorId),T.push(x.successorId)),x.successorId===i&&!u.has(x.predecessorId)&&(u.add(x.predecessorId),T.push(x.predecessorId))}return u},[v,f]);return{tasks:$,timeline:S,displayRows:z,taskRowIndex:n,arrows:s,criticalIds:k,delayedIds:c,relatedIds:C}}function Re(o){const[p,g]=h.useState("day"),[m,f]=h.useState(null),[w,b]=h.useState(null),[M,I]=h.useState(null),[y,D]=h.useState({isOpen:!1,position:{x:0,y:0},task:null}),[v,$]=h.useState(null),[S,z]=h.useState(null),[n,s]=h.useState(null),[k,c]=h.useState(null),[C,u]=h.useState("FS"),[T,i]=h.useState(0),[x,N]=h.useState(!1),[A,q]=h.useState(null),[Y,a]=h.useState(null),[O,G]=h.useState(!1),K=h.useRef(null),[V,se]=h.useState(new Set(["step","milestone","event","note"])),[ce,we]=h.useState(new Set),[ue,Se]=h.useState(new Set),ke=h.useCallback(r=>{se(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),ie=h.useCallback(r=>{we(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),ye=h.useCallback(r=>{Se(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),j=Qe({steps:o.steps,milestones:o.milestones,events:o.events,notes:o.notes,dependencies:o.dependencies,viewMode:p,locale:o.locale,visibleTypes:V,collapsedGroups:ce,collapsedProjects:ue,groupByProject:o.groupByProject,selectedTaskId:w||null}),_=Ke(j.timeline),xe=h.useCallback((r,d)=>{r.preventDefault(),r.stopPropagation(),$({task:d,startMouseX:r.clientX,originalStart:new Date(d.start),originalEnd:new Date(d.end),offsetDays:0})},[]),me=h.useCallback((r,d,l)=>{r.preventDefault(),r.stopPropagation(),z({task:d,edge:l,startMouseX:r.clientX,originalStart:new Date(d.start),originalEnd:new Date(d.end),offsetDays:0})},[]),Ie=h.useCallback((r,d,l)=>{r.preventDefault(),r.stopPropagation(),s({fromTaskId:d.id,fromEdge:l,fromScreenX:r.clientX,fromScreenY:r.clientY,currentScreenX:r.clientX,currentScreenY:r.clientY,hoverTargetId:null})},[]),Te=h.useCallback(async()=>{if(!k||!o.onCreateDependency)return;const r=new Map(j.tasks.map(W=>[W.id,W])),d=r.get(k.fromTaskId),l=r.get(k.toTaskId);if(!d||!l)return;const E=W=>W.originalType==="step"?"STEP":"MILESTONE",B=k.fromEdge==="right"?d:l,P=k.fromEdge==="right"?l:d;N(!0);try{await o.onCreateDependency({predecessorId:B.id,predecessorType:E(B),successorId:P.id,successorType:E(P),type:C,lag:T}),c(null)}finally{N(!1)}},[k,j.tasks,o.onCreateDependency,C,T]);h.useEffect(()=>{if(!v)return;const r=l=>{const E=l.clientX-v.startMouseX,B=Math.round(E/j.timeline.dayWidth);B!==v.offsetDays&&$(P=>P?{...P,offsetDays:B}:null)},d=()=>{v.offsetDays!==0&&o.onTaskChange&&o.onTaskChange({id:v.task.id,name:v.task.name,start:J(v.originalStart,v.offsetDays),end:J(v.originalEnd,v.offsetDays),type:v.task.originalType==="step"?"task":"milestone",progress:v.task.progress}),$(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[v,j.timeline.dayWidth,o.onTaskChange]),h.useEffect(()=>{if(!S)return;const r=l=>{const E=l.clientX-S.startMouseX,B=Math.round(E/j.timeline.dayWidth);B!==S.offsetDays&&z(P=>P?{...P,offsetDays:B}:null)},d=()=>{if(S.offsetDays!==0&&o.onTaskChange){const l=S.edge==="left"?J(S.originalStart,S.offsetDays):S.originalStart,E=S.edge==="right"?J(S.originalEnd,S.offsetDays):S.originalEnd;E>l&&o.onTaskChange({id:S.task.id,name:S.task.name,start:l,end:E,type:"task",progress:S.task.progress})}z(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[S,j.timeline.dayWidth,o.onTaskChange]),h.useEffect(()=>{if(!n)return;const r=l=>{let E=null;for(const B of document.elementsFromPoint(l.clientX,l.clientY)){const P=B.dataset?.taskId;if(P&&P!==n.fromTaskId){E=P;break}}s(B=>B?{...B,currentScreenX:l.clientX,currentScreenY:l.clientY,hoverTargetId:E}:null)},d=l=>{let E=null;for(const B of document.elementsFromPoint(l.clientX,l.clientY)){const P=B.dataset?.taskId;if(P&&P!==n.fromTaskId){E=P;break}}E&&o.onCreateDependency&&(c({fromTaskId:n.fromTaskId,fromEdge:n.fromEdge,toTaskId:E}),u("FS"),i(0)),s(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[n?.fromTaskId,n?.fromEdge,o.onCreateDependency]);const[ae,F]=h.useState(null),be=h.useCallback(r=>{if(S||v||r.button===2)return;const d=_.rightBodyRef.current;d&&(r.preventDefault(),F({startX:r.clientX,startY:r.clientY,scrollLeft:d.scrollLeft,scrollTop:d.scrollTop}))},[S,v,_.rightBodyRef]);h.useEffect(()=>{if(!ae)return;const r=l=>{const E=_.rightBodyRef.current;E&&(E.scrollLeft=ae.scrollLeft-(l.clientX-ae.startX),E.scrollTop=ae.scrollTop-(l.clientY-ae.startY),_.leftBodyRef.current&&(_.leftBodyRef.current.scrollTop=E.scrollTop),_.timeHeaderRef.current&&(_.timeHeaderRef.current.scrollLeft=E.scrollLeft))},d=()=>F(null);return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[ae,_.rightBodyRef,_.leftBodyRef,_.timeHeaderRef]);const oe=h.useCallback(r=>{r.preventDefault(),r.stopPropagation();const d=E=>{const B=_.rightBodyRef.current;if(!B)return new Date;const P=B.getBoundingClientRect(),W=E-P.left+B.scrollLeft;return J(j.timeline.start,Math.max(0,Math.floor(W/j.timeline.dayWidth)))},l=E=>{if(!o.groupByProject)return;const B=_.leftBodyRef.current;if(!B)return;const P=B.getBoundingClientRect(),W=E-P.top+B.scrollTop,pe=Math.max(0,Math.floor(W/50));for(let ne=Math.min(pe,j.displayRows.length-1);ne>=0;ne--){const H=j.displayRows[ne];if(H.kind==="projectHeader")return H.projectId;if(H.kind==="task"&&H.task.projectId)return H.task.projectId;if(H.kind==="group"&&H.projectId)return H.projectId}};a({x:r.clientX,y:r.clientY,date:d(r.clientX),projectId:l(r.clientY)}),F(null)},[j.timeline,j.displayRows,o.groupByProject,_.rightBodyRef,_.leftBodyRef]);h.useEffect(()=>{if(!Y)return;const r=E=>{E.key==="Escape"&&a(null)},d=E=>{E.target.closest('[data-menu="chart-create"]')||a(null)},l=()=>a(null);return document.addEventListener("keydown",r),document.addEventListener("click",d),window.addEventListener("scroll",l,!0),()=>{document.removeEventListener("keydown",r),document.removeEventListener("click",d),window.removeEventListener("scroll",l,!0)}},[Y]);const ve=h.useMemo(()=>({props:o,t:(r,d)=>o.translations?typeof o.translations=="function"?o.translations(r,d):o.translations[r]||d||"":d||"",viewMode:p,setViewMode:g,hoveredTaskId:m,setHoveredTaskId:f,selectedTaskId:w,setSelectedTaskId:b,tooltip:M,setTooltip:I,popupState:y,setPopupState:D,dragState:v,setDragState:$,resizeState:S,setResizeState:z,connectState:n,setConnectState:s,visibleTypes:V,setVisibleTypes:se,toggleVisibility:ke,collapsedGroups:ce,setCollapsedGroups:we,toggleGroup:ie,collapsedProjects:ue,setCollapsedProjects:Se,toggleProject:ye,pendingConnection:k,setPendingConnection:c,depModalType:C,setDepModalType:u,depModalLag:T,setDepModalLag:i,depCreating:x,setDepCreating:N,deletingDepId:A,setDeletingDepId:q,chartMenu:Y,setChartMenu:a,newActionOpen:O,setNewActionOpen:G,tasks:j.tasks,timeline:j.timeline,displayRows:j.displayRows,taskRowIndex:j.taskRowIndex||new Map,arrows:j.arrows,criticalIds:j.criticalIds,delayedIds:j.delayedIds,relatedIds:j.relatedIds,..._,newActionRef:K,screenXToDate:r=>{const d=_.rightBodyRef.current;if(!d)return new Date;const l=d.getBoundingClientRect(),E=r-l.left+d.scrollLeft;return J(j.timeline.start,Math.max(0,Math.floor(E/j.timeline.dayWidth)))},screenYToProjectId:r=>{if(!o.groupByProject)return;const d=_.leftBodyRef.current;if(!d)return;const l=d.getBoundingClientRect(),E=r-l.top+d.scrollTop,B=Math.max(0,Math.floor(E/50));for(let P=Math.min(B,j.displayRows.length-1);P>=0;P--){const W=j.displayRows[P];if(W.kind==="projectHeader")return W.projectId;if(W.kind==="task"&&W.task.projectId)return W.task.projectId;if(W.kind==="group"&&W.projectId)return W.projectId}},handleChartMouseDown:be,openChartMenu:oe,handleBarMouseDown:xe,handleResizeMouseDown:me,handleConnectDotMouseDown:Ie,handleCreateDependency:Te}),[o,p,m,w,M,y,v,S,n,V,ce,ue,k,C,T,x,A,Y,O,j,_,ke,ie,ye,be,oe,xe,me,Ie,Te]);return o.loading?e.jsx("div",{style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:t.textSecondary},children:e.jsx(L.Loader2,{size:32,style:{animation:"zg-spin 1.5s linear infinite",color:t.group}})}):e.jsx(Pe,{value:ve,children:e.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",marginLeft:"auto",marginRight:"auto",background:"#fff",borderRadius:12,boxShadow:"0 8px 30px rgb(0,0,0,0.06)",overflow:"hidden",height:"calc(100vh - 48px)",minHeight:600,border:`1px solid ${t.borderLight}`},children:[e.jsx(_e,{}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",position:"relative",background:t.surfaceAlt},children:[e.jsx(Ge,{}),e.jsx(qe,{})]})]})})}const et=[{label:"Yellow",value:"#FEF08A"},{label:"Green",value:"#BBF7D0"},{label:"Blue",value:"#BFDBFE"},{label:"Pink",value:"#FBCFE8"},{label:"Purple",value:"#E9D5FF"},{label:"Orange",value:"#FED7AA"},{label:"White",value:"#FFFFFF"}],Be={FS:"Finish → Start (FS)",SS:"Start → Start (SS)",FF:"Finish → Finish (FF)",SF:"Start → Finish (SF)"};function tt({isOpen:o,onClose:p,availableMilestones:g=[],initialDate:m,translations:f,onSaveNote:w}){const b=(a,O)=>f?typeof f=="function"?f(a,O):f[a]||O:O,[M,I]=h.useState(""),[y,D]=h.useState(""),[v,$]=h.useState("#FEF08A"),[S,z]=h.useState(""),[n,s]=h.useState(""),[k,c]=h.useState("FS"),[C,u]=h.useState(!1),[T,i]=h.useState([]),[x,N]=h.useState(""),A=h.useRef(null);h.useEffect(()=>{o&&(I(""),D(""),$("#FEF08A"),z(m??new Date().toISOString().split("T")[0]),s(""),c("FS"),i([]),N(""))},[o,m]);const q=[...g.map(a=>({id:a.id,name:a.name,type:"MILESTONE"}))],Y=async()=>{if(!M.trim()&&!y.trim()){N(b("noteModal.errorEmpty","Please provide a title or content for the note."));return}N("");try{u(!0),await w({title:M||b("noteModal.untitled","Untitled"),description:y,color:v,date:S?`${S}T00:00:00`:new Date().toISOString(),predecessorId:n,dependencyType:k,files:T}),p()}catch(a){console.error(a),N(b("noteModal.errorSave","Error creating note."))}finally{u(!1)}};return o?e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.2)",backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},onClick:p,children:e.jsxs("div",{onClick:a=>a.stopPropagation(),style:{width:400,maxHeight:"90vh",background:v||"#FFFACD",borderRadius:4,boxShadow:"4px 6px 20px rgba(0,0,0,0.18), 1px 1px 4px rgba(0,0,0,0.08)",transform:"rotate(-1deg)",position:"relative",display:"flex",flexDirection:"column",fontFamily:"'Inter', sans-serif",overflow:"hidden",transition:"background 0.3s"},children:[e.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:64,height:16,background:"rgba(255,255,255,0.55)",borderRadius:2,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"}}),e.jsx("button",{onClick:p,style:{position:"absolute",top:10,right:10,width:24,height:24,borderRadius:"50%",background:"rgba(0,0,0,0.08)",border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:14,color:"#3a3a3a"},onMouseEnter:a=>a.currentTarget.style.background="rgba(0,0,0,0.15)",onMouseLeave:a=>a.currentTarget.style.background="rgba(0,0,0,0.08)",children:"✕"}),e.jsxs("div",{style:{padding:"28px 24px 20px",flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:[x&&e.jsx("div",{style:{background:"rgba(255,0,0,0.1)",color:"#d32f2f",padding:"8px 12px",borderRadius:6,fontSize:12,marginBottom:12,border:"1px solid rgba(255,0,0,0.2)"},children:x}),e.jsx("input",{type:"text",value:M,onChange:a=>I(a.target.value),placeholder:b("noteModal.titlePlaceholder","Note title..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:20,fontWeight:800,color:"#2a2a2a",lineHeight:"1.3",padding:0,margin:0,marginBottom:14,fontFamily:"inherit"}}),e.jsx("div",{style:{width:"100%",height:1,background:"rgba(0,0,0,0.08)",marginBottom:14}}),e.jsx("textarea",{value:y,onChange:a=>D(a.target.value),rows:6,placeholder:b("noteModal.contentPlaceholder","Write your note here..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:14,color:"#3a3a3a",lineHeight:"1.6",resize:"vertical",padding:0,margin:0,fontFamily:"inherit",flex:1,minHeight:100}}),e.jsxs("div",{style:{marginTop:14,paddingTop:10,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsx("input",{ref:A,type:"file",multiple:!0,onChange:a=>{const O=a.target.files?Array.from(a.target.files):[];O.length>0&&i(G=>[...G,...O]),A.current&&(A.current.value="")},style:{display:"none"}}),e.jsxs("button",{type:"button",onClick:()=>A.current?.click(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:6,background:"rgba(0,0,0,0.05)",border:"1px dashed rgba(0,0,0,0.15)",cursor:"pointer",fontSize:12,color:"#3a3a3a",fontWeight:500,transition:"background 0.15s",width:"100%",justifyContent:"center"},onMouseEnter:a=>a.currentTarget.style.background="rgba(0,0,0,0.08)",onMouseLeave:a=>a.currentTarget.style.background="rgba(0,0,0,0.05)",children:[e.jsx(L.Upload,{size:13}),b("noteModal.attachFiles","Attach files")]}),T.length>0&&e.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:T.map((a,O)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,background:"rgba(255,255,255,0.5)",fontSize:11,color:"#3a3a3a"},children:[e.jsx(L.Paperclip,{size:10,style:{flexShrink:0}}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.name}),e.jsxs("span",{style:{fontSize:9,color:"rgba(58,58,58,0.4)",flexShrink:0},children:[(a.size/1024).toFixed(0),"KB"]}),e.jsx("button",{type:"button",onClick:()=>i(G=>G.filter((K,V)=>V!==O)),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:"#ef4444"},title:b("noteModal.removeFile","Remove"),children:e.jsx(L.X,{size:12})})]},`file-${O}`))})]}),e.jsxs("div",{style:{marginTop:16,paddingTop:12,borderTop:"1px solid rgba(0,0,0,0.08)",display:"flex",alignItems:"center",justifyItems:"flex-start",justifyContent:"space-between",gap:12},children:[e.jsx("input",{type:"date",value:S,onChange:a=>z(a.target.value),style:{background:"transparent",border:"none",outline:"none",fontSize:12,color:"rgba(58,58,58,0.5)",fontWeight:500,fontFamily:"inherit",padding:0,cursor:"pointer",width:"auto"}}),e.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:et.map(a=>e.jsx("button",{type:"button",onClick:()=>$(a.value),style:{width:22,height:22,borderRadius:"50%",border:v===a.value?"2px solid #1A3C30":"1.5px solid rgba(0,0,0,0.12)",backgroundColor:a.value,cursor:"pointer",padding:0,transform:v===a.value?"scale(1.15)":"scale(1)",transition:"all 0.15s",boxShadow:v===a.value?"0 1px 4px rgba(0,0,0,0.15)":"none"},title:a.label},a.value))})]}),q.length>0&&e.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[e.jsx(L.Link2,{size:14,style:{color:"rgba(58,58,58,0.5)"}}),e.jsx("span",{style:{fontSize:11,color:"rgba(58,58,58,0.5)",fontWeight:600},children:b("noteModal.dependency","Dependency")})]}),e.jsxs("select",{value:n,onChange:a=>s(a.target.value),style:{width:"100%",background:"rgba(255,255,255,0.3)",border:"1px solid rgba(0,0,0,0.08)",borderRadius:6,fontSize:12,color:"#3a3a3a",padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer"},children:[e.jsx("option",{value:"",children:b("noteModal.none","None")}),g.length>0&&e.jsx("optgroup",{label:b("noteModal.milestones","Milestones"),children:g.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),n&&e.jsx("select",{value:k,onChange:a=>c(a.target.value),style:{width:"100%",background:"rgba(255,255,255,0.3)",border:"1px solid rgba(0,0,0,0.08)",borderRadius:6,fontSize:12,color:"#3a3a3a",padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer",marginTop:6},children:Object.keys(Be).map(a=>e.jsx("option",{value:a,children:Be[a]},a))})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10,paddingTop:16,marginTop:12,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsx("button",{onClick:p,style:{padding:"8px 16px",fontSize:13,color:"#3a3a3a",background:"rgba(255,255,255,0.5)",border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,cursor:"pointer"},children:b("noteModal.cancel","Cancel")}),e.jsxs("button",{onClick:Y,disabled:C,style:{padding:"8px 20px",fontSize:13,color:"#fff",background:"#1A3C30",border:"none",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,opacity:C?.5:1},children:[C&&e.jsx(L.Loader2,{size:16,style:{animation:"zg-spin 1s linear infinite"}}),b("noteModal.create","Create Note")]})]})]})]})}):null}const ot={"planning.gantt":"PLANEJAMENTO DA OBRA","charts.gantt.month":"Mês","charts.gantt.year":"Ano","charts.gantt.stepName":"NOME DA ETAPA","charts.gantt.start":"INÍCIO","charts.gantt.end":"FIM","charts.gantt.newAction":"Nova Ação","charts.gantt.progress":"Progresso","gantt.filter.steps":"Etapas","gantt.filter.milestones":"Marcos","gantt.filter.events":"Eventos","gantt.filter.notes":"Notas","gantt.newAction.step":"Etapa","gantt.newAction.milestone":"Marco","gantt.newAction.event":"Evento","gantt.newAction.note":"Nota","gantt.group.step":"Etapas","gantt.group.milestone":"Marcos","gantt.group.event":"Eventos","gantt.group.note":"Notas","gantt.tooltip.planned":"Previsto","gantt.tooltip.actual":"Real","gantt.tooltip.plannedInUse":"Previsto (em uso)","gantt.tooltip.start":"Início","gantt.tooltip.end":"Fim","gantt.tooltip.duration":"Duração","gantt.tooltip.progress":"Progresso","gantt.tooltip.date":"Data","gantt.tooltip.attachments":"Anexos","gantt.popup.viewDetails":"Ver detalhes","gantt.popup.edit":"Editar","gantt.popup.delete":"Excluir","gantt.popup.relations":"Relações","gantt.chart.addOn":"Adicionar em","gantt.depType.fs":"Início após Fim","gantt.depType.ss":"Inícios simultâneos","gantt.depType.ff":"Fins simultâneos","gantt.depType.sf":"Fim após Início","gantt.depModal.title":"Tipo de Relação","gantt.depModal.subtitle":"Escolha como as duas tarefas se relacionam","gantt.depModal.fs":"Início após Fim","gantt.depModal.fsDesc":"B começa quando A termina","gantt.depModal.ss":"Inícios simultâneos","gantt.depModal.ssDesc":"A e B começam juntos","gantt.depModal.ff":"Fins simultâneos","gantt.depModal.ffDesc":"A e B terminam juntos","gantt.depModal.sf":"Fim após Início","gantt.depModal.sfDesc":"B termina quando A começa","gantt.depModal.lagLabel":"Atraso (Lag) em dias","gantt.depModal.cancel":"Cancelar","gantt.depModal.create":"Criar Dependência","gantt.depModal.saving":"Salvando...","noteModal.titlePlaceholder":"Título da nota...","noteModal.contentPlaceholder":"Escreva sua nota aqui...","noteModal.attachFiles":"Anexar arquivos","noteModal.removeFile":"Remover","noteModal.dependency":"Dependência","noteModal.none":"Nenhuma","noteModal.milestones":"Marcos","noteModal.cancel":"Cancelar","noteModal.create":"Criar Nota","noteModal.errorEmpty":"Informe o título ou conteúdo da nota.","noteModal.errorSave":"Erro ao criar nota.","noteModal.untitled":"Sem título"};R.NoteModal=tt,R.ProjectGantt=Re,R.ptBR=ot,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(R,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","lucide-react"],e):(R=typeof globalThis<"u"?globalThis:R||self,e(R.ZeGantt={},R.jsxRuntime,R.React,R.lucideReact))})(this,(function(R,e,h,L){"use strict";const Ee=h.createContext(void 0);function Pe({children:o,value:p}){return e.jsx(Ee.Provider,{value:p,children:o})}function ge(){const o=h.useContext(Ee);if(!o)throw new Error("useGanttContext must be used within a GanttProvider");return o}const U={white:"#FFFFFF",dark_gray:"#4F4F4F",gray:"#7B7B7B",light_gray:"#D9D9D9",dark_green:"#1A3C30",water_green:"#7ab7a3",light_green:"#A0D8A8",orange:"#CD6200",yellow:"#FFBB1C",red:"#FF0000"},t={pageBg:"#F8FAFB",surface:U.white,surfaceAlt:"#F7FAF8",headerBg:"#F2F5F3",textTitle:U.dark_green,textPrimary:U.dark_gray,textSecondary:U.gray,textMuted:U.light_gray,group:U.dark_green,groupLight:U.water_green,milestone:U.dark_green,milestoneRing:U.light_green,event:U.orange,note:U.yellow,border:U.light_gray,borderLight:"#ECECEC",weekendBg:"#F4F6F5",today:U.red,todayBg:"#FF000008",arrow:U.gray,arrowHover:U.dark_green},X=50,he=32,Ne=he*2,Ye=460,ee=26,de=28,Me=120,Oe=40,Xe=3.5,te=[{bar:"#D1D8A0",barBorder:"#A0D8A8",progress:"#1A3C30"},{bar:"#A0D8C8",barBorder:"#6BBFA8",progress:"#14534A"},{bar:"#B8C9E8",barBorder:"#8AAAD6",progress:"#2C4A70"},{bar:"#E8C9A0",barBorder:"#D6AA7A",progress:"#6B4510"},{bar:"#D8A0C8",barBorder:"#C47AAE",progress:"#6B2058"},{bar:"#A0C8D8",barBorder:"#74ACBF",progress:"#1A4F60"},{bar:"#C8D8A0",barBorder:"#A8BF74",progress:"#3F5014"},{bar:"#D8B0A0",barBorder:"#C4907A",progress:"#6B3020"},{bar:"#B0A0D8",barBorder:"#937ACE",progress:"#3A2070"},{bar:"#A0D8B0",barBorder:"#70C888",progress:"#1A5030"}],$e={step:"Steps",milestone:"Milestones",event:"Events",note:"Notes"};function _e(){const{props:o,t:p,viewMode:g,setViewMode:m,visibleTypes:f,setVisibleTypes:w,newActionOpen:b,setNewActionOpen:M,newActionRef:I}=ge(),{projectName:y,onAddNewStage:D,onAddMilestone:v,onAddEvent:$,onAddNote:S}=o,z=n=>{w(s=>{const k=new Set(s);return k.has(n)?k.delete(n):k.add(n),k})};return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${t.border}`,background:`linear-gradient(180deg, ${t.headerBg} 0%, ${t.surface} 100%)`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,fontSize:14,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:t.textTitle},children:p("planning.gantt","Project Planning")}),e.jsx("div",{style:{height:2.5,width:64,marginTop:6,borderRadius:9999,background:`linear-gradient(90deg, ${t.group}, ${t.milestoneRing})`}})]}),y&&e.jsx("span",{style:{fontSize:12,fontWeight:500,padding:"4px 12px",borderRadius:9999,color:t.textSecondary,background:t.surface,border:`1px solid ${t.border}`},children:y})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:["day","month"].map(n=>e.jsx("button",{onClick:()=>m(n),style:{padding:"6px 20px",fontSize:12,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...g===n?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{background:"transparent",color:t.textSecondary}},children:n==="day"?p("charts.gantt.month","Month"):p("charts.gantt.year","Year")},n))}),e.jsx("div",{style:{display:"flex",padding:4,borderRadius:8,gap:2,background:"rgba(122,122,122,0.07)",border:`1px solid ${t.borderLight}`},children:[{type:"step",label:p("gantt.filter.steps","Steps"),icon:e.jsx("div",{style:{width:10,height:10,borderRadius:2,background:te[0].bar,border:`1px solid ${te[0].barBorder}`}})},{type:"milestone",label:p("gantt.filter.milestones","Milestones"),icon:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})},{type:"event",label:p("gantt.filter.events","Events"),icon:e.jsx(L.Clock,{size:11,style:{color:t.event}})},{type:"note",label:p("gantt.filter.notes","Notes"),icon:e.jsx(L.MessageCircle,{size:11,style:{color:t.note}})}].map(n=>{const s=f.has(n.type);return e.jsxs("button",{onClick:()=>z(n.type),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",fontSize:11,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...s?{background:t.surface,color:t.group,boxShadow:"0 1px 3px rgb(0 0 0 / 0.08)"}:{background:"transparent",color:t.textMuted,opacity:.5}},children:[n.icon,e.jsx("span",{children:n.label})]},n.type)})}),D&&e.jsxs("div",{ref:I,style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>M(n=>!n),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:600,color:"#fff",border:"none",cursor:"pointer",background:`linear-gradient(135deg, ${t.group}, ${t.group}dd)`,transition:"all 0.2s"},children:[e.jsx(L.Plus,{size:16}),e.jsx("span",{children:p("charts.gantt.newAction","New Action")}),e.jsx(L.ChevronDown,{size:14,style:{opacity:.7,transform:b?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),b&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:n=>n.stopPropagation(),children:[{label:p("gantt.newAction.step","Step"),icon:e.jsx("div",{style:{width:14,height:14,borderRadius:3,background:te[0].bar,border:`1.5px solid ${te[0].barBorder}`,flexShrink:0}}),action:()=>{D(),M(!1)}},{label:p("gantt.newAction.milestone","Milestone"),icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})}),action:()=>{v?.(),M(!1)}},{label:p("gantt.newAction.event","Event"),icon:e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:`${t.event}18`,border:`1.5px solid ${t.event}55`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:11,style:{color:t.event}})}),action:()=>{$?.(),M(!1)}},{label:p("gantt.newAction.note","Note"),icon:e.jsx("div",{style:{width:16,height:20,background:t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible",flexShrink:0},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),action:()=>{S?.(),M(!1)}}].map(n=>e.jsxs("button",{onClick:n.action,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left",transition:"background 0.12s"},onMouseEnter:s=>{s.currentTarget.style.background=t.headerBg},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[n.icon,n.label]},n.label))})]})]})]})}const Ae=864e5,J=(o,p)=>new Date(o.getTime()+p*Ae),le=(o,p)=>Math.round((p.getTime()-o.getTime())/Ae),ze=o=>new Date(o.getFullYear(),o.getMonth(),1),De=o=>new Date(o.getFullYear(),o.getMonth()+1,0),Z=o=>`${String(o.getDate()).padStart(2,"0")}/${String(o.getMonth()+1).padStart(2,"0")}/${o.getFullYear()}`,We=(o,p="en")=>new Intl.DateTimeFormat(p,{month:"long"}).format(o).toUpperCase();function Ge(){const{props:o,t:p,displayRows:g,leftBodyRef:m,handleLeftScroll:f,toggleProject:w,toggleGroup:b,hoveredTaskId:M,setHoveredTaskId:I,selectedTaskId:y,setSelectedTaskId:D,delayedIds:v,criticalIds:$,relatedIds:S}=ge(),z=n=>({id:n.id,name:n.name,start:n.start,end:n.end,type:n.originalType==="step"?"task":"milestone",progress:n.progress});return e.jsxs("div",{style:{width:Ye,flexShrink:0,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",height:Ne,background:t.headerBg,borderBottom:`1px solid ${t.border}`},children:[e.jsx("div",{style:{flex:1,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:t.textSecondary},children:p("charts.gantt.stepName","STEP NAME")}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:t.textSecondary},children:p("charts.gantt.start","START")}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:t.textSecondary},children:p("charts.gantt.end","END")})]}),e.jsx("div",{ref:m,onScroll:f,className:"zg-no-scrollbar",style:{overflowY:"auto",overflowX:"hidden",flex:1},children:e.jsx("div",{style:{height:Math.max(g.length*X,400)+80,position:"relative"},children:g.map(n=>{if(n.kind==="projectHeader")return e.jsx("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",height:X,borderBottom:`1.5px solid ${t.group}44`,background:`${t.group}0E`},onClick:()=>w(n.projectId),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[n.collapsed?e.jsx(L.ChevronRight,{size:15,style:{color:t.group,flexShrink:0}}):e.jsx(L.ChevronDown,{size:15,style:{color:t.group,flexShrink:0}}),e.jsx("span",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:t.group,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.projectTitle})]})},`ph-${n.projectId}`);if(n.kind==="group"){const A=n.projectId?`${n.projectId}-${n.groupType}`:n.groupType;return e.jsx("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",height:X,borderBottom:`1px solid ${t.border}`,background:t.headerBg},onClick:()=>b(A),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[n.collapsed?e.jsx(L.ChevronRight,{size:14,style:{color:t.textSecondary,flexShrink:0}}):e.jsx(L.ChevronDown,{size:14,style:{color:t.textSecondary,flexShrink:0}}),e.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:t.textTitle},children:p(`gantt.group.${n.groupType}`,n.label)}),e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:9999,background:"rgba(0,0,0,0.06)",color:t.textSecondary},children:n.count})]})},`g-${A}`)}const s=n.task,k=y===s.id,c=M===s.id,C=s.originalType!=="step",u=v.has(s.id),T=$.has(s.id),i=y!==null&&s.id!==y&&!S.has(s.id),x=y!==null&&S.has(s.id),N=u?"#FFF5F5":k?t.groupLight:x?`${t.groupLight}99`:c?t.pageBg:t.surface;return e.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",transition:"opacity 0.18s, background 0.15s",height:X,borderBottom:`1px solid ${t.borderLight}`,background:N,borderLeft:k?`3px solid ${t.group}`:x?`3px solid ${t.group}66`:T?`3px solid ${t.today}`:void 0,opacity:i?.3:1},onClick:()=>D(A=>A===s.id?null:s.id),onDoubleClick:()=>o.onTaskClick?.(z(s)),onMouseEnter:()=>I(s.id),onMouseLeave:()=>I(null),children:[e.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,paddingRight:8},children:[s.originalType==="step"&&e.jsx("div",{style:{flexShrink:0,borderRadius:4,width:14,height:14,background:te[s.colorIdx??0].bar,border:`1.5px solid ${te[s.colorIdx??0].barBorder}`}}),s.originalType==="milestone"&&e.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:`${t.milestoneRing}30`,border:`1.5px solid ${t.milestoneRing}`},children:e.jsx(L.Flag,{size:11,style:{color:t.milestone}})}),s.originalType==="event"&&e.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:`${t.event}18`,border:`1.5px solid ${t.event}55`},children:e.jsx(L.Clock,{size:11,style:{color:t.event}})}),s.originalType==="note"&&e.jsx("div",{style:{flexShrink:0,width:16,height:20,background:s.noteColor||t.note,borderRadius:2,boxShadow:"1px 1px 3px rgba(0,0,0,0.14)",position:"relative",overflow:"visible"},children:e.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:"rgba(255,255,255,0.55)",borderRadius:1}})}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:500,lineHeight:1.25,color:k?t.group:u?t.today:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.originalType==="note"&&s.noteProjectTitle&&e.jsx("span",{style:{fontSize:10,color:t.textSecondary,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.noteProjectTitle})]}),s.originalType==="note"&&(s.filesCount||0)>0&&e.jsxs("span",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:2,fontSize:10,padding:"2px 6px",borderRadius:9999,color:t.textSecondary,background:t.headerBg,border:`1px solid ${t.borderLight}`},children:[e.jsx(L.Paperclip,{size:9}),s.filesCount]}),u&&e.jsx(L.AlertTriangle,{size:12,style:{flexShrink:0,color:t.today}})]}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:u?t.today:t.textMuted},children:Z(s.start)}),e.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:u?t.today:t.textMuted},children:C?"—":Z(s.end)})]},s.id)})})})]})}function He(o,p,g="en"){const m=p==="day"?Oe:Xe,f=(n,s)=>{const k=[],c=new Date().toDateString();let C=-1;for(let u=0;u<s;u++){const T=J(n,u),i=T.toDateString()===c;i&&(C=u),k.push({date:T,isToday:i,isWeekend:T.getDay()===0||T.getDay()===6})}return{daysArr:k,todayIndex:C}};if(o.length===0){const n=new Date,s=ze(n),k=De(n),c=le(s,k)+1,{daysArr:C,todayIndex:u}=f(s,c);return{start:s,end:k,totalDays:c,dayWidth:m,totalWidth:c*m,months:[{date:s,label:`${We(s,g)} ${s.getFullYear()}`,startDay:0,days:c,width:c*m}],years:[{label:s.getFullYear().toString(),width:c*m}],days:C,todayIndex:u}}let w=new Date(o[0].start),b=new Date(o[0].end);o.forEach(n=>{n.start<w&&(w=new Date(n.start)),n.end>b&&(b=new Date(n.end))});const M=ze(J(w,-14)),I=De(J(b,14)),y=le(M,I)+1,D=[];let v=new Date(M);for(;v<=I;){const n=De(v),s=n>I?I:n,k=le(M,v),c=le(v,s)+1;D.push({date:new Date(v),label:`${We(v,g)} ${v.getFullYear()}`,startDay:k,days:c,width:c*m}),v=new Date(v.getFullYear(),v.getMonth()+1,1)}const{daysArr:$,todayIndex:S}=f(M,y),z=[];if(p==="month"){let n="",s=0;for(const k of D){const c=k.date.getFullYear().toString();c!==n?(n&&z.push({label:n,width:s*m}),n=c,s=k.days):s+=k.days}n&&z.push({label:n,width:s*m})}return{start:M,end:I,totalDays:y,dayWidth:m,totalWidth:y*m,months:D,years:z,days:$,todayIndex:S}}function re(o,p){return le(p.start,o)*p.dayWidth}function Ve({task:o,x:p,y:g,w:m,progW:f,isHov:w,isDrag:b,isResize:M,isCritical:I,isDelayed:y,isConnectTarget:D,showDots:v,isBarDimmed:$,isBarHighlighted:S,commonEvents:z,handleResizeMouseDown:n,handleConnectDotMouseDown:s}){const{timeline:k,viewMode:c}=ge();if(o.originalType==="step"){const C=te[o.colorIdx??0],u=g+(X-ee)/2,T=!!(o.previsionStart&&o.previsionEnd),i=T?re(o.previsionStart,k):0,x=T?Math.max(re(o.previsionEnd,k)-i,c==="month"?k.dayWidth:6):0,N=u+ee+3;return e.jsxs(e.Fragment,{children:[T&&e.jsx("div",{title:`Previsto: ${Z(o.previsionStart)} → ${Z(o.previsionEnd)}`,style:{position:"absolute",left:i,top:N,width:x,height:5,borderRadius:3,background:`${C.progress}33`,border:`1.5px solid ${C.progress}66`,boxShadow:`inset 0 0 0 1px ${C.progress}22`,pointerEvents:"none",zIndex:5}}),e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p,top:u,width:m,height:ee,borderRadius:ee/2,background:y?"linear-gradient(135deg, #fdd, #fee)":C.bar,border:I?`2px solid ${t.today}`:y?`1.5px solid ${t.today}88`:`1.5px solid ${C.barBorder}`,cursor:b||M?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${C.progress}22`:"none",transform:w?"scaleY(1.06)":"scaleY(1)",opacity:$?.15:1,transition:b||M?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[e.jsxs("div",{style:{position:"absolute",left:0,top:0,width:m,height:"100%",borderRadius:ee/2,overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,width:f,height:"100%",background:y?`linear-gradient(90deg, ${t.today}cc, ${t.today}88)`:`linear-gradient(90deg, ${C.progress}, ${C.progress}cc)`,borderRadius:`${ee/2}px 0 0 ${ee/2}px`,transition:b||M?"none":"width 0.3s"}}),m>50&&e.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:o.progress>50?"#fff":y?t.today:C.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(o.progress),"%"]})]}),e.jsx("div",{onMouseDown:A=>n(A,o,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${ee/2}px 0 0 ${ee/2}px`}}),e.jsx("div",{onMouseDown:A=>n(A,o,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${ee/2}px ${ee/2}px 0`}}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:A=>s(A,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:A=>s(A,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})]})}if(o.originalType==="milestone"){const C=g+(X-de)/2;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p-6,top:C,height:de,minWidth:Me,borderRadius:de/2,background:I?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #e8f5ee, #f0f8f4)",border:D?`2px solid ${t.group}`:I?`2px solid ${t.today}`:`1.5px solid ${t.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${t.milestone}22`:"0 1px 3px rgba(0,0,0,0.06)",opacity:$?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:I?t.today:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:11,color:"#fff",strokeWidth:2.5})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:I?t.today:t.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:o.name}),o.progress>=100&&e.jsx("span",{style:{fontSize:9,fontWeight:700,color:"#fff",background:t.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="event"){const C=g+(X-de)/2;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p-6,top:C,height:de,minWidth:Me,borderRadius:de/2,background:I?"linear-gradient(135deg, #fee, #fff5f5)":"linear-gradient(135deg, #fff7ed, #ffedd5)",border:D?`2px solid ${t.group}`:I?`2px solid ${t.today}`:`1.5px solid ${t.event}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 0 4px 16px ${t.group}33`:I?`0 0 0 1px ${t.today}44, 0 3px 12px ${t.today}22`:S&&!w?`0 0 0 2px ${t.group}99, 0 3px 14px ${t.group}33`:w?`0 3px 12px ${t.event}33`:"0 1px 3px rgba(0,0,0,0.06)",opacity:$?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:I?t.today:t.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:11,color:"#fff",strokeWidth:2.5})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:I?t.today:t.event,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:o.name}),o.progress>=100&&e.jsx("span",{style:{fontSize:9,fontWeight:700,color:"#fff",background:t.event,borderRadius:6,padding:"1px 5px"},children:"✓"}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:u=>s(u,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}if(o.originalType==="note"){const u=g+4,T=o.noteColor||"#FEF08A",i=o.filesCount||0;return e.jsxs("div",{"data-task-id":o.id,...z,style:{position:"absolute",left:p,top:u,width:148,minHeight:72,background:T,borderRadius:3,cursor:b?"grabbing":"grab",zIndex:w||D?20:10,boxShadow:D?`0 0 0 2px ${t.group}, 4px 6px 16px rgba(0,0,0,0.22)`:S&&!w?`0 0 0 2px ${t.group}99, 3px 4px 14px rgba(0,0,0,0.18)`:w?"4px 6px 18px rgba(0,0,0,0.22)":"2px 3px 8px rgba(0,0,0,0.13)",opacity:$?.2:1,transition:b?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:w?"rotate(-1.5deg) scale(1.03) translateY(-2px)":"rotate(0deg)",border:"1px solid rgba(0,0,0,0.06)",padding:"12px 10px 10px",display:"flex",flexDirection:"column",gap:2,userSelect:"none"},children:[e.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:11,background:"rgba(255,255,255,0.55)",borderRadius:2,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"}}),e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#1a1a1a",lineHeight:"1.3",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o.name}),o.projectTitle&&e.jsx("span",{style:{fontSize:10,fontWeight:400,color:"rgba(0,0,0,0.55)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.projectTitle}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[e.jsx("span",{style:{fontSize:9,fontWeight:500,color:"rgba(0,0,0,0.45)"},children:Z(o.start)}),i>0&&e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:9,color:"rgba(0,0,0,0.45)"},children:[e.jsx(L.Paperclip,{size:8})," ",i]})]}),v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-task-id":o.id,onMouseDown:x=>s(x,o,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}}),e.jsx("div",{"data-task-id":o.id,onMouseDown:x=>s(x,o,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:t.group,border:"2.5px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",cursor:"crosshair",zIndex:30}})]})]})}return null}function Ue(){const{arrows:o,hoveredTaskId:p,selectedTaskId:g,relatedIds:m}=ge();return e.jsx(e.Fragment,{children:o.map((f,w)=>{const b=p===f.predId||p===f.succId,M=!g||f.predId===g||f.succId===g||m.has(f.predId)||m.has(f.succId),I=g!==null&&M,y=b?t.arrowHover:I?t.group:t.arrow;return e.jsxs("g",{style:{opacity:M?I?1:void 0:.08,transition:"opacity 0.18s"},children:[e.jsx("path",{d:f.path,fill:"none",stroke:y,strokeWidth:I?2.5:b?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),e.jsx("polygon",{points:`${f.headX},${f.headY} ${f.headX-6},${f.headY-4} ${f.headX-6},${f.headY+4}`,fill:y,style:{transition:"fill 0.2s"}})]},w)})})}const Ce=o=>({id:o.id,name:o.name,start:o.start,end:o.end,type:o.originalType==="step"?"task":o.originalType,progress:o.progress}),fe=(o,p)=>{switch(o){case"step":return e.jsx("div",{style:{width:12,height:12,borderRadius:2,background:te[p??0].bar,border:`1.5px solid ${te[p??0].barBorder}`,flexShrink:0}});case"milestone":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Flag,{size:8,color:"#fff"})});case"event":return e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:t.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(L.Clock,{size:8,color:"#fff"})});case"note":return e.jsx("div",{style:{width:12,height:14,background:t.note,borderRadius:2,boxShadow:"1px 1px 2px rgba(0,0,0,0.1)",flexShrink:0}});default:return null}};function qe(){const{props:o,viewMode:p,timeline:g,displayRows:m,dragState:f,resizeState:w,connectState:b,pendingConnection:M,setPendingConnection:I,depModalType:y,setDepModalType:D,depModalLag:v,setDepModalLag:$,depCreating:S,deletingDepId:z,setDeletingDepId:n,chartMenu:s,setChartMenu:k,rightBodyRef:c,timeHeaderRef:C,handleChartMouseDown:u,handleChartWheel:T,openChartMenu:i,handleRightScroll:x,hoveredTaskId:N,setHoveredTaskId:A,selectedTaskId:q,setSelectedTaskId:Y,tooltip:a,setTooltip:O,popupState:G,setPopupState:K,criticalIds:V,delayedIds:se,relatedIds:ce,handleBarMouseDown:we,handleResizeMouseDown:ue,handleConnectDotMouseDown:Se,handleCreateDependency:ke}=ge(),{translations:ie,onViewStage:ye,onEditStage:j,onDeleteStage:_,onDeleteDependency:xe,onAddNewStage:me,onAddMilestone:Ie,onAddEvent:Te,onAddNote:ae}=o,F=(r,d)=>ie?typeof ie=="function"?ie(r,d):ie[r]||d:d,be=(r,d)=>Math.round((d.getTime()-r.getTime())/864e5)+1,oe=Math.max(m.length*X,400)+80,ve=()=>K({isOpen:!1,position:{x:0,y:0},task:null});return e.jsxs("div",{style:{flex:1,width:"100%",background:"#FAFAFA",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",borderLeft:`1px solid ${t.borderLight}`},children:[e.jsx("div",{ref:C,style:{boxSizing:"border-box",height:he*2,background:t.headerBg,borderBottom:`1px solid ${t.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:"0 1px 3px rgba(0,0,0,0.02)"},onWheel:T,children:e.jsxs("div",{style:{width:g.totalWidth,height:"100%",position:"relative"},children:[e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:he,display:"flex"},children:[p==="day"&&g.months.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:r.label})},d)),p==="month"&&g.years?.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:e.jsx("span",{style:{fontSize:13,fontWeight:700,color:t.textTitle,letterSpacing:"0.02em"},children:r.label})},d))]}),e.jsxs("div",{style:{position:"absolute",top:he,left:0,right:0,height:he,display:"flex"},children:[p==="day"&&g.days.map((r,d)=>{const l=r.isToday;return e.jsx("div",{style:{width:g.dayWidth,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:l?800:500,color:l?t.today:t.textSecondary,letterSpacing:"-0.03em"},children:r.date.getDate().toString().padStart(2,"0")})},d)}),p==="month"&&g.months.map((r,d)=>e.jsx("div",{style:{width:r.width,position:"relative",height:"100%",borderRight:`1px solid ${t.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:r.label.substring(0,3)})},d))]})]})}),e.jsx("div",{ref:c,className:"zg-no-scrollbar",style:{flex:1,overflow:"auto",background:"#fff",position:"relative"},onScroll:x,onMouseDown:u,onWheel:T,onContextMenu:i,children:e.jsxs("div",{style:{width:g.totalWidth,height:oe,position:"relative"},children:[e.jsxs("svg",{width:g.totalWidth,height:oe,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsxs("defs",{children:[e.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:g.dayWidth,height:X,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:g.dayWidth,y1:"0",x2:g.dayWidth,y2:X,stroke:t.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),e.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:g.dayWidth,height:X,patternUnits:"userSpaceOnUse",children:e.jsx("line",{x1:"0",y1:X,x2:g.dayWidth,y2:X,stroke:t.borderLight,strokeWidth:"1"})})]}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),e.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),p==="day"&&g.days.map((r,d)=>r.isWeekend?e.jsx("rect",{x:d*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.weekendBg,opacity:.6},`we-${d}`):null),p==="month"&&g.days.map((r,d)=>r.isWeekend?e.jsx("rect",{x:d*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.weekendBg,opacity:.3},`wem-${d}`):null),g.todayIndex>=0&&e.jsxs("g",{children:[e.jsx("rect",{x:g.todayIndex*g.dayWidth,y:0,width:g.dayWidth,height:oe,fill:t.todayBg}),e.jsx("line",{x1:(g.todayIndex+.5)*g.dayWidth,y1:0,x2:(g.todayIndex+.5)*g.dayWidth,y2:oe,stroke:t.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),m.map((r,d)=>r.kind==="group"||r.kind==="projectHeader"?e.jsx("div",{style:{boxSizing:"border-box",position:"absolute",left:0,top:d*X,width:"100%",height:X,background:r.kind==="projectHeader"?t.headerBg:`${t.groupLight}15`,borderBottom:`1px solid ${t.borderLight}`,pointerEvents:"none"}},`bg-${d}`):null),e.jsxs("div",{style:{position:"absolute",inset:0},children:[m.map((r,d)=>{if(r.kind!=="task")return null;const l=r.task,E=f?.task.id===l.id,B=w?.task.id===l.id,P=E||B&&w.edge==="left"?J(l.start,E?f.offsetDays:w.offsetDays):l.start,W=E||B&&w.edge==="right"?J(l.end,E?f.offsetDays:w.offsetDays):l.end,pe=l.originalType!=="step";let ne=re(P,g),H=0,Le=0;pe||(H=Math.max(re(W,g)-ne,g.dayWidth),Le=H*(l.progress/100));const je=N===l.id,Fe=q===l.id,rt=se.has(l.id),nt=V.has(l.id),st=!!q&&!Fe&&!ce.has(l.id),at=Fe||!!q&&ce.has(l.id),it=b?.hoverTargetId===l.id,dt=je||Fe,lt=d*X,ct={onMouseEnter:Q=>{A(l.id),!f&&!w&&O({task:l,x:Q.clientX,y:Q.clientY})},onMouseMove:Q=>{N===l.id&&!f&&!w&&O({task:l,x:Q.clientX,y:Q.clientY})},onMouseLeave:()=>{A(null),O(null)},onClick:Q=>{Q.stopPropagation(),Y(l.id),Q.detail===2&&ye?.(Ce(l)),K(!G.isOpen||G.task?.id!==l.id?{isOpen:!0,position:{x:Q.clientX,y:Q.clientY},task:l}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:Q=>we(Q,l)};return e.jsx(Ve,{task:l,x:ne,y:lt,w:H,progW:Le,isHov:je,isDrag:E,isResize:B,isCritical:nt,isDelayed:rt,isConnectTarget:it,showDots:dt,isBarDimmed:st,isBarHighlighted:at,commonEvents:ct,handleResizeMouseDown:ue,handleConnectDotMouseDown:Se},l.id)}),e.jsx("svg",{width:g.totalWidth,height:oe,style:{position:"absolute",inset:0,pointerEvents:"none"},children:e.jsx(Ue,{})}),a&&!f&&e.jsx("div",{style:{position:"fixed",left:a.x+16,top:a.y-10,zIndex:9999,pointerEvents:"none"},children:e.jsxs("div",{style:{borderRadius:12,padding:"12px 16px",minWidth:220,maxWidth:340,background:`${t.surface}f5`,border:`1px solid ${t.borderLight}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[fe(a.task.originalType,a.task.colorIdx),e.jsx("span",{style:{fontSize:12,fontWeight:700,color:t.textTitle,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.task.name})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:t.textSecondary},children:a.task.originalType==="step"?e.jsxs(e.Fragment,{children:[a.task.previsionStart&&a.task.previsionEnd&&e.jsxs("div",{style:{background:`${t.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:`${t.textSecondary}44`,border:`1.5px solid ${t.textSecondary}66`}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t.textSecondary},children:F("gantt.tooltip.planned","Planned")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.previsionStart)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.end","End"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.previsionEnd)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.duration","Duration"),":"]}),e.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:[be(a.task.previsionStart,a.task.previsionEnd),"d"]})]})]}),e.jsxs("div",{style:{background:a.task.hasActualDates?`${t.groupLight}22`:"transparent",borderRadius:6,padding:"4px 6px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[e.jsx("div",{style:{width:20,height:4,borderRadius:2,background:te[a.task.colorIdx??0].progress}}),e.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:a.task.hasActualDates?t.group:t.textSecondary},children:a.task.hasActualDates?F("gantt.tooltip.actual","Actual"):F("gantt.tooltip.plannedInUse","Planned (in use)")})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.end","End"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.end)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.duration","Duration"),":"]}),e.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:[be(a.task.start,a.task.end),"d"]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,paddingTop:4,marginTop:4,borderTop:`1px solid ${t.borderLight}`},children:[e.jsxs("span",{children:[F("charts.gantt.progress","Progress"),":"]}),e.jsxs("span",{style:{fontWeight:700,color:t.group},children:[Math.round(a.task.progress),"%"]})]})]}):a.task.originalType==="note"?e.jsxs(e.Fragment,{children:[a.task.noteProjectTitle&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[e.jsx("div",{style:{width:8,height:8,borderRadius:2,background:a.task.noteColor||t.note,flexShrink:0}}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.task.noteProjectTitle})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.date","Date"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]}),(a.task.filesCount||0)>0&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("gantt.tooltip.attachments","Attachments"),":"]}),e.jsxs("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:4,color:t.textPrimary},children:[e.jsx(L.Paperclip,{size:10}),a.task.filesCount]})]})]}):e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[e.jsxs("span",{children:[F("charts.gantt.start","Start"),":"]}),e.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:t.textPrimary},children:Z(a.task.start)})]})})]})})]})]})}),G.task&&G.isOpen&&(()=>{const r=G.task,d=(o.dependencies||[]).filter(W=>W.predecessorId===r.id||W.successorId===r.id),l={FS:F("gantt.depType.fs","Finish to Start"),SS:F("gantt.depType.ss","Start to Start"),FF:F("gantt.depType.ff","Finish to Finish"),SF:F("gantt.depType.sf","Start to Finish")},E=d.length>0?300:220,B=Math.min(G.position.x,window.innerWidth-E-16),P=G.position.y+8;return e.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:B,top:P,zIndex:9999,background:"#fff",borderRadius:4,boxShadow:"0 12px 40px rgba(0,0,0,0.14), 0 3px 10px rgba(0,0,0,0.07)",border:`1.5px solid ${t.borderLight}`,width:E,overflow:"hidden"},onMouseDown:W=>W.stopPropagation(),children:[e.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${t.borderLight}`},children:e.jsx("p",{style:{fontSize:13,fontWeight:700,color:t.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:r.name,children:r.name})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[e.jsxs("button",{onClick:()=>{ye?.(Ce(r)),ve()},className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left"},children:[e.jsx(L.Eye,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.viewDetails","View details")})]}),e.jsxs("button",{onClick:()=>{j?.(Ce(r)),ve()},className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left"},children:[e.jsx(L.Edit2,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.edit","Edit")})]}),e.jsxs("button",{onClick:()=>{_?.(r.id),ve()},className:"zg-popup-btn zg-popup-btn-danger",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:"#ef4444",textAlign:"left"},children:[e.jsx(L.Trash2,{size:15})," ",e.jsx("span",{style:{flex:1,textAlign:"left"},children:F("gantt.popup.delete","Delete")})]})]}),d.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${t.borderLight}`,padding:"10px 14px 12px"},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:[F("gantt.popup.relations","Relations")," (",d.length,")"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:d.map(W=>{const pe=W.predecessorId===r.id,ne=pe?W.successorName:W.predecessorName,H=z===W.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"#f8fafb",border:`1px solid ${t.borderLight}`},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:t.group,marginBottom:2},children:[e.jsx("span",{style:{background:`${t.group}15`,borderRadius:4,padding:"1px 5px"},children:W.type})," ",e.jsx("span",{style:{color:t.textSecondary,fontWeight:500},children:pe?"→ ":"← "}),e.jsx("span",{style:{color:t.textMuted,fontWeight:400,fontSize:9},children:l[W.type]??W.type})]}),e.jsx("div",{style:{fontSize:11,color:t.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:ne,children:ne})]}),xe&&e.jsx("button",{disabled:!!H,onClick:async()=>{n(W.id);try{await xe(W.id)}finally{n(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:H?"#fee2e2":"transparent",cursor:H?"wait":"pointer",color:"#ef4444",fontSize:14,opacity:H?.5:1,transition:"background 0.12s"},children:H?"⟳":"🗑"})]},W.id)})})]})]})})(),s&&e.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(s.x,window.innerWidth-220),top:Math.min(s.y,window.innerHeight-220),zIndex:99999,background:"#fff",borderRadius:10,boxShadow:"0 12px 40px rgba(0,0,0,0.15), 0 3px 10px rgba(0,0,0,0.08)",border:`1.5px solid ${t.borderLight}`,width:200,overflow:"hidden"},onClick:r=>r.stopPropagation(),children:[e.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${t.borderLight}`,background:t.headerBg},children:e.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:t.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:[F("gantt.chart.addOn","Add on")," ",Z(s.date)]})}),e.jsx("div",{style:{padding:"5px 5px"},children:[{label:F("gantt.newAction.step","Step"),icon:fe("step",0),action:()=>{me?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.milestone","Milestone"),icon:fe("milestone"),action:()=>{Ie?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.event","Event"),icon:fe("event"),action:()=>{Te?.(s.date,s.projectId),k(null)}},{label:F("gantt.newAction.note","Note"),icon:fe("note"),action:()=>{ae?.(s.date,s.projectId),k(null)}}].map(r=>e.jsxs("button",{onClick:r.action,className:"zg-popup-btn",style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 10px",borderRadius:7,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:500,color:t.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[r.icon," ",r.label]},r.label))})]}),b&&e.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[e.jsx("defs",{children:e.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:e.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:t.group})})}),e.jsx("line",{x1:b.fromScreenX,y1:b.fromScreenY,x2:b.currentScreenX,y2:b.currentScreenY,stroke:t.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"zg-dash 0.5s linear infinite"}})]}),M&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>I(null),children:e.jsxs("div",{style:{background:"#fff",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"0 24px 80px rgba(0,0,0,0.18), 0 6px 24px rgba(0,0,0,0.08)"},onClick:r=>r.stopPropagation(),children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:700,color:t.textTitle,marginBottom:4},children:F("gantt.depModal.title","Relation Type")}),e.jsx("p",{style:{fontSize:13,color:t.textSecondary},children:F("gantt.depModal.subtitle","Choose how the two tasks relate")})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:F("gantt.depModal.fs","Finish to Start"),desc:F("gantt.depModal.fsDesc","B starts when A finishes")},{type:"SS",label:F("gantt.depModal.ss","Start to Start"),desc:F("gantt.depModal.ssDesc","A and B start together")},{type:"FF",label:F("gantt.depModal.ff","Finish to Finish"),desc:F("gantt.depModal.ffDesc","A and B finish together")},{type:"SF",label:F("gantt.depModal.sf","Start to Finish"),desc:F("gantt.depModal.sfDesc","B finishes when A starts")}].map(r=>e.jsxs("button",{onClick:()=>D(r.type),style:{border:y===r.type?`2px solid ${t.group}`:`1.5px solid ${t.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:y===r.type?`${t.group}0d`:"#fafafa"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:t.group,marginBottom:4,background:y===r.type?`${t.group}20`:`${t.group}0d`,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:r.type}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:2},children:r.label}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary},children:r.desc})]},r.type))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:t.textTitle,marginBottom:6},children:F("gantt.depModal.lagLabel","Lag (days)")}),e.jsx("input",{type:"number",value:v,onChange:r=>$(parseInt(r.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${t.borderLight}`,borderRadius:8,fontSize:14}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:()=>I(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${t.borderLight}`,background:"#fff",cursor:"pointer",fontWeight:600},children:F("gantt.depModal.cancel","Cancel")}),e.jsx("button",{onClick:ke,disabled:S,style:{padding:"10px 16px",borderRadius:8,border:"none",background:t.group,color:"#fff",cursor:S?"wait":"pointer",fontWeight:600},children:S?F("gantt.depModal.saving","Saving..."):F("gantt.depModal.create","Create Dependency")})]})]})})]})}function Ke(o){const p=h.useRef(null),g=h.useRef(null),m=h.useRef(null),f=h.useRef(!1),w=h.useCallback(()=>{if(f.current)return;f.current=!0;const y=g.current;y&&p.current&&(p.current.scrollTop=y.scrollTop),y&&m.current&&(m.current.scrollLeft=y.scrollLeft),f.current=!1},[]),b=h.useCallback(()=>{f.current||(f.current=!0,p.current&&g.current&&(g.current.scrollTop=p.current.scrollTop),f.current=!1)},[]),M=h.useRef(!1);h.useEffect(()=>{if(M.current||!o.totalWidth)return;const y=g.current;if(!y)return;const D=re(new Date,o);if(D>=0&&D<=o.totalWidth){const v=D-y.clientWidth/2;y.scrollLeft=Math.max(0,v),m.current&&(m.current.scrollLeft=y.scrollLeft),M.current=!0}},[o]);const I=h.useCallback(y=>{const D=g.current;if(D)if(y.preventDefault(),y.shiftKey||Math.abs(y.deltaX)>Math.abs(y.deltaY)){const v=y.shiftKey?y.deltaY:y.deltaX;D.scrollLeft+=v,m.current&&(m.current.scrollLeft=D.scrollLeft)}else D.scrollTop+=y.deltaY,p.current&&(p.current.scrollTop=D.scrollTop)},[]);return{leftBodyRef:p,rightBodyRef:g,timeHeaderRef:m,handleRightScroll:w,handleLeftScroll:b,handleChartWheel:I}}function Je(o,p,g,m){const f=new Map;return o.forEach(w=>f.set(w.id,w)),p.map(w=>{const b=f.get(w.predecessorId),M=f.get(w.successorId);if(!b||!M)return null;const I=m.get(b.id),y=m.get(M.id);if(I==null||y==null)return null;const D=b.originalType!=="step",v=M.originalType!=="step",$=D?re(b.start,g)+Me:re(b.end,g),S=I*X+X/2,z=v?re(M.start,g)-10:re(M.start,g),n=y*X+X/2,s=14,k=Math.max($+s,z-s),c=S===n?`M${$},${S} L${z-6},${n}`:`M${$},${S} L${k},${S} L${k},${n} L${z-6},${n}`;return{predId:b.id,succId:M.id,path:c,headX:z-6,headY:n}}).filter(Boolean)}function Ze(o,p){if(o.length===0||p.length===0)return new Set;const g=new Map;o.forEach(c=>g.set(c.id,c));const m=new Set(o.map(c=>c.id)),f=p.filter(c=>m.has(c.predecessorId)&&m.has(c.successorId));if(f.length===0)return new Set;const w=new Map,b=new Map;f.forEach(c=>{w.has(c.predecessorId)||w.set(c.predecessorId,[]),w.get(c.predecessorId).push(c.successorId),b.has(c.successorId)||b.set(c.successorId,[]),b.get(c.successorId).push(c.predecessorId)});const M=c=>Math.max(1,le(c.start,c.end)),I=new Set,y=[];function D(c){I.has(c)||(I.add(c),(w.get(c)||[]).forEach(D),y.unshift(c))}o.forEach(c=>D(c.id));const v=new Map,$=new Map;for(const c of y){const C=g.get(c),u=b.get(c)||[];let T=0;for(const x of u)T=Math.max(T,$.get(x)||0);const i=u.length>0?T:0;v.set(c,i),$.set(c,i+M(C))}let S=0;$.forEach(c=>{c>S&&(S=c)});const z=new Map,n=new Map;for(let c=y.length-1;c>=0;c--){const C=y[c],u=g.get(C),T=w.get(C)||[];let i=S;for(const x of T)i=Math.min(i,z.get(x)??S);n.set(C,T.length>0?i:S),z.set(C,(n.get(C)||0)-M(u))}const s=new Set;f.forEach(c=>{s.add(c.predecessorId),s.add(c.successorId)});const k=new Set;for(const c of y){if(!s.has(c))continue;const C=(z.get(c)||0)-(v.get(c)||0);Math.abs(C)<.5&&k.add(c)}return k}function Qe({steps:o,milestones:p,events:g,notes:m,dependencies:f,viewMode:w,locale:b,groupByProject:M,visibleTypes:I,collapsedGroups:y,collapsedProjects:D,selectedTaskId:v}){const $=h.useMemo(()=>{const u=[];let T=0;return o.forEach(i=>{const x=!!(i.startDate&&i.finishDate),N=i.startDate||i.previsionStartDate,A=i.finishDate||i.previsionFinishDate;if(!N||!A)return;const q=new Date(N),Y=new Date(A);if(isNaN(q.getTime())||isNaN(Y.getTime()))return;Y<=q&&Y.setDate(Y.getDate()+1);let a,O;if(i.previsionStartDate&&i.previsionFinishDate){const V=new Date(i.previsionStartDate),se=new Date(i.previsionFinishDate);!isNaN(V.getTime())&&!isNaN(se.getTime())&&(a=V,O=se<=V?J(V,1):se)}const G=f?.filter(V=>V.successorId===i.id).map(V=>V.predecessorId)||[],K=i.conclusionPercent!=null?Number(i.conclusionPercent):0;u.push({id:i.id,name:i.name,start:q,end:Y,progress:K>1?Math.min(K,100):K*100,originalType:"step",deps:G,colorIdx:T%te.length,previsionStart:a,previsionEnd:O,hasActualDates:x,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0}),T++}),p?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);if(isNaN(x.getTime()))return;const N=f?.filter(A=>A.successorId===i.id).map(A=>A.predecessorId)||[];u.push({id:i.id,name:i.name,start:x,end:x,progress:i.finished?100:0,originalType:"milestone",deps:N,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),g?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);if(isNaN(x.getTime()))return;const N=f?.filter(A=>A.successorId===i.id).map(A=>A.predecessorId)||[];u.push({id:i.id,name:i.title,start:x,end:x,progress:i.finished?100:0,originalType:"event",deps:N,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),m?.forEach(i=>{if(!i.date)return;const x=new Date(i.date);isNaN(x.getTime())||u.push({id:i.id,name:i.title||"Note",start:x,end:x,progress:0,originalType:"note",deps:[],noteCount:1,noteColor:i.color||t.note,filesCount:i.filesCount||0,noteProjectTitle:i.projectTitle||void 0,projectId:i.projectId||void 0,projectTitle:i.projectTitle||void 0})}),u},[o,p,g,m,f]),S=h.useMemo(()=>He($,w,b),[$,w,b]),z=h.useMemo(()=>{const u=[],T=["step","milestone","event","note"];if(M){const i=new Map;$.forEach(x=>{x.projectId&&!i.has(x.projectId)&&i.set(x.projectId,x.projectTitle||x.projectId)});for(const[x,N]of Array.from(i.entries())){const A=D.has(x);if(u.push({kind:"projectHeader",projectId:x,projectTitle:N,collapsed:A}),!A){const q=$.filter(Y=>Y.projectId===x);for(const Y of T){if(!I.has(Y))continue;const a=q.filter(K=>K.originalType===Y);if(a.length===0)continue;const O=`${x}-${Y}`,G=y.has(O);u.push({kind:"group",groupType:Y,label:$e[Y],count:a.length,collapsed:G,projectId:x}),G||a.forEach(K=>u.push({kind:"task",task:K}))}}}}else for(const i of T){if(!I.has(i))continue;const x=$.filter(A=>A.originalType===i);if(x.length===0)continue;const N=y.has(i);u.push({kind:"group",groupType:i,label:$e[i],count:x.length,collapsed:N}),N||x.forEach(A=>u.push({kind:"task",task:A}))}return u},[$,I,y,D,M]),n=h.useMemo(()=>{const u=new Map;return z.forEach((T,i)=>{T.kind==="task"&&u.set(T.task.id,i)}),u},[z]),s=h.useMemo(()=>Je($,f||[],S,n),[$,f,S,n]),k=h.useMemo(()=>Ze($,f||[]),[$,f]),c=h.useMemo(()=>{const u=new Set,T=new Date;return $.forEach(i=>{i.originalType==="step"&&i.end<T&&i.progress<100&&u.add(i.id)}),u},[$]),C=h.useMemo(()=>{if(!v||!f?.length)return new Set;const u=new Set,T=[v];for(;T.length;){const i=T.shift();for(const x of f)x.predecessorId===i&&!u.has(x.successorId)&&(u.add(x.successorId),T.push(x.successorId)),x.successorId===i&&!u.has(x.predecessorId)&&(u.add(x.predecessorId),T.push(x.predecessorId))}return u},[v,f]);return{tasks:$,timeline:S,displayRows:z,taskRowIndex:n,arrows:s,criticalIds:k,delayedIds:c,relatedIds:C}}function Re(o){const[p,g]=h.useState("day"),[m,f]=h.useState(null),[w,b]=h.useState(null),[M,I]=h.useState(null),[y,D]=h.useState({isOpen:!1,position:{x:0,y:0},task:null}),[v,$]=h.useState(null),[S,z]=h.useState(null),[n,s]=h.useState(null),[k,c]=h.useState(null),[C,u]=h.useState("FS"),[T,i]=h.useState(0),[x,N]=h.useState(!1),[A,q]=h.useState(null),[Y,a]=h.useState(null),[O,G]=h.useState(!1),K=h.useRef(null),[V,se]=h.useState(new Set(["step","milestone","event","note"])),[ce,we]=h.useState(new Set),[ue,Se]=h.useState(new Set),ke=h.useCallback(r=>{se(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),ie=h.useCallback(r=>{we(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),ye=h.useCallback(r=>{Se(d=>{const l=new Set(d);return l.has(r)?l.delete(r):l.add(r),l})},[]),j=Qe({steps:o.steps,milestones:o.milestones,events:o.events,notes:o.notes,dependencies:o.dependencies,viewMode:p,locale:o.locale,visibleTypes:V,collapsedGroups:ce,collapsedProjects:ue,groupByProject:o.groupByProject,selectedTaskId:w||null}),_=Ke(j.timeline),xe=h.useCallback((r,d)=>{r.preventDefault(),r.stopPropagation(),$({task:d,startMouseX:r.clientX,originalStart:new Date(d.start),originalEnd:new Date(d.end),offsetDays:0})},[]),me=h.useCallback((r,d,l)=>{r.preventDefault(),r.stopPropagation(),z({task:d,edge:l,startMouseX:r.clientX,originalStart:new Date(d.start),originalEnd:new Date(d.end),offsetDays:0})},[]),Ie=h.useCallback((r,d,l)=>{r.preventDefault(),r.stopPropagation(),s({fromTaskId:d.id,fromEdge:l,fromScreenX:r.clientX,fromScreenY:r.clientY,currentScreenX:r.clientX,currentScreenY:r.clientY,hoverTargetId:null})},[]),Te=h.useCallback(async()=>{if(!k||!o.onCreateDependency)return;const r=new Map(j.tasks.map(W=>[W.id,W])),d=r.get(k.fromTaskId),l=r.get(k.toTaskId);if(!d||!l)return;const E=W=>W.originalType==="step"?"STEP":"MILESTONE",B=k.fromEdge==="right"?d:l,P=k.fromEdge==="right"?l:d;N(!0);try{await o.onCreateDependency({predecessorId:B.id,predecessorType:E(B),successorId:P.id,successorType:E(P),type:C,lag:T}),c(null)}finally{N(!1)}},[k,j.tasks,o.onCreateDependency,C,T]);h.useEffect(()=>{if(!v)return;const r=l=>{const E=l.clientX-v.startMouseX,B=Math.round(E/j.timeline.dayWidth);B!==v.offsetDays&&$(P=>P?{...P,offsetDays:B}:null)},d=()=>{v.offsetDays!==0&&o.onTaskChange&&o.onTaskChange({id:v.task.id,name:v.task.name,start:J(v.originalStart,v.offsetDays),end:J(v.originalEnd,v.offsetDays),type:v.task.originalType==="step"?"task":"milestone",progress:v.task.progress}),$(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[v,j.timeline.dayWidth,o.onTaskChange]),h.useEffect(()=>{if(!S)return;const r=l=>{const E=l.clientX-S.startMouseX,B=Math.round(E/j.timeline.dayWidth);B!==S.offsetDays&&z(P=>P?{...P,offsetDays:B}:null)},d=()=>{if(S.offsetDays!==0&&o.onTaskChange){const l=S.edge==="left"?J(S.originalStart,S.offsetDays):S.originalStart,E=S.edge==="right"?J(S.originalEnd,S.offsetDays):S.originalEnd;E>l&&o.onTaskChange({id:S.task.id,name:S.task.name,start:l,end:E,type:"task",progress:S.task.progress})}z(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[S,j.timeline.dayWidth,o.onTaskChange]),h.useEffect(()=>{if(!n)return;const r=l=>{let E=null;for(const B of document.elementsFromPoint(l.clientX,l.clientY)){const P=B.dataset?.taskId;if(P&&P!==n.fromTaskId){E=P;break}}s(B=>B?{...B,currentScreenX:l.clientX,currentScreenY:l.clientY,hoverTargetId:E}:null)},d=l=>{let E=null;for(const B of document.elementsFromPoint(l.clientX,l.clientY)){const P=B.dataset?.taskId;if(P&&P!==n.fromTaskId){E=P;break}}E&&o.onCreateDependency&&(c({fromTaskId:n.fromTaskId,fromEdge:n.fromEdge,toTaskId:E}),u("FS"),i(0)),s(null)};return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[n?.fromTaskId,n?.fromEdge,o.onCreateDependency]);const[ae,F]=h.useState(null),be=h.useCallback(r=>{if(S||v||r.button===2)return;const d=_.rightBodyRef.current;d&&(r.preventDefault(),F({startX:r.clientX,startY:r.clientY,scrollLeft:d.scrollLeft,scrollTop:d.scrollTop}))},[S,v,_.rightBodyRef]);h.useEffect(()=>{if(!ae)return;const r=l=>{const E=_.rightBodyRef.current;E&&(E.scrollLeft=ae.scrollLeft-(l.clientX-ae.startX),E.scrollTop=ae.scrollTop-(l.clientY-ae.startY),_.leftBodyRef.current&&(_.leftBodyRef.current.scrollTop=E.scrollTop),_.timeHeaderRef.current&&(_.timeHeaderRef.current.scrollLeft=E.scrollLeft))},d=()=>F(null);return document.addEventListener("mousemove",r),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",d)}},[ae,_.rightBodyRef,_.leftBodyRef,_.timeHeaderRef]);const oe=h.useCallback(r=>{r.preventDefault(),r.stopPropagation();const d=E=>{const B=_.rightBodyRef.current;if(!B)return new Date;const P=B.getBoundingClientRect(),W=E-P.left+B.scrollLeft;return J(j.timeline.start,Math.max(0,Math.floor(W/j.timeline.dayWidth)))},l=E=>{if(!o.groupByProject)return;const B=_.leftBodyRef.current;if(!B)return;const P=B.getBoundingClientRect(),W=E-P.top+B.scrollTop,pe=Math.max(0,Math.floor(W/50));for(let ne=Math.min(pe,j.displayRows.length-1);ne>=0;ne--){const H=j.displayRows[ne];if(H.kind==="projectHeader")return H.projectId;if(H.kind==="task"&&H.task.projectId)return H.task.projectId;if(H.kind==="group"&&H.projectId)return H.projectId}};a({x:r.clientX,y:r.clientY,date:d(r.clientX),projectId:l(r.clientY)}),F(null)},[j.timeline,j.displayRows,o.groupByProject,_.rightBodyRef,_.leftBodyRef]);h.useEffect(()=>{if(!Y)return;const r=E=>{E.key==="Escape"&&a(null)},d=E=>{E.target.closest('[data-menu="chart-create"]')||a(null)},l=()=>a(null);return document.addEventListener("keydown",r),document.addEventListener("click",d),window.addEventListener("scroll",l,!0),()=>{document.removeEventListener("keydown",r),document.removeEventListener("click",d),window.removeEventListener("scroll",l,!0)}},[Y]);const ve=h.useMemo(()=>({props:o,t:(r,d)=>o.translations?typeof o.translations=="function"?o.translations(r,d):o.translations[r]||d||"":d||"",viewMode:p,setViewMode:g,hoveredTaskId:m,setHoveredTaskId:f,selectedTaskId:w,setSelectedTaskId:b,tooltip:M,setTooltip:I,popupState:y,setPopupState:D,dragState:v,setDragState:$,resizeState:S,setResizeState:z,connectState:n,setConnectState:s,visibleTypes:V,setVisibleTypes:se,toggleVisibility:ke,collapsedGroups:ce,setCollapsedGroups:we,toggleGroup:ie,collapsedProjects:ue,setCollapsedProjects:Se,toggleProject:ye,pendingConnection:k,setPendingConnection:c,depModalType:C,setDepModalType:u,depModalLag:T,setDepModalLag:i,depCreating:x,setDepCreating:N,deletingDepId:A,setDeletingDepId:q,chartMenu:Y,setChartMenu:a,newActionOpen:O,setNewActionOpen:G,tasks:j.tasks,timeline:j.timeline,displayRows:j.displayRows,taskRowIndex:j.taskRowIndex||new Map,arrows:j.arrows,criticalIds:j.criticalIds,delayedIds:j.delayedIds,relatedIds:j.relatedIds,..._,newActionRef:K,screenXToDate:r=>{const d=_.rightBodyRef.current;if(!d)return new Date;const l=d.getBoundingClientRect(),E=r-l.left+d.scrollLeft;return J(j.timeline.start,Math.max(0,Math.floor(E/j.timeline.dayWidth)))},screenYToProjectId:r=>{if(!o.groupByProject)return;const d=_.leftBodyRef.current;if(!d)return;const l=d.getBoundingClientRect(),E=r-l.top+d.scrollTop,B=Math.max(0,Math.floor(E/50));for(let P=Math.min(B,j.displayRows.length-1);P>=0;P--){const W=j.displayRows[P];if(W.kind==="projectHeader")return W.projectId;if(W.kind==="task"&&W.task.projectId)return W.task.projectId;if(W.kind==="group"&&W.projectId)return W.projectId}},handleChartMouseDown:be,openChartMenu:oe,handleBarMouseDown:xe,handleResizeMouseDown:me,handleConnectDotMouseDown:Ie,handleCreateDependency:Te}),[o,p,m,w,M,y,v,S,n,V,ce,ue,k,C,T,x,A,Y,O,j,_,ke,ie,ye,be,oe,xe,me,Ie,Te]);return o.loading?e.jsx("div",{style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:t.textSecondary},children:e.jsx(L.Loader2,{size:32,style:{animation:"zg-spin 1.5s linear infinite",color:t.group}})}):e.jsx(Pe,{value:ve,children:e.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",marginLeft:"auto",marginRight:"auto",background:"#fff",borderRadius:12,boxShadow:"0 8px 30px rgb(0,0,0,0.06)",overflow:"hidden",height:"calc(100vh - 48px)",minHeight:600,border:`1px solid ${t.borderLight}`},children:[e.jsx(_e,{}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",position:"relative",background:t.surfaceAlt},children:[e.jsx(Ge,{}),e.jsx(qe,{})]})]})})}const et=[{label:"Yellow",value:"#FEF08A"},{label:"Green",value:"#BBF7D0"},{label:"Blue",value:"#BFDBFE"},{label:"Pink",value:"#FBCFE8"},{label:"Purple",value:"#E9D5FF"},{label:"Orange",value:"#FED7AA"},{label:"White",value:"#FFFFFF"}],Be={FS:"Finish → Start (FS)",SS:"Start → Start (SS)",FF:"Finish → Finish (FF)",SF:"Start → Finish (SF)"};function tt({isOpen:o,onClose:p,availableMilestones:g=[],initialDate:m,translations:f,onSaveNote:w}){const b=(a,O)=>f?typeof f=="function"?f(a,O):f[a]||O:O,[M,I]=h.useState(""),[y,D]=h.useState(""),[v,$]=h.useState("#FEF08A"),[S,z]=h.useState(""),[n,s]=h.useState(""),[k,c]=h.useState("FS"),[C,u]=h.useState(!1),[T,i]=h.useState([]),[x,N]=h.useState(""),A=h.useRef(null);h.useEffect(()=>{o&&(I(""),D(""),$("#FEF08A"),z(m??new Date().toISOString().split("T")[0]),s(""),c("FS"),i([]),N(""))},[o,m]);const q=[...g.map(a=>({id:a.id,name:a.name,type:"MILESTONE"}))],Y=async()=>{if(!M.trim()&&!y.trim()){N(b("noteModal.errorEmpty","Please provide a title or content for the note."));return}N("");try{u(!0),await w({title:M||b("noteModal.untitled","Untitled"),description:y,color:v,date:S?`${S}T00:00:00`:new Date().toISOString(),predecessorId:n,dependencyType:k,files:T}),p()}catch(a){console.error(a),N(b("noteModal.errorSave","Error creating note."))}finally{u(!1)}};return o?e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.2)",backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},onClick:p,children:e.jsxs("div",{onClick:a=>a.stopPropagation(),style:{width:400,maxHeight:"90vh",background:v||"#FFFACD",borderRadius:4,boxShadow:"4px 6px 20px rgba(0,0,0,0.18), 1px 1px 4px rgba(0,0,0,0.08)",transform:"rotate(-1deg)",position:"relative",display:"flex",flexDirection:"column",fontFamily:"'Inter', sans-serif",overflow:"hidden",transition:"background 0.3s"},children:[e.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:64,height:16,background:"rgba(255,255,255,0.55)",borderRadius:2,boxShadow:"0 1px 3px rgba(0,0,0,0.08)"}}),e.jsx("button",{onClick:p,style:{position:"absolute",top:10,right:10,width:24,height:24,borderRadius:"50%",background:"rgba(0,0,0,0.08)",border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:14,color:"#3a3a3a"},onMouseEnter:a=>a.currentTarget.style.background="rgba(0,0,0,0.15)",onMouseLeave:a=>a.currentTarget.style.background="rgba(0,0,0,0.08)",children:"✕"}),e.jsxs("div",{style:{padding:"28px 24px 20px",flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:[x&&e.jsx("div",{style:{background:"rgba(255,0,0,0.1)",color:"#d32f2f",padding:"8px 12px",borderRadius:6,fontSize:12,marginBottom:12,border:"1px solid rgba(255,0,0,0.2)"},children:x}),e.jsx("input",{type:"text",value:M,onChange:a=>I(a.target.value),placeholder:b("noteModal.titlePlaceholder","Note title..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:20,fontWeight:800,color:"#2a2a2a",lineHeight:"1.3",padding:0,margin:0,marginBottom:14,fontFamily:"inherit"}}),e.jsx("div",{style:{width:"100%",height:1,background:"rgba(0,0,0,0.08)",marginBottom:14}}),e.jsx("textarea",{value:y,onChange:a=>D(a.target.value),rows:6,placeholder:b("noteModal.contentPlaceholder","Write your note here..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:14,color:"#3a3a3a",lineHeight:"1.6",resize:"vertical",padding:0,margin:0,fontFamily:"inherit",flex:1,minHeight:100}}),e.jsxs("div",{style:{marginTop:14,paddingTop:10,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsx("input",{ref:A,type:"file",multiple:!0,onChange:a=>{const O=a.target.files?Array.from(a.target.files):[];O.length>0&&i(G=>[...G,...O]),A.current&&(A.current.value="")},style:{display:"none"}}),e.jsxs("button",{type:"button",onClick:()=>A.current?.click(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:6,background:"rgba(0,0,0,0.05)",border:"1px dashed rgba(0,0,0,0.15)",cursor:"pointer",fontSize:12,color:"#3a3a3a",fontWeight:500,transition:"background 0.15s",width:"100%",justifyContent:"center"},onMouseEnter:a=>a.currentTarget.style.background="rgba(0,0,0,0.08)",onMouseLeave:a=>a.currentTarget.style.background="rgba(0,0,0,0.05)",children:[e.jsx(L.Upload,{size:13}),b("noteModal.attachFiles","Attach files")]}),T.length>0&&e.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:T.map((a,O)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,background:"rgba(255,255,255,0.5)",fontSize:11,color:"#3a3a3a"},children:[e.jsx(L.Paperclip,{size:10,style:{flexShrink:0}}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.name}),e.jsxs("span",{style:{fontSize:9,color:"rgba(58,58,58,0.4)",flexShrink:0},children:[(a.size/1024).toFixed(0),"KB"]}),e.jsx("button",{type:"button",onClick:()=>i(G=>G.filter((K,V)=>V!==O)),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:"#ef4444"},title:b("noteModal.removeFile","Remove"),children:e.jsx(L.X,{size:12})})]},`file-${O}`))})]}),e.jsxs("div",{style:{marginTop:16,paddingTop:12,borderTop:"1px solid rgba(0,0,0,0.08)",display:"flex",alignItems:"center",justifyItems:"flex-start",justifyContent:"space-between",gap:12},children:[e.jsx("input",{type:"date",value:S,onChange:a=>z(a.target.value),style:{background:"transparent",border:"none",outline:"none",fontSize:12,color:"rgba(58,58,58,0.5)",fontWeight:500,fontFamily:"inherit",padding:0,cursor:"pointer",width:"auto"}}),e.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:et.map(a=>e.jsx("button",{type:"button",onClick:()=>$(a.value),style:{width:22,height:22,borderRadius:"50%",border:v===a.value?"2px solid #1A3C30":"1.5px solid rgba(0,0,0,0.12)",backgroundColor:a.value,cursor:"pointer",padding:0,transform:v===a.value?"scale(1.15)":"scale(1)",transition:"all 0.15s",boxShadow:v===a.value?"0 1px 4px rgba(0,0,0,0.15)":"none"},title:a.label},a.value))})]}),q.length>0&&e.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[e.jsx(L.Link2,{size:14,style:{color:"rgba(58,58,58,0.5)"}}),e.jsx("span",{style:{fontSize:11,color:"rgba(58,58,58,0.5)",fontWeight:600},children:b("noteModal.dependency","Dependency")})]}),e.jsxs("select",{value:n,onChange:a=>s(a.target.value),style:{width:"100%",background:"rgba(255,255,255,0.3)",border:"1px solid rgba(0,0,0,0.08)",borderRadius:6,fontSize:12,color:"#3a3a3a",padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer"},children:[e.jsx("option",{value:"",children:b("noteModal.none","None")}),g.length>0&&e.jsx("optgroup",{label:b("noteModal.milestones","Milestones"),children:g.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),n&&e.jsx("select",{value:k,onChange:a=>c(a.target.value),style:{width:"100%",background:"rgba(255,255,255,0.3)",border:"1px solid rgba(0,0,0,0.08)",borderRadius:6,fontSize:12,color:"#3a3a3a",padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer",marginTop:6},children:Object.keys(Be).map(a=>e.jsx("option",{value:a,children:Be[a]},a))})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10,paddingTop:16,marginTop:12,borderTop:"1px solid rgba(0,0,0,0.08)"},children:[e.jsx("button",{onClick:p,style:{padding:"8px 16px",fontSize:13,color:"#3a3a3a",background:"rgba(255,255,255,0.5)",border:"1px solid rgba(0,0,0,0.1)",borderRadius:8,cursor:"pointer"},children:b("noteModal.cancel","Cancel")}),e.jsxs("button",{onClick:Y,disabled:C,style:{padding:"8px 20px",fontSize:13,color:"#fff",background:"#1A3C30",border:"none",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,opacity:C?.5:1},children:[C&&e.jsx(L.Loader2,{size:16,style:{animation:"zg-spin 1s linear infinite"}}),b("noteModal.create","Create Note")]})]})]})]})}):null}const ot={"planning.gantt":"PLANEJAMENTO DA OBRA","charts.gantt.month":"Mês","charts.gantt.year":"Ano","charts.gantt.stepName":"NOME DA ETAPA","charts.gantt.start":"INÍCIO","charts.gantt.end":"FIM","charts.gantt.newAction":"Nova Ação","charts.gantt.progress":"Progresso","gantt.filter.steps":"Etapas","gantt.filter.milestones":"Marcos","gantt.filter.events":"Eventos","gantt.filter.notes":"Notas","gantt.newAction.step":"Etapa","gantt.newAction.milestone":"Marco","gantt.newAction.event":"Evento","gantt.newAction.note":"Nota","gantt.group.step":"Etapas","gantt.group.milestone":"Marcos","gantt.group.event":"Eventos","gantt.group.note":"Notas","gantt.tooltip.planned":"Previsto","gantt.tooltip.actual":"Real","gantt.tooltip.plannedInUse":"Previsto (em uso)","gantt.tooltip.start":"Início","gantt.tooltip.end":"Fim","gantt.tooltip.duration":"Duração","gantt.tooltip.progress":"Progresso","gantt.tooltip.date":"Data","gantt.tooltip.attachments":"Anexos","gantt.popup.viewDetails":"Ver detalhes","gantt.popup.edit":"Editar","gantt.popup.delete":"Excluir","gantt.popup.relations":"Relações","gantt.chart.addOn":"Adicionar em","gantt.depType.fs":"Início após Fim","gantt.depType.ss":"Inícios simultâneos","gantt.depType.ff":"Fins simultâneos","gantt.depType.sf":"Fim após Início","gantt.depModal.title":"Tipo de Relação","gantt.depModal.subtitle":"Escolha como as duas tarefas se relacionam","gantt.depModal.fs":"Início após Fim","gantt.depModal.fsDesc":"B começa quando A termina","gantt.depModal.ss":"Inícios simultâneos","gantt.depModal.ssDesc":"A e B começam juntos","gantt.depModal.ff":"Fins simultâneos","gantt.depModal.ffDesc":"A e B terminam juntos","gantt.depModal.sf":"Fim após Início","gantt.depModal.sfDesc":"B termina quando A começa","gantt.depModal.lagLabel":"Atraso (Lag) em dias","gantt.depModal.cancel":"Cancelar","gantt.depModal.create":"Criar Dependência","gantt.depModal.saving":"Salvando...","noteModal.titlePlaceholder":"Título da nota...","noteModal.contentPlaceholder":"Escreva sua nota aqui...","noteModal.attachFiles":"Anexar arquivos","noteModal.removeFile":"Remover","noteModal.dependency":"Dependência","noteModal.none":"Nenhuma","noteModal.milestones":"Marcos","noteModal.cancel":"Cancelar","noteModal.create":"Criar Nota","noteModal.errorEmpty":"Informe o título ou conteúdo da nota.","noteModal.errorSave":"Erro ao criar nota.","noteModal.untitled":"Sem título"};R.NoteModal=tt,R.ProjectGantt=Re,R.ptBR=ot,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|