zegantt 1.1.2 → 1.1.4
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.cjs +2 -5
- package/dist/zegantt.css +1 -1
- package/dist/zegantt.js +385 -394
- package/package.json +1 -1
package/dist/zegantt.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),H=require("lucide-react"),Dt=require("react-dom");function Ct(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:()=>n[r]})}}return s.default=n,Object.freeze(s)}const nt=Ct(g),kt=g.createContext(void 0);function Rt({children:n,value:s}){return t.jsx(kt.Provider,{value:s,children:n})}function Ae(){const n=g.useContext(kt);if(!n)throw new Error("useGanttContext must be used within a GanttProvider");return n}const e={pageBg:"var(--zg-page-bg, #F8FAFB)",surface:"var(--zg-surface, #FFFFFF)",surfaceAlt:"var(--zg-surface-alt, #F7FAF8)",surfaceFrost:"var(--zg-surface-frost, rgba(255,255,255,0.96))",headerBg:"var(--zg-header-bg, #F2F5F3)",textTitle:"var(--zg-primary-color, #1A3C30)",textPrimary:"var(--zg-text-primary, #4F4F4F)",textSecondary:"var(--zg-text-secondary, #7B7B7B)",textSecondarySoft:"var(--zg-text-secondary-soft, rgba(123,123,123,0.27))",textSecondaryMid:"var(--zg-text-secondary-mid, rgba(123,123,123,0.4))",textMuted:"var(--zg-text-muted, #D9D9D9)",group:"var(--zg-group, #1A3C30)",groupSoft:"var(--zg-group-soft, rgba(26,60,48,0.05))",groupSoftStrong:"var(--zg-group-soft-strong, rgba(26,60,48,0.12))",groupBorderWeak:"var(--zg-group-border-weak, rgba(26,60,48,0.27))",groupGlowSoft:"var(--zg-group-glow-soft, rgba(26,60,48,0.2))",groupGlow:"var(--zg-group-glow, rgba(26,60,48,0.4))",groupGlowStrong:"var(--zg-group-glow-strong, rgba(26,60,48,0.6))",groupLight:"var(--zg-group-light, #7AB7A3)",groupLightSoft:"var(--zg-group-light-soft, rgba(122,183,163,0.13))",groupLightStrong:"var(--zg-group-light-strong, rgba(122,183,163,0.6))",milestone:"var(--zg-milestone, #1A3C30)",milestoneRing:"var(--zg-milestone-ring, #A0D8A8)",milestoneRingSoft:"var(--zg-milestone-ring-soft, rgba(160,216,168,0.19))",milestonePillBg:"var(--zg-milestone-pill-bg, linear-gradient(135deg, #e8f5ee, #f0f8f4))",criticalPillBg:"var(--zg-critical-pill-bg, linear-gradient(135deg, #fee, #fff5f5))",event:"var(--zg-event, #CD6200)",eventSoft:"var(--zg-event-soft, rgba(205,98,0,0.09))",eventBorderSoft:"var(--zg-event-border-soft, rgba(205,98,0,0.33))",eventPillBg:"var(--zg-event-pill-bg, linear-gradient(135deg, #fff7ed, #ffedd5))",note:"var(--zg-note-color, #FFBB1C)",noteDefaultBg:"var(--zg-note-default-bg, #FEF08A)",noteBadgeBg:"var(--zg-note-badge-bg, #FACC15)",noteBadgeText:"var(--zg-note-badge-text, #1A3C30)",delayedTaskBg:"var(--zg-delayed-task-bg, linear-gradient(135deg, #fdd, #fee))",border:"var(--zg-border, #D9D9D9)",borderLight:"var(--zg-border-light, #ECECEC)",weekendBg:"var(--zg-weekend-bg, #F4F6F5)",today:"var(--zg-danger-color, #FF0000)",todaySoft:"var(--zg-danger-soft, rgba(255,0,0,0.13))",todayMid:"var(--zg-danger-mid, rgba(255,0,0,0.27))",todayStrong:"var(--zg-danger-strong, rgba(255,0,0,0.53))",todayBg:"var(--zg-today-bg, #FF000008)",arrow:"var(--zg-arrow, #7B7B7B)",arrowHover:"var(--zg-arrow-hover, #1A3C30)",overlaySoft:"var(--zg-overlay-soft, rgba(0,0,0,0.2))",overlayMedium:"var(--zg-overlay-medium, rgba(0,0,0,0.35))",white:"var(--zg-contrast-high, #FFFFFF)",inkStrong:"var(--zg-ink-strong, #1A1A1A)",inkMedium:"var(--zg-ink-medium, #3A3A3A)",inkSoft:"var(--zg-ink-soft, rgba(0,0,0,0.7))",inkSoft2:"var(--zg-ink-soft-2, rgba(0,0,0,0.6))",inkSoft3:"var(--zg-ink-soft-3, rgba(0,0,0,0.55))",inkSoft4:"var(--zg-ink-soft-4, rgba(0,0,0,0.45))",dangerText:"var(--zg-danger-text, #EF4444)",dangerBgSoft:"var(--zg-danger-bg-soft, #FEE2E2)",shadowTiny:"var(--zg-shadow-tiny, 0 1px 3px rgba(0,0,0,0.08))",shadowSmall:"var(--zg-shadow-small, 0 1px 3px rgba(0,0,0,0.1))",shadowSoft:"var(--zg-shadow-soft, 0 1px 3px rgba(0,0,0,0.06))",shadowLarge:"var(--zg-shadow-large, 0 4px 12px rgba(0,0,0,0.08))",shadowSticky:"var(--zg-shadow-sticky, 2px 3px 8px rgba(0,0,0,0.13))",shadowStickyHover:"var(--zg-shadow-sticky-hover, 4px 6px 18px rgba(0,0,0,0.22))",shadowStickyStrong:"var(--zg-shadow-sticky-strong, 4px 6px 16px rgba(0,0,0,0.22))",stickyTape:"var(--zg-sticky-tape, rgba(255,255,255,0.55))",connectorDotBorder:"var(--zg-connector-dot-border, #FFFFFF)"},oe=50,Ye=32,Ft=Ye*2,At=460,ae=26,Re=28,dt=120,Xe=40,jt=3.5,le=[{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"}],ut={step:"Steps",milestone:"Milestones",event:"Events",note:"Notes"};function Bt(){const{props:n,t:s,viewMode:r,setViewMode:i,isInfiniteCanvas:o,zoomPercent:l,zoomIn:a,zoomOut:d,fitToScreen:x,visibleTypes:v,setVisibleTypes:S,newActionOpen:T,setNewActionOpen:k,newActionRef:C}=Ae(),{projectName:O,onAddNewStage:A,onAddMilestone:R,onAddEvent:I,onAddNote:u}=n,z=f=>{S(b=>{const h=new Set(b);return h.has(f)?h.delete(f):h.add(f),h})};return t.jsxs("div",{className:"zg-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:14,flexWrap:"wrap",padding:"14px 18px",borderBottom:`1px solid ${e.border}`,background:`linear-gradient(180deg, ${e.headerBg} 0%, ${e.surface} 100%)`},children:[t.jsxs("div",{className:"zg-header-brand",style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[t.jsxs("div",{children:[t.jsx("h3",{style:{margin:0,fontSize:13,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.12em",color:e.textTitle,fontFamily:"var(--zg-font-accent)"},children:s("planning.gantt","Project Planning")}),t.jsx("div",{style:{height:2.5,width:64,marginTop:6,borderRadius:9999,background:`linear-gradient(90deg, ${e.group}, ${e.milestoneRing})`}})]}),O&&t.jsx("span",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",padding:"6px 12px",borderRadius:9999,color:e.textSecondary,background:e.surface,border:`1px solid ${e.border}`,boxShadow:e.shadowTiny},children:O})]}),t.jsxs("div",{className:"zg-header-controls",style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",justifyContent:"flex-end",flex:"1 1 560px"},children:[o?t.jsxs("div",{className:"zg-control-group",style:{display:"flex",alignItems:"center",gap:6,padding:4,borderRadius:10,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:[t.jsx("button",{className:"zg-control-btn zg-control-btn--icon",onClick:d,style:{width:30,height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:16,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny},"aria-label":s("gantt.viewport.zoomOut","Zoom out"),title:s("gantt.viewport.zoomOut","Zoom out"),children:"-"}),t.jsxs("span",{style:{minWidth:58,textAlign:"center",fontSize:11,fontWeight:700,color:e.textSecondary},children:[l,"%"]}),t.jsx("button",{className:"zg-control-btn zg-control-btn--icon",onClick:a,style:{width:30,height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:16,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny},"aria-label":s("gantt.viewport.zoomIn","Zoom in"),title:s("gantt.viewport.zoomIn","Zoom in"),children:"+"}),t.jsx("button",{className:"zg-control-btn zg-control-btn--fit",onClick:x,style:{padding:"0 12px",height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:11,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny,textTransform:"uppercase",letterSpacing:"0.04em"},title:s("gantt.viewport.fit","Fit to screen"),children:s("gantt.viewport.fit","Fit")})]}):t.jsx("div",{className:"zg-control-group",style:{display:"flex",padding:4,borderRadius:10,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:["day","month"].map(f=>t.jsx("button",{className:`zg-segment-btn ${r===f?"is-active":"is-inactive"}`,onClick:()=>i(f),style:{padding:"6px 20px",fontSize:12,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...r===f?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textSecondary}},children:f==="day"?s("charts.gantt.month","Month"):s("charts.gantt.year","Year")},f))}),t.jsx("div",{className:"zg-control-group zg-control-group--filters",style:{display:"flex",padding:4,borderRadius:10,gap:2,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`,flexWrap:"wrap"},children:[{type:"step",label:s("gantt.filter.steps","Steps"),icon:t.jsx("div",{style:{width:10,height:10,borderRadius:2,background:le[0].bar,border:`1px solid ${le[0].barBorder}`}})},{type:"milestone",label:s("gantt.filter.milestones","Milestones"),icon:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})},{type:"event",label:s("gantt.filter.events","Events"),icon:t.jsx(H.Clock,{size:11,style:{color:e.event}})},{type:"note",label:s("gantt.filter.notes","Notes"),icon:t.jsx(H.MessageCircle,{size:11,style:{color:e.note}})}].map(f=>{const b=v.has(f.type);return t.jsxs("button",{className:`zg-segment-btn ${b?"is-active":"is-inactive"}`,onClick:()=>z(f.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",...b?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textSecondary,opacity:.58}},children:[f.icon,t.jsx("span",{children:f.label})]},f.type)})}),A&&t.jsxs("div",{ref:C,style:{position:"relative"},children:[t.jsxs("button",{className:"zg-new-action-btn",onClick:()=>k(f=>!f),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:600,color:e.white,border:"none",cursor:"pointer",background:`linear-gradient(135deg, ${e.group}, ${e.groupGlowStrong})`,transition:"all 0.2s"},children:[t.jsx(H.Plus,{size:16}),t.jsx("span",{children:s("charts.gantt.newAction","New Action")}),t.jsx(H.ChevronDown,{size:14,style:{opacity:.7,transform:T?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),T&&t.jsx("div",{className:"zg-new-action-menu",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:e.surface,borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:f=>f.stopPropagation(),children:[{label:s("gantt.newAction.step","Step"),icon:t.jsx("div",{style:{width:14,height:14,borderRadius:3,background:le[0].bar,border:`1.5px solid ${le[0].barBorder}`,flexShrink:0}}),action:()=>{A(),k(!1)}},{label:s("gantt.newAction.milestone","Milestone"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})}),action:()=>{R?.(),k(!1)}},{label:s("gantt.newAction.event","Event"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:11,style:{color:e.event}})}),action:()=>{I?.(),k(!1)}},{label:s("gantt.newAction.note","Note"),icon:t.jsx("div",{style:{width:16,height:20,background:e.note,borderRadius:2,boxShadow:e.shadowTiny,position:"relative",overflow:"visible",flexShrink:0},children:t.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:e.stickyTape,borderRadius:1}})}),action:()=>{u?.(),k(!1)}}].map(f=>t.jsxs("button",{onClick:f.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:e.textPrimary,textAlign:"left"},children:[f.icon,f.label]},f.label))})]})]})]})}function Fe(n,s,r){let i=r.initialDeps??[],o,l=!0;function a(){var d,x,v;let S;r.key&&((d=r.debug)!=null&&d.call(r))&&(S=Date.now());const T=n();if(!(T.length!==i.length||T.some((O,A)=>i[A]!==O)))return o;i=T;let C;if(r.key&&((x=r.debug)!=null&&x.call(r))&&(C=Date.now()),o=s(...T),r.key&&((v=r.debug)!=null&&v.call(r))){const O=Math.round((Date.now()-S)*100)/100,A=Math.round((Date.now()-C)*100)/100,R=A/16,I=(u,z)=>{for(u=String(u);u.length<z;)u=" "+u;return u};console.info(`%c⏱ ${I(A,5)} /${I(O,5)} ms`,`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("react"),H=require("lucide-react"),Dt=require("react-dom");function Ct(n){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:()=>n[r]})}}return s.default=n,Object.freeze(s)}const nt=Ct(g),kt=g.createContext(void 0);function Rt({children:n,value:s}){return t.jsx(kt.Provider,{value:s,children:n})}function Fe(){const n=g.useContext(kt);if(!n)throw new Error("useGanttContext must be used within a GanttProvider");return n}const e={pageBg:"var(--zg-page-bg, #F8FAFB)",surface:"var(--zg-surface, #FFFFFF)",surfaceAlt:"var(--zg-surface-alt, #F7FAF8)",surfaceFrost:"var(--zg-surface-frost, rgba(255,255,255,0.96))",headerBg:"var(--zg-header-bg, #F2F5F3)",textTitle:"var(--zg-primary-color, #1A3C30)",textPrimary:"var(--zg-text-primary, #4F4F4F)",textSecondary:"var(--zg-text-secondary, #7B7B7B)",textSecondarySoft:"var(--zg-text-secondary-soft, rgba(123,123,123,0.27))",textSecondaryMid:"var(--zg-text-secondary-mid, rgba(123,123,123,0.4))",textMuted:"var(--zg-text-muted, #D9D9D9)",group:"var(--zg-group, #1A3C30)",groupSoft:"var(--zg-group-soft, rgba(26,60,48,0.05))",groupSoftStrong:"var(--zg-group-soft-strong, rgba(26,60,48,0.12))",groupBorderWeak:"var(--zg-group-border-weak, rgba(26,60,48,0.27))",groupGlowSoft:"var(--zg-group-glow-soft, rgba(26,60,48,0.2))",groupGlow:"var(--zg-group-glow, rgba(26,60,48,0.4))",groupGlowStrong:"var(--zg-group-glow-strong, rgba(26,60,48,0.6))",groupLight:"var(--zg-group-light, #7AB7A3)",groupLightSoft:"var(--zg-group-light-soft, rgba(122,183,163,0.13))",groupLightStrong:"var(--zg-group-light-strong, rgba(122,183,163,0.6))",milestone:"var(--zg-milestone, #1A3C30)",milestoneRing:"var(--zg-milestone-ring, #A0D8A8)",milestoneRingSoft:"var(--zg-milestone-ring-soft, rgba(160,216,168,0.19))",milestonePillBg:"var(--zg-milestone-pill-bg, #edf8f2)",criticalPillBg:"var(--zg-critical-pill-bg, #ffeaed)",event:"var(--zg-event, #CD6200)",eventSoft:"var(--zg-event-soft, rgba(205,98,0,0.09))",eventBorderSoft:"var(--zg-event-border-soft, rgba(205,98,0,0.33))",eventPillBg:"var(--zg-event-pill-bg, #fff4e6)",note:"var(--zg-note-color, #FFBB1C)",noteDefaultBg:"var(--zg-note-default-bg, #FEF08A)",noteBadgeBg:"var(--zg-note-badge-bg, #FACC15)",noteBadgeText:"var(--zg-note-badge-text, #1A3C30)",delayedTaskBg:"var(--zg-delayed-task-bg, #ffe8ee)",border:"var(--zg-border, #D9D9D9)",borderLight:"var(--zg-border-light, #ECECEC)",weekendBg:"var(--zg-weekend-bg, #F4F6F5)",today:"var(--zg-danger-color, #FF0000)",todaySoft:"var(--zg-danger-soft, rgba(255,0,0,0.13))",todayMid:"var(--zg-danger-mid, rgba(255,0,0,0.27))",todayStrong:"var(--zg-danger-strong, rgba(255,0,0,0.53))",todayBg:"var(--zg-today-bg, #FF000008)",arrow:"var(--zg-arrow, #7B7B7B)",arrowHover:"var(--zg-arrow-hover, #1A3C30)",overlaySoft:"var(--zg-overlay-soft, rgba(0,0,0,0.2))",overlayMedium:"var(--zg-overlay-medium, rgba(0,0,0,0.35))",white:"var(--zg-contrast-high, #FFFFFF)",inkStrong:"var(--zg-ink-strong, #1A1A1A)",inkMedium:"var(--zg-ink-medium, #3A3A3A)",inkSoft:"var(--zg-ink-soft, rgba(0,0,0,0.7))",inkSoft2:"var(--zg-ink-soft-2, rgba(0,0,0,0.6))",inkSoft3:"var(--zg-ink-soft-3, rgba(0,0,0,0.55))",inkSoft4:"var(--zg-ink-soft-4, rgba(0,0,0,0.45))",dangerText:"var(--zg-danger-text, #EF4444)",dangerBgSoft:"var(--zg-danger-bg-soft, #FEE2E2)",shadowTiny:"var(--zg-shadow-tiny, 0 1px 3px rgba(0,0,0,0.08))",shadowSmall:"var(--zg-shadow-small, 0 1px 3px rgba(0,0,0,0.1))",shadowSoft:"var(--zg-shadow-soft, 0 1px 3px rgba(0,0,0,0.06))",shadowLarge:"var(--zg-shadow-large, 0 4px 12px rgba(0,0,0,0.08))",shadowSticky:"var(--zg-shadow-sticky, 2px 3px 8px rgba(0,0,0,0.13))",shadowStickyHover:"var(--zg-shadow-sticky-hover, 4px 6px 18px rgba(0,0,0,0.22))",shadowStickyStrong:"var(--zg-shadow-sticky-strong, 4px 6px 16px rgba(0,0,0,0.22))",stickyTape:"var(--zg-sticky-tape, rgba(255,255,255,0.55))",connectorDotBorder:"var(--zg-connector-dot-border, #FFFFFF)"},oe=50,Ye=32,At=Ye*2,Ft=460,ae=26,Re=28,dt=120,Xe=40,jt=3.5,le=[{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"}],ut={step:"Steps",milestone:"Milestones",event:"Events",note:"Notes"};function Bt(){const{props:n,t:s,viewMode:r,setViewMode:i,isInfiniteCanvas:o,zoomPercent:l,zoomIn:a,zoomOut:d,fitToScreen:x,visibleTypes:v,setVisibleTypes:S,newActionOpen:T,setNewActionOpen:k,newActionRef:C}=Fe(),{projectName:O,onAddNewStage:F,onAddMilestone:R,onAddEvent:I,onAddNote:u}=n,z=f=>{S(b=>{const h=new Set(b);return h.has(f)?h.delete(f):h.add(f),h})};return t.jsxs("div",{className:"zg-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:14,flexWrap:"wrap",padding:"14px 18px",borderBottom:`1px solid ${e.border}`,background:e.headerBg},children:[t.jsxs("div",{className:"zg-header-brand",style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[t.jsxs("div",{children:[t.jsx("h3",{style:{margin:0,fontSize:13,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.12em",color:e.textTitle,fontFamily:"var(--zg-font-accent)"},children:s("planning.gantt","Project Planning")}),t.jsx("div",{style:{height:2.5,width:64,marginTop:6,borderRadius:9999,background:e.group}})]}),O&&t.jsx("span",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",padding:"6px 12px",borderRadius:9999,color:e.textSecondary,background:e.surface,border:`1px solid ${e.border}`,boxShadow:e.shadowTiny},children:O})]}),t.jsxs("div",{className:"zg-header-controls",style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",justifyContent:"flex-end",flex:"1 1 560px"},children:[o?t.jsxs("div",{className:"zg-control-group",style:{display:"flex",alignItems:"center",gap:6,padding:4,borderRadius:10,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:[t.jsx("button",{className:"zg-control-btn zg-control-btn--icon",onClick:d,style:{width:30,height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:16,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny},"aria-label":s("gantt.viewport.zoomOut","Zoom out"),title:s("gantt.viewport.zoomOut","Zoom out"),children:"-"}),t.jsxs("span",{style:{minWidth:58,textAlign:"center",fontSize:11,fontWeight:700,color:e.textSecondary},children:[l,"%"]}),t.jsx("button",{className:"zg-control-btn zg-control-btn--icon",onClick:a,style:{width:30,height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:16,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny},"aria-label":s("gantt.viewport.zoomIn","Zoom in"),title:s("gantt.viewport.zoomIn","Zoom in"),children:"+"}),t.jsx("button",{className:"zg-control-btn zg-control-btn--fit",onClick:x,style:{padding:"0 12px",height:30,borderRadius:6,border:"none",cursor:"pointer",fontSize:11,fontWeight:700,color:e.group,background:e.surface,boxShadow:e.shadowTiny,textTransform:"uppercase",letterSpacing:"0.04em"},title:s("gantt.viewport.fit","Fit to screen"),children:s("gantt.viewport.fit","Fit")})]}):t.jsx("div",{className:"zg-control-group",style:{display:"flex",padding:4,borderRadius:10,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`},children:["day","month"].map(f=>t.jsx("button",{className:`zg-segment-btn ${r===f?"is-active":"is-inactive"}`,onClick:()=>i(f),style:{padding:"6px 20px",fontSize:12,fontWeight:600,borderRadius:6,transition:"all 0.2s",border:"none",cursor:"pointer",...r===f?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textSecondary}},children:f==="day"?s("charts.gantt.month","Month"):s("charts.gantt.year","Year")},f))}),t.jsx("div",{className:"zg-control-group zg-control-group--filters",style:{display:"flex",padding:4,borderRadius:10,gap:2,background:e.groupSoftStrong,border:`1px solid ${e.borderLight}`,flexWrap:"wrap"},children:[{type:"step",label:s("gantt.filter.steps","Steps"),icon:t.jsx("div",{style:{width:10,height:10,borderRadius:2,background:le[0].bar,border:`1px solid ${le[0].barBorder}`}})},{type:"milestone",label:s("gantt.filter.milestones","Milestones"),icon:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})},{type:"event",label:s("gantt.filter.events","Events"),icon:t.jsx(H.Clock,{size:11,style:{color:e.event}})},{type:"note",label:s("gantt.filter.notes","Notes"),icon:t.jsx(H.MessageCircle,{size:11,style:{color:e.note}})}].map(f=>{const b=v.has(f.type);return t.jsxs("button",{className:`zg-segment-btn ${b?"is-active":"is-inactive"}`,onClick:()=>z(f.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",...b?{background:e.surface,color:e.group,boxShadow:e.shadowTiny}:{background:"transparent",color:e.textSecondary,opacity:.58}},children:[f.icon,t.jsx("span",{children:f.label})]},f.type)})}),F&&t.jsxs("div",{ref:C,style:{position:"relative"},children:[t.jsxs("button",{className:"zg-new-action-btn",onClick:()=>k(f=>!f),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:600,color:e.white,border:"none",cursor:"pointer",background:e.group,transition:"all 0.2s"},children:[t.jsx(H.Plus,{size:16}),t.jsx("span",{children:s("charts.gantt.newAction","New Action")}),t.jsx(H.ChevronDown,{size:14,style:{opacity:.7,transform:T?"rotate(180deg)":"none",transition:"transform 0.18s"}})]}),T&&t.jsx("div",{className:"zg-new-action-menu",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:99999,background:e.surface,borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden",padding:"5px 5px"},onClick:f=>f.stopPropagation(),children:[{label:s("gantt.newAction.step","Step"),icon:t.jsx("div",{style:{width:14,height:14,borderRadius:3,background:le[0].bar,border:`1.5px solid ${le[0].barBorder}`,flexShrink:0}}),action:()=>{F(),k(!1)}},{label:s("gantt.newAction.milestone","Milestone"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})}),action:()=>{R?.(),k(!1)}},{label:s("gantt.newAction.event","Event"),icon:t.jsx("div",{style:{width:22,height:22,borderRadius:"50%",background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:11,style:{color:e.event}})}),action:()=>{I?.(),k(!1)}},{label:s("gantt.newAction.note","Note"),icon:t.jsx("div",{style:{width:16,height:20,background:e.note,borderRadius:2,boxShadow:e.shadowTiny,position:"relative",overflow:"visible",flexShrink:0},children:t.jsx("div",{style:{position:"absolute",top:-2,left:"50%",transform:"translateX(-50%)",width:10,height:4,background:e.stickyTape,borderRadius:1}})}),action:()=>{u?.(),k(!1)}}].map(f=>t.jsxs("button",{onClick:f.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:e.textPrimary,textAlign:"left"},children:[f.icon,f.label]},f.label))})]})]})]})}function Ae(n,s,r){let i=r.initialDeps??[],o,l=!0;function a(){var d,x,v;let S;r.key&&((d=r.debug)!=null&&d.call(r))&&(S=Date.now());const T=n();if(!(T.length!==i.length||T.some((O,F)=>i[F]!==O)))return o;i=T;let C;if(r.key&&((x=r.debug)!=null&&x.call(r))&&(C=Date.now()),o=s(...T),r.key&&((v=r.debug)!=null&&v.call(r))){const O=Math.round((Date.now()-S)*100)/100,F=Math.round((Date.now()-C)*100)/100,R=F/16,I=(u,z)=>{for(u=String(u);u.length<z;)u=" "+u;return u};console.info(`%c⏱ ${I(F,5)} /${I(O,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
|
-
color: hsl(${Math.max(0,Math.min(120-120*R,120))}deg 100% 31%);`,r?.key)}return r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(o),l=!1,o}return a.updateDeps=d=>{i=d},a}function ht(n,s){if(n===void 0)throw new Error("Unexpected undefined");return n}const Lt=(n,s)=>Math.abs(n-s)<1.01,Wt=(n,s,r)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>s.apply(this,o),r)}},pt=n=>{const{offsetWidth:s,offsetHeight:r}=n;return{width:s,height:r}},$t=n=>n,Pt=n=>{const s=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=s;o<=r;o++)i.push(o);return i},Ot=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;const o=a=>{const{width:d,height:x}=a;s({width:Math.round(d),height:Math.round(x)})};if(o(pt(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(a=>{const d=()=>{const x=a[0];if(x?.borderBoxSize){const v=x.borderBoxSize[0];if(v){o({width:v.inlineSize,height:v.blockSize});return}}o(pt(r))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},gt={passive:!0},ft=typeof window>"u"?!0:"onscrollend"in window,Nt=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;let o=0;const l=n.options.useScrollendEvent&&ft?()=>{}:Wt(i,()=>{s(o,!1)},n.options.isScrollingResetDelay),a=S=>()=>{const{horizontal:T,isRtl:k}=n.options;o=T?r.scrollLeft*(k&&-1||1):r.scrollTop,l(),s(o,S)},d=a(!0),x=a(!1);r.addEventListener("scroll",d,gt);const v=n.options.useScrollendEvent&&ft;return v&&r.addEventListener("scrollend",x,gt),()=>{r.removeEventListener("scroll",d),v&&r.removeEventListener("scrollend",x)}},Yt=(n,s,r)=>{if(s?.borderBoxSize){const i=s.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}return n[r.options.horizontal?"offsetWidth":"offsetHeight"]},Xt=(n,{adjustments:s=0,behavior:r},i)=>{var o,l;const a=n+s;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:a,behavior:r})};class _t{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const a=()=>{const d=l.target,x=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);return}this.shouldMeasureDuringScroll(x)&&this.resizeItem(x,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([i,o])=>{typeof o>"u"&&delete r[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$t,rangeExtractor:Pt,onChange:()=>{},measureElement:Yt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Fe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,l=new Map;for(let a=i-1;a>=0;a--){const d=r[a];if(o.has(d.lane))continue;const x=l.get(d.lane);if(x==null||d.end>x.end?l.set(d.lane,d):d.end<x.end&&o.set(d.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((a,d)=>a.end===d.end?a.index-d.index:a.end-d.end)[0]:void 0},this.getMeasurementOptions=Fe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(r,i,o,l,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:d}),{key:!1}),this.getMeasurements=Fe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:d},x)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const k of this.laneAssignments.keys())k>=r&&this.laneAssignments.delete(k);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(k=>{this.itemSizeCache.set(k.key,k.size)}));const v=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const S=this.measurementsCache.slice(0,v),T=new Array(d).fill(void 0);for(let k=0;k<v;k++){const C=S[k];C&&(T[C.lane]=k)}for(let k=v;k<r;k++){const C=l(k),O=this.laneAssignments.get(k);let A,R;if(O!==void 0&&this.options.lanes>1){A=O;const f=T[A],b=f!==void 0?S[f]:void 0;R=b?b.end+this.options.gap:i+o}else{const f=this.options.lanes===1?S[k-1]:this.getFurthestMeasurement(S,k);R=f?f.end+this.options.gap:i+o,A=f?f.lane:k%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(k,A)}const I=x.get(C),u=typeof I=="number"?I:this.options.estimateSize(k),z=R+u;S[k]={index:k,start:R,size:u,end:z,key:C,lane:A},T[A]=k}return this.measurementsCache=S,S},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Fe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,l)=>this.range=r.length>0&&i>0?Ht({measurements:r,outerSize:i,scrollOffset:o,lanes:l}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Fe(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,l,a)=>l===null||a===null?[]:r({startIndex:l,endIndex:a,overscan:i,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-l),d=Math.min(this.options.count-1,o+l);return r>=a&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((a,d)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o;const l=this.measurementsCache[r];if(!l)return;const a=this.itemSizeCache.get(l.key)??l.size,d=i-a;d!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,d,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",d),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=Fe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let l=0,a=r.length;l<a;l++){const d=r[l],x=i[d];o.push(x)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length!==0)return ht(i[It(0,i.length-1,o=>ht(i[o]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),a=this.getScrollOffset();i==="auto"&&(i=r>=a+l?"end":"start"),i==="center"?r+=(o-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),a=this.measurementsCache[r];if(!a)return;if(i==="auto")if(a.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(a.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,a.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),a=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[a,d]=l,x=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:x,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((r=i[i.length-1])==null?void 0:r.end)??0;else{const l=Array(this.options.lanes).fill(null);let a=i.length-1;for(;a>=0&&l.some(d=>d===null);){const d=i[a];l[d.lane]===null&&(l[d.lane]=d.end),a--}o=Math.max(...l.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Lt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const It=(n,s,r,i)=>{for(;n<=s;){const o=(n+s)/2|0,l=r(o);if(l<i)n=o+1;else if(l>i)s=o-1;else return o}return n>0?n-1:0};function Ht({measurements:n,outerSize:s,scrollOffset:r,lanes:i}){const o=n.length-1,l=x=>n[x].start;if(n.length<=i)return{startIndex:0,endIndex:o};let a=It(0,o,l,r),d=a;if(i===1)for(;d<o&&n[d].end<r+s;)d++;else if(i>1){const x=Array(i).fill(0);for(;d<o&&x.some(S=>S<r+s);){const S=n[d];x[S.lane]=S.end,d++}const v=Array(i).fill(r+s);for(;a>=0&&v.some(S=>S>=r);){const S=n[a];v[S.lane]=S.start,a--}a=Math.max(0,a-a%i),d=Math.min(o,d+(i-1-d%i))}return{startIndex:a,endIndex:d}}const xt=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function Vt({useFlushSync:n=!0,...s}){const r=nt.useReducer(()=>({}),{})[1],i={...s,onChange:(l,a)=>{var d;n&&a?Dt.flushSync(r):r(),(d=s.onChange)==null||d.call(s,l,a)}},[o]=nt.useState(()=>new _t(i));return o.setOptions(i),xt(()=>o._didMount(),[]),xt(()=>o._willUpdate()),o}function ct(n){return Vt({observeElementRect:Ot,observeElementOffset:Nt,scrollToFn:Xt,...n})}const Mt=864e5,se=(n,s)=>new Date(n.getTime()+s*Mt),we=(n,s)=>Math.round((s.getTime()-n.getTime())/Mt),mt=n=>new Date(n.getFullYear(),n.getMonth(),1),lt=n=>new Date(n.getFullYear(),n.getMonth()+1,0),zt=n=>{if(!n)return"en-US";try{return new Intl.DateTimeFormat(n).resolvedOptions().locale}catch{return"en-US"}},re=(n,s="en-US")=>new Intl.DateTimeFormat(zt(s),{day:"2-digit",month:"2-digit",year:"numeric"}).format(n),yt=(n,s="en")=>new Intl.DateTimeFormat(zt(s),{month:"long"}).format(n).toUpperCase();function Gt(){const{props:n,t:s,displayRows:r,leftBodyRef:i,handleLeftScroll:o,toggleProject:l,toggleGroup:a,hoveredTaskId:d,setHoveredTaskId:x,selectedTaskId:v,setSelectedTaskId:S,delayedIds:T,criticalIds:k,relatedIds:C,setActivePinboardTask:O}=Ae(),A=b=>({id:b.id,name:b.name,start:b.start,end:b.end,type:b.originalType==="step"?"task":"milestone",progress:b.progress}),R=ct({count:r.length,getScrollElement:()=>i.current,estimateSize:()=>oe,overscan:12}),I=R.getVirtualItems(),u=Math.max(R.getTotalSize(),400)+80,z=g.useMemo(()=>r.filter(b=>b.kind==="task").map(b=>b.task.id),[r]),f=g.useCallback((b,h)=>{const w=z.indexOf(b);if(w<0)return;const c=Math.min(Math.max(0,w+h),z.length-1),D=z[c];D&&S(D)},[z,S]);return t.jsxs("div",{style:{width:At,flexShrink:0,borderRight:`1px solid ${e.border}`,display:"flex",flexDirection:"column",height:"100%"},children:[t.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",height:Ft,background:e.headerBg,borderBottom:`1px solid ${e.border}`},children:[t.jsx("div",{style:{flex:1,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textSecondary},children:s("charts.gantt.stepName","STEP NAME")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:s("charts.gantt.start","START")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:s("charts.gantt.end","END")})]}),t.jsx("div",{ref:i,onScroll:o,className:"zg-no-scrollbar",style:{overflowY:"auto",overflowX:"hidden",flex:1},role:"grid","aria-rowcount":r.length,children:t.jsx("div",{style:{height:u,position:"relative"},children:I.map(b=>{const h=r[b.index];if(!h)return null;const w={position:"absolute",top:b.start,left:0,width:"100%",height:oe};if(h.kind==="projectHeader")return t.jsx("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1.5px solid ${e.groupBorderWeak}`,background:e.groupSoft},onClick:()=>l(h.projectId),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),l(h.projectId))},role:"button",tabIndex:0,"aria-label":`Toggle project ${h.projectTitle}`,"aria-expanded":!h.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[h.collapsed?t.jsx(H.ChevronRight,{size:15,style:{color:e.group,flexShrink:0}}):t.jsx(H.ChevronDown,{size:15,style:{color:e.group,flexShrink:0}}),t.jsx("span",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:e.group,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.projectTitle})]})},`ph-${h.projectId}`);if(h.kind==="group"){const _=h.projectId?`${h.projectId}-${h.groupType}`:h.groupType;return t.jsx("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1px solid ${e.border}`,background:e.headerBg},onClick:()=>a(_),onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),a(_))},role:"button",tabIndex:0,"aria-label":`Toggle group ${h.label}`,"aria-expanded":!h.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[h.collapsed?t.jsx(H.ChevronRight,{size:14,style:{color:e.textSecondary,flexShrink:0}}):t.jsx(H.ChevronDown,{size:14,style:{color:e.textSecondary,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textTitle},children:s(`gantt.group.${h.groupType}`,h.label)}),t.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:9999,background:e.groupSoftStrong,color:e.textSecondary},children:h.count})]})},`g-${_}`)}const c=h.task,D=v===c.id,L=d===c.id,V=c.originalType!=="step",m=T.has(c.id),K=k.has(c.id),ee=v!==null&&c.id!==v&&!C.has(c.id),W=v!==null&&C.has(c.id),ne=m?e.dangerBgSoft:D?e.groupLight:W?e.groupLightStrong:L?e.pageBg:e.surface;return t.jsxs("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",transition:"opacity 0.18s, background 0.15s",borderBottom:`1px solid ${e.borderLight}`,background:ne,borderLeft:D?`3px solid ${e.group}`:W?`3px solid ${e.groupGlow}`:K?`3px solid ${e.today}`:void 0,opacity:ee?.3:1},onClick:()=>S(_=>_===c.id?null:c.id),onDoubleClick:()=>n.onTaskClick?.(A(c)),onMouseEnter:()=>x(c.id),onMouseLeave:()=>x(null),onKeyDown:_=>{if(_.key==="Enter"){_.preventDefault(),n.onTaskClick?.(A(c));return}if(_.key===" "){_.preventDefault(),S(Z=>Z===c.id?null:c.id);return}if(_.key==="ArrowDown"){_.preventDefault(),f(c.id,1);return}_.key==="ArrowUp"&&(_.preventDefault(),f(c.id,-1))},role:"button",tabIndex:0,"aria-selected":D,"aria-label":`Task ${c.name}`,children:[t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,paddingRight:8},children:[c.originalType==="step"&&t.jsx("div",{style:{flexShrink:0,borderRadius:4,width:14,height:14,background:le[c.colorIdx??0].bar,border:`1.5px solid ${le[c.colorIdx??0].barBorder}`}}),c.originalType==="milestone"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`},children:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})}),c.originalType==="event"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`},children:t.jsx(H.Clock,{size:11,style:{color:e.event}})}),t.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:t.jsx("span",{style:{fontSize:13,fontWeight:500,lineHeight:1.25,color:D?e.group:m?e.today:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.name})}),(c.attachedNotes?.length||0)>0&&t.jsxs("button",{className:"zg-note-badge-btn","aria-label":`Open ${c.attachedNotes?.length} linked notes`,style:{flexShrink:0,display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:700,padding:"4px 10px",borderRadius:6,color:e.noteBadgeText,background:e.noteBadgeBg,border:"none",cursor:"pointer",boxShadow:e.shadowSmall,transition:"transform 0.12s ease"},onClick:_=>{_.stopPropagation(),O(c)},children:[t.jsx(H.Paperclip,{size:12}),c.attachedNotes?.length]}),m&&t.jsx(H.AlertTriangle,{size:12,style:{flexShrink:0,color:e.today}})]}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:m?e.today:e.textMuted},children:re(c.start,n.locale)}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:m?e.today:e.textMuted},children:V?"—":re(c.end,n.locale)})]},c.id)})})})]})}function Ut(n,s,r="en",i){const o=i??(s==="day"?Xe:jt),l=(R,I)=>{const u=[],z=new Date().toDateString();let f=-1;for(let b=0;b<I;b++){const h=se(R,b),w=h.toDateString()===z;w&&(f=b),u.push({date:h,isToday:w,isWeekend:h.getDay()===0||h.getDay()===6})}return{daysArr:u,todayIndex:f}};if(n.length===0){const R=new Date,I=mt(R),u=lt(R),z=we(I,u)+1,{daysArr:f,todayIndex:b}=l(I,z);return{start:I,end:u,totalDays:z,dayWidth:o,totalWidth:z*o,months:[{date:I,label:`${yt(I,r)} ${I.getFullYear()}`,startDay:0,days:z,width:z*o}],years:[{label:I.getFullYear().toString(),width:z*o}],days:f,todayIndex:b}}let a=new Date(n[0].start),d=new Date(n[0].end);n.forEach(R=>{R.start<a&&(a=new Date(R.start)),R.end>d&&(d=new Date(R.end))});const x=mt(se(a,-14)),v=lt(se(d,14)),S=we(x,v)+1,T=[];let k=new Date(x);for(;k<=v;){const R=lt(k),I=R>v?v:R,u=we(x,k),z=we(k,I)+1;T.push({date:new Date(k),label:`${yt(k,r)} ${k.getFullYear()}`,startDay:u,days:z,width:z*o}),k=new Date(k.getFullYear(),k.getMonth()+1,1)}const{daysArr:C,todayIndex:O}=l(x,S),A=[];if(s==="month"){let R="",I=0;for(const u of T){const z=u.date.getFullYear().toString();z!==R?(R&&A.push({label:R,width:I*o}),R=z,I=u.days):I+=u.days}R&&A.push({label:R,width:I*o})}return{start:x,end:v,totalDays:S,dayWidth:o,totalWidth:S*o,months:T,years:A,days:C,todayIndex:O}}function xe(n,s){return we(s.start,n)*s.dayWidth}function qt({task:n,x:s,y:r,w:i,progW:o,isHov:l,isDrag:a,isResize:d,isCritical:x,isDelayed:v,isConnectTarget:S,showDots:T,isBarDimmed:k,isBarHighlighted:C,commonEvents:O,handleResizeMouseDown:A,handleResizeTouchStart:R,handleConnectDotMouseDown:I,handleConnectDotTouchStart:u}){const{timeline:z,viewMode:f,props:b}=Ae();if(n.originalType==="step"){const h=le[n.colorIdx??0],w=r+(oe-ae)/2,c=!!(n.previsionStart&&n.previsionEnd),D=c?xe(n.previsionStart,z):0,L=c?Math.max(xe(n.previsionEnd,z)-D,f==="month"?z.dayWidth:6):0,V=w+ae+3;return t.jsxs(t.Fragment,{children:[c&&t.jsx("div",{title:`Previsto: ${re(n.previsionStart,b.locale)} → ${re(n.previsionEnd,b.locale)}`,style:{position:"absolute",left:D,top:V,width:L,height:5,borderRadius:3,background:`${h.progress}33`,border:`1.5px solid ${h.progress}66`,boxShadow:`inset 0 0 0 1px ${h.progress}22`,pointerEvents:"none",zIndex:5}}),t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Task bar ${n.name}`,style:{position:"absolute",left:s,top:w,width:i,height:ae,borderRadius:ae/2,background:v?e.delayedTaskBg:h.bar,border:x?`2px solid ${e.today}`:v?`1.5px solid ${e.todayStrong}`:`1.5px solid ${h.barBorder}`,cursor:a||d?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${h.progress}22`:"none",transform:l?"scaleY(1.06)":"scaleY(1)",opacity:k?.15:1,transition:a||d?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[t.jsxs("div",{style:{position:"absolute",left:0,top:0,width:i,height:"100%",borderRadius:ae/2,overflow:"hidden",pointerEvents:"none"},children:[t.jsx("div",{style:{position:"absolute",left:0,top:0,width:o,height:"100%",background:v?`linear-gradient(90deg, ${e.today}, ${e.todayStrong})`:`linear-gradient(90deg, ${h.progress}, ${h.progress}cc)`,borderRadius:`${ae/2}px 0 0 ${ae/2}px`,transition:a||d?"none":"width 0.3s"}}),i>50&&t.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:n.progress>50?e.white:v?e.today:h.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(n.progress),"%"]})]}),t.jsx("div",{onMouseDown:m=>A(m,n,"left"),onTouchStart:m=>R(m,n,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${ae/2}px 0 0 ${ae/2}px`}}),t.jsx("div",{onMouseDown:m=>A(m,n,"right"),onTouchStart:m=>R(m,n,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${ae/2}px ${ae/2}px 0`}}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:m=>I(m,n,"left"),onTouchStart:m=>u(m,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:m=>I(m,n,"right"),onTouchStart:m=>u(m,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})]})}if(n.originalType==="milestone"){const h=r+(oe-Re)/2;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Milestone ${n.name}`,style:{position:"absolute",left:s-6,top:h,height:Re,minWidth:dt,borderRadius:Re/2,background:x?e.criticalPillBg:e.milestonePillBg,border:S?`2px solid ${e.group}`:x?`2px solid ${e.today}`:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.milestoneRingSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:x?e.today:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:x?e.today:e.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"left"),onTouchStart:w=>u(w,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"right"),onTouchStart:w=>u(w,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="event"){const h=r+(oe-Re)/2;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Event ${n.name}`,style:{position:"absolute",left:s-6,top:h,height:Re,minWidth:dt,borderRadius:Re/2,background:x?e.criticalPillBg:e.eventPillBg,border:S?`2px solid ${e.group}`:x?`2px solid ${e.today}`:`1.5px solid ${e.event}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.eventBorderSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:x?e.today:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:x?e.today:e.event,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.event,borderRadius:6,padding:"1px 5px"},children:"✓"}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"left"),onTouchStart:w=>u(w,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"right"),onTouchStart:w=>u(w,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="note"){const w=r+4,c=n.noteColor||e.noteDefaultBg,D=n.filesCount||0;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Note ${n.name}`,style:{position:"absolute",left:s,top:w,width:148,minHeight:72,background:c,borderRadius:3,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, ${e.shadowStickyStrong}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, ${e.shadowStickyHover}`:l?e.shadowStickyHover:e.shadowSticky,opacity:k?.2:1,transition:a?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"rotate(-1.5deg) scale(1.03) translateY(-2px)":"rotate(0deg)",border:`1px solid ${e.groupSoftStrong}`,padding:"12px 10px 10px",display:"flex",flexDirection:"column",gap:2,userSelect:"none"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:11,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.inkStrong,lineHeight:"1.3",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.name}),n.projectTitle&&t.jsx("span",{style:{fontSize:10,fontWeight:400,color:e.inkSoft3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.projectTitle}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[t.jsx("span",{style:{fontSize:9,fontWeight:500,color:e.inkSoft4},children:re(n.start,b.locale)}),D>0&&t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:9,color:e.inkSoft4},children:[t.jsx(H.Paperclip,{size:8})," ",D]})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:L=>I(L,n,"left"),onTouchStart:L=>u(L,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:L=>I(L,n,"right"),onTouchStart:L=>u(L,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}return null}function Kt({arrows:n}){const{arrows:s,hoveredTaskId:r,selectedTaskId:i,relatedIds:o}=Ae(),l=n||s;return t.jsx(t.Fragment,{children:l.map((a,d)=>{const x=r===a.predId||r===a.succId,v=!i||a.predId===i||a.succId===i||o.has(a.predId)||o.has(a.succId),S=i!==null&&v,T=x?e.arrowHover:S?e.group:e.arrow;return t.jsxs("g",{style:{opacity:v?S?1:void 0:.08,transition:"opacity 0.18s"},children:[t.jsx("path",{d:a.path,fill:"none",stroke:T,strokeWidth:S?2.5:x?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),t.jsx("polygon",{points:`${a.headX},${a.headY} ${a.headX-6},${a.headY-4} ${a.headX-6},${a.headY+4}`,fill:T,style:{transition:"fill 0.2s"}})]},d)})})}const Qe=n=>({id:n.id,name:n.name,start:n.start,end:n.end,type:n.originalType==="step"?"task":n.originalType,progress:n.progress}),Ne=(n,s)=>{switch(n){case"step":return t.jsx("div",{style:{width:12,height:12,borderRadius:2,background:le[s??0].bar,border:`1.5px solid ${le[s??0].barBorder}`,flexShrink:0}});case"milestone":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:8,color:e.white})});case"event":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:8,color:e.white})});case"note":return t.jsx("div",{style:{width:12,height:14,background:e.note,borderRadius:2,boxShadow:e.shadowSmall,flexShrink:0}});default:return null}};function Zt(){const{props:n,t:s,viewMode:r,isInfiniteCanvas:i,timeline:o,displayRows:l,dragState:a,resizeState:d,connectState:x,pendingConnection:v,setPendingConnection:S,depModalType:T,setDepModalType:k,depModalLag:C,setDepModalLag:O,depCreating:A,deletingDepId:R,setDeletingDepId:I,chartMenu:u,setChartMenu:z,rightBodyRef:f,timeHeaderRef:b,handleChartMouseDown:h,handleChartTouchStart:w,handleChartWheel:c,openChartMenu:D,handleRightScroll:L,hoveredTaskId:V,setHoveredTaskId:m,selectedTaskId:K,setSelectedTaskId:ee,tooltip:W,setTooltip:ne,popupState:_,setPopupState:Z,arrows:me,criticalIds:Ie,delayedIds:ye,relatedIds:Be,handleBarMouseDown:ot,handleBarTouchStart:rt,handleResizeMouseDown:Le,handleResizeTouchStart:st,handleConnectDotMouseDown:We,handleConnectDotTouchStart:_e,handleCreateDependency:$e}=Ae(),{onViewStage:Me,onEditStage:Pe,onDeleteStage:He,onDeleteDependency:Oe,onAddNewStage:it,onAddMilestone:Ve,onAddEvent:Ge,onAddNote:Ue}=n,Y=(E,U)=>Math.round((U.getTime()-E.getTime())/864e5)+1,F=ct({count:l.length,getScrollElement:()=>f.current,estimateSize:()=>oe,overscan:12}),de=F.getVirtualItems(),be=ct({horizontal:!0,count:o.days.length,getScrollElement:()=>f.current,estimateSize:()=>o.dayWidth,overscan:10}).getVirtualItems(),ce=Math.max(F.getTotalSize(),400)+80,ze=g.useMemo(()=>{const E=new Set;for(const U of de){const X=l[U.index];X?.kind==="task"&&E.add(X.task.id)}return E},[de,l]),Te=g.useMemo(()=>me.filter(E=>ze.has(E.predId)||ze.has(E.succId)),[me,ze]),Ee=()=>Z({isOpen:!1,position:{x:0,y:0},task:null});return t.jsxs("div",{style:{flex:1,width:"100%",background:"var(--zg-surface-alt)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",borderLeft:n.hideSidebar?"none":`1px solid ${e.borderLight}`},children:[t.jsx("div",{ref:b,style:{boxSizing:"border-box",height:Ye*2,background:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:e.shadowTiny},onWheel:c,children:t.jsxs("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:[t.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ye,display:"flex"},children:[r==="day"&&o.months.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:E.label})},U)),r==="month"&&o.years?.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:E.label})},U))]}),t.jsxs("div",{style:{position:"absolute",top:Ye,left:0,right:0,height:Ye,display:"flex"},children:[r==="day"&&t.jsx("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:be.map(E=>{const U=o.days[E.index];if(!U)return null;const X=U.isToday;return t.jsx("div",{style:{position:"absolute",left:E.start,width:E.size,height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:X?800:500,color:X?e.today:e.textSecondary,letterSpacing:"-0.03em"},children:U.date.getDate().toString().padStart(2,"0")})},`day-${E.index}`)})}),r==="month"&&o.months.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:E.label.substring(0,3)})},U))]})]})}),t.jsx("div",{ref:f,className:"zg-no-scrollbar",style:{flex:1,overflow:"auto",background:"var(--zg-surface)",position:"relative",cursor:i?"grab":"default",transform:"translate3d(0,0,0)",willChange:"scroll-position"},onScroll:L,onMouseDown:h,onTouchStart:w,onWheel:c,onContextMenu:D,children:t.jsxs("div",{style:{width:o.totalWidth,height:ce,position:"relative"},children:[t.jsxs("svg",{width:o.totalWidth,height:ce,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[t.jsxs("defs",{children:[t.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:o.dayWidth,height:oe,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:o.dayWidth,y1:"0",x2:o.dayWidth,y2:oe,stroke:e.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),t.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:o.dayWidth,height:oe,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:"0",y1:oe,x2:o.dayWidth,y2:oe,stroke:e.borderLight,strokeWidth:"1"})})]}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),r==="day"&&be.map(E=>o.days[E.index]?.isWeekend?t.jsx("rect",{x:E.start,y:0,width:E.size,height:ce,fill:e.weekendBg,opacity:.6},`we-${E.index}`):null),r==="month"&&be.map(E=>o.days[E.index]?.isWeekend?t.jsx("rect",{x:E.start,y:0,width:E.size,height:ce,fill:e.weekendBg,opacity:.3},`wem-${E.index}`):null),o.todayIndex>=0&&t.jsxs("g",{children:[t.jsx("rect",{x:o.todayIndex*o.dayWidth,y:0,width:o.dayWidth,height:ce,fill:e.todayBg}),t.jsx("line",{x1:(o.todayIndex+.5)*o.dayWidth,y1:0,x2:(o.todayIndex+.5)*o.dayWidth,y2:ce,stroke:e.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),de.map(E=>{const U=l[E.index];return U&&(U.kind==="group"||U.kind==="projectHeader")?t.jsx("div",{style:{boxSizing:"border-box",position:"absolute",left:0,top:E.start,width:"100%",height:oe,background:U.kind==="projectHeader"?e.headerBg:e.groupLightSoft,borderBottom:`1px solid ${e.borderLight}`,pointerEvents:"none"}},`bg-${E.index}`):null}),t.jsxs("div",{style:{position:"absolute",inset:0},children:[de.map(E=>{const U=l[E.index];if(!U||U.kind!=="task")return null;const X=U.task,ie=a?.task.id===X.id,ve=d?.task.id===X.id,De=ie||ve&&d.edge==="left"?se(X.start,ie?a.offsetDays:d.offsetDays):X.start,J=ie||ve&&d.edge==="right"?se(X.end,ie?a.offsetDays:d.offsetDays):X.end,Se=X.originalType!=="step",he=xe(De,o);let Q=0,pe=0;Se||(Q=Math.max(xe(J,o)-he,o.dayWidth),pe=Q*(X.progress/100));const ge=V===X.id,Ce=K===X.id,qe=ye.has(X.id),Ke=Ie.has(X.id),Ze=!!K&&!Ce&&!Be.has(X.id),Je=Ce||!!K&&Be.has(X.id),at=x?.hoverTargetId===X.id,p=ge||Ce,y=E.start,j={onMouseEnter:M=>{m(X.id),!a&&!d&&ne({task:X,x:M.clientX,y:M.clientY})},onMouseMove:M=>{V===X.id&&!a&&!d&&ne({task:X,x:M.clientX,y:M.clientY})},onMouseLeave:()=>{m(null),ne(null)},onClick:M=>{M.stopPropagation(),ee(X.id),M.detail===2&&Me?.(Qe(X)),Z(!_.isOpen||_.task?.id!==X.id?{isOpen:!0,position:{x:M.clientX,y:M.clientY},task:X}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:M=>ot(M,X),onTouchStart:M=>rt(M,X),onKeyDown:M=>{if(M.key==="Enter"){M.preventDefault(),Me?.(Qe(X));return}M.key===" "&&(M.preventDefault(),ee(X.id))}};return t.jsx(qt,{task:X,x:he,y,w:Q,progW:pe,isHov:ge,isDrag:ie,isResize:ve,isCritical:Ke,isDelayed:qe,isConnectTarget:at,showDots:p,isBarDimmed:Ze,isBarHighlighted:Je,commonEvents:j,handleResizeMouseDown:Le,handleResizeTouchStart:st,handleConnectDotMouseDown:We,handleConnectDotTouchStart:_e},X.id)}),t.jsx("svg",{width:o.totalWidth,height:ce,style:{position:"absolute",inset:0,pointerEvents:"none"},children:t.jsx(Kt,{arrows:Te})}),W&&!a&&t.jsx("div",{style:{position:"fixed",left:W.x+16,top:W.y-10,zIndex:9999,pointerEvents:"none"},children:t.jsxs("div",{style:{borderRadius:12,padding:"12px 16px",minWidth:220,maxWidth:340,background:e.surfaceFrost,border:`1px solid ${e.borderLight}`,boxShadow:"var(--zg-shadow-popover)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[Ne(W.task.originalType,W.task.colorIdx),t.jsx("span",{style:{fontSize:12,fontWeight:700,color:e.textTitle,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.task.name})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:e.textSecondary},children:W.task.originalType==="step"?t.jsxs(t.Fragment,{children:[W.task.previsionStart&&W.task.previsionEnd&&t.jsxs("div",{style:{background:`${e.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:e.textSecondarySoft,border:`1.5px solid ${e.textSecondaryMid}`}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:e.textSecondary},children:s("gantt.tooltip.planned","Planned")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.previsionStart,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.previsionEnd,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Y(W.task.previsionStart,W.task.previsionEnd),"d"]})]})]}),t.jsxs("div",{style:{background:W.task.hasActualDates?e.groupLightSoft:"transparent",borderRadius:6,padding:"4px 6px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:le[W.task.colorIdx??0].progress}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:W.task.hasActualDates?e.group:e.textSecondary},children:W.task.hasActualDates?s("gantt.tooltip.actual","Actual"):s("gantt.tooltip.plannedInUse","Planned (in use)")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.end,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Y(W.task.start,W.task.end),"d"]})]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,paddingTop:4,marginTop:4,borderTop:`1px solid ${e.borderLight}`},children:[t.jsxs("span",{children:[s("charts.gantt.progress","Progress"),":"]}),t.jsxs("span",{style:{fontWeight:700,color:e.group},children:[Math.round(W.task.progress),"%"]})]})]}):W.task.originalType==="note"?t.jsxs(t.Fragment,{children:[W.task.noteProjectTitle&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[t.jsx("div",{style:{width:8,height:8,borderRadius:2,background:W.task.noteColor||e.note,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.task.noteProjectTitle})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.date","Date"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]}),(W.task.filesCount||0)>0&&t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.attachments","Attachments"),":"]}),t.jsxs("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:4,color:e.textPrimary},children:[t.jsx(H.Paperclip,{size:10}),W.task.filesCount]})]})]}):t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("charts.gantt.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]})})]})})]})]})}),_.task&&_.isOpen&&(()=>{const E=_.task,U=(n.dependencies||[]).filter(J=>J.predecessorId===E.id||J.successorId===E.id),X={FS:s("gantt.depType.fs","Finish to Start"),SS:s("gantt.depType.ss","Start to Start"),FF:s("gantt.depType.ff","Finish to Finish"),SF:s("gantt.depType.sf","Start to Finish")},ie=U.length>0?300:220,ve=Math.min(_.position.x,window.innerWidth-ie-16),De=_.position.y+8;return t.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:ve,top:De,zIndex:9999,background:"var(--zg-surface)",borderRadius:4,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:ie,overflow:"hidden"},onMouseDown:J=>J.stopPropagation(),children:[t.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${e.borderLight}`},children:t.jsx("p",{style:{fontSize:13,fontWeight:700,color:e.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:E.name,children:E.name})}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[t.jsxs("button",{onClick:()=>{Me?.(Qe(E)),Ee()},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:[t.jsx(H.Eye,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.viewDetails","View details")})]}),t.jsxs("button",{onClick:()=>{Pe?.(Qe(E)),Ee()},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:[t.jsx(H.Edit2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.edit","Edit")})]}),t.jsxs("button",{onClick:()=>{He?.(E.id),Ee()},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:e.dangerText,textAlign:"left"},children:[t.jsx(H.Trash2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.delete","Delete")})]})]}),U.length>0&&t.jsxs("div",{style:{borderTop:`1px solid ${e.borderLight}`,padding:"10px 14px 12px"},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:[s("gantt.popup.relations","Relations")," (",U.length,")"]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:U.map(J=>{const Se=J.predecessorId===E.id,he=Se?J.successorName:J.predecessorName,Q=R===J.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--zg-surface-alt)",border:`1px solid ${e.borderLight}`},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.group,marginBottom:2},children:[t.jsx("span",{style:{background:e.groupSoftStrong,borderRadius:4,padding:"1px 5px"},children:J.type})," ",t.jsx("span",{style:{color:e.textSecondary,fontWeight:500},children:Se?"→ ":"← "}),t.jsx("span",{style:{color:e.textMuted,fontWeight:400,fontSize:9},children:X[J.type]??J.type})]}),t.jsx("div",{style:{fontSize:11,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:he,children:he})]}),Oe&&t.jsx("button",{disabled:!!Q,onClick:async()=>{I(J.id);try{await Oe(J.id)}finally{I(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:Q?e.dangerBgSoft:"transparent",cursor:Q?"wait":"pointer",color:e.dangerText,fontSize:14,opacity:Q?.5:1,transition:"background 0.12s"},children:Q?"⟳":"🗑"})]},J.id)})})]})]})})(),u&&t.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(u.x,window.innerWidth-220),top:Math.min(u.y,window.innerHeight-220),zIndex:99999,background:"var(--zg-surface)",borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden"},onClick:E=>E.stopPropagation(),children:[t.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${e.borderLight}`,background:e.headerBg},children:t.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:[s("gantt.chart.addOn","Add on")," ",re(u.date,n.locale)]})}),t.jsx("div",{style:{padding:"5px 5px"},children:[{label:s("gantt.newAction.step","Step"),icon:Ne("step",0),action:()=>{it?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.milestone","Milestone"),icon:Ne("milestone"),action:()=>{Ve?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.event","Event"),icon:Ne("event"),action:()=>{Ge?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.note","Note"),icon:Ne("note"),action:()=>{Ue?.(u.date,u.projectId),z(null)}}].map(E=>t.jsxs("button",{onClick:E.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:e.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[E.icon," ",E.label]},E.label))})]}),x&&t.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[t.jsx("defs",{children:t.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:t.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:e.group})})}),t.jsx("line",{x1:x.fromScreenX,y1:x.fromScreenY,x2:x.currentScreenX,y2:x.currentScreenY,stroke:e.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"zg-dash 0.5s linear infinite"}})]}),v&&t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlayMedium,backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>S(null),children:t.jsxs("div",{style:{background:"var(--zg-surface)",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"var(--zg-shadow-popover)"},onClick:E=>E.stopPropagation(),children:[t.jsxs("div",{style:{marginBottom:20},children:[t.jsx("h3",{style:{fontSize:18,fontWeight:700,color:e.textTitle,marginBottom:4},children:s("gantt.depModal.title","Relation Type")}),t.jsx("p",{style:{fontSize:13,color:e.textSecondary},children:s("gantt.depModal.subtitle","Choose how the two tasks relate")})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:s("gantt.depModal.fs","Finish to Start"),desc:s("gantt.depModal.fsDesc","B starts when A finishes")},{type:"SS",label:s("gantt.depModal.ss","Start to Start"),desc:s("gantt.depModal.ssDesc","A and B start together")},{type:"FF",label:s("gantt.depModal.ff","Finish to Finish"),desc:s("gantt.depModal.ffDesc","A and B finish together")},{type:"SF",label:s("gantt.depModal.sf","Start to Finish"),desc:s("gantt.depModal.sfDesc","B finishes when A starts")}].map(E=>t.jsxs("button",{onClick:()=>k(E.type),style:{border:T===E.type?`2px solid ${e.group}`:`1.5px solid ${e.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:T===E.type?e.groupSoft:"var(--zg-surface-alt)"},children:[t.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:e.group,marginBottom:4,background:T===E.type?e.groupSoftStrong:e.groupSoft,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:E.type}),t.jsx("div",{style:{fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:2},children:E.label}),t.jsx("div",{style:{fontSize:11,color:e.textSecondary},children:E.desc})]},E.type))}),t.jsxs("div",{style:{marginBottom:24},children:[t.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:6},children:s("gantt.depModal.lagLabel","Lag (days)")}),t.jsx("input",{type:"number",value:C,onChange:E=>O(parseInt(E.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${e.borderLight}`,borderRadius:8,fontSize:14}})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[t.jsx("button",{onClick:()=>S(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${e.borderLight}`,background:"var(--zg-surface)",cursor:"pointer",fontWeight:600},children:s("gantt.depModal.cancel","Cancel")}),t.jsx("button",{onClick:$e,disabled:A,style:{padding:"10px 16px",borderRadius:8,border:"none",background:e.group,color:e.white,cursor:A?"wait":"pointer",fontWeight:600},children:A?s("gantt.depModal.saving","Saving..."):s("gantt.depModal.create","Create Dependency")})]})]})})]})}function Jt(n){const s=g.useRef(null),r=g.useRef(null),i=g.useRef(null),o=g.useRef(!1),l=g.useCallback(()=>{if(o.current)return;o.current=!0;const v=r.current;v&&s.current&&(s.current.scrollTop=v.scrollTop),v&&i.current&&(i.current.scrollLeft=v.scrollLeft),o.current=!1},[]),a=g.useCallback(()=>{o.current||(o.current=!0,s.current&&r.current&&(r.current.scrollTop=s.current.scrollTop),o.current=!1)},[]),d=g.useRef(!1);g.useEffect(()=>{if(d.current||!n.totalWidth)return;const v=r.current;if(!v)return;const S=xe(new Date,n);if(S>=0&&S<=n.totalWidth){const T=S-v.clientWidth/2;v.scrollLeft=Math.max(0,T),i.current&&(i.current.scrollLeft=v.scrollLeft),d.current=!0}},[n]);const x=g.useCallback(v=>{const S=r.current;if(S)if(v.preventDefault(),v.shiftKey||Math.abs(v.deltaX)>Math.abs(v.deltaY)){const T=v.shiftKey?v.deltaY:v.deltaX;S.scrollLeft+=T,i.current&&(i.current.scrollLeft=S.scrollLeft)}else S.scrollTop+=v.deltaY,s.current&&(s.current.scrollTop=S.scrollTop)},[]);return{leftBodyRef:s,rightBodyRef:r,timeHeaderRef:i,handleRightScroll:l,handleLeftScroll:a,handleChartWheel:x}}function Qt(n,s,r,i){const o=new Map;return n.forEach(l=>o.set(l.id,l)),s.map(l=>{const a=o.get(l.predecessorId),d=o.get(l.successorId);if(!a||!d)return null;const x=i.get(a.id),v=i.get(d.id);if(x==null||v==null)return null;const S=a.originalType!=="step",T=d.originalType!=="step",k=S?xe(a.start,r)+dt:xe(a.end,r),C=x*oe+oe/2,O=T?xe(d.start,r)-10:xe(d.start,r),A=v*oe+oe/2,R=14,I=Math.max(k+R,O-R),u=C===A?`M${k},${C} L${O-6},${A}`:`M${k},${C} L${I},${C} L${I},${A} L${O-6},${A}`;return{predId:a.id,succId:d.id,path:u,headX:O-6,headY:A}}).filter(Boolean)}function en(n,s,r){if(s===r)return!0;const i=new Map;for(const d of n){const x=i.get(d.predecessorId)||[];x.push(d.successorId),i.set(d.predecessorId,x)}const o=i.get(s)||[];o.push(r),i.set(s,o);const l=[r],a=new Set;for(;l.length>0;){const d=l.pop();if(d===s)return!0;if(a.has(d))continue;a.add(d);const x=i.get(d)||[];for(const v of x)a.has(v)||l.push(v)}return!1}function tn(n,s){if(n.length===0||s.length===0)return new Set;const r=new Map;n.forEach(u=>r.set(u.id,u));const i=new Set(n.map(u=>u.id)),o=s.filter(u=>i.has(u.predecessorId)&&i.has(u.successorId));if(o.length===0)return new Set;const l=new Map,a=new Map;o.forEach(u=>{l.has(u.predecessorId)||l.set(u.predecessorId,[]),l.get(u.predecessorId).push(u.successorId),a.has(u.successorId)||a.set(u.successorId,[]),a.get(u.successorId).push(u.predecessorId)});const d=u=>Math.max(1,we(u.start,u.end)),x=new Set,v=[];function S(u){x.has(u)||(x.add(u),(l.get(u)||[]).forEach(S),v.unshift(u))}n.forEach(u=>S(u.id));const T=new Map,k=new Map;for(const u of v){const z=r.get(u),f=a.get(u)||[];let b=0;for(const w of f)b=Math.max(b,k.get(w)||0);const h=f.length>0?b:0;T.set(u,h),k.set(u,h+d(z))}let C=0;k.forEach(u=>{u>C&&(C=u)});const O=new Map,A=new Map;for(let u=v.length-1;u>=0;u--){const z=v[u],f=r.get(z),b=l.get(z)||[];let h=C;for(const w of b)h=Math.min(h,O.get(w)??C);A.set(z,b.length>0?h:C),O.set(z,(A.get(z)||0)-d(f))}const R=new Set;o.forEach(u=>{R.add(u.predecessorId),R.add(u.successorId)});const I=new Set;for(const u of v){if(!R.has(u))continue;const z=(O.get(u)||0)-(T.get(u)||0);Math.abs(z)<.5&&I.add(u)}return I}function nn({steps:n,milestones:s,events:r,notes:i,dependencies:o,viewMode:l,dayWidth:a,locale:d,groupByProject:x,visibleTypes:v,collapsedGroups:S,collapsedProjects:T,selectedTaskId:k}){const C=g.useMemo(()=>{const b=[],h=new Map;i?.forEach(c=>{let D=c.targetId||c.predecessorId;if(!D&&o){const V=o.find(m=>m.successorId===c.id);V&&(D=V.predecessorId)}if(!D)return;const L=h.get(D)||[];h.set(D,[...L,c])});let w=0;return n.forEach(c=>{const D=!!(c.startDate&&c.finishDate),L=c.startDate||c.previsionStartDate,V=c.finishDate||c.previsionFinishDate;if(!L||!V)return;const m=new Date(L),K=new Date(V);if(isNaN(m.getTime())||isNaN(K.getTime()))return;K<=m&&K.setDate(K.getDate()+1);let ee,W;if(c.previsionStartDate&&c.previsionFinishDate){const Z=new Date(c.previsionStartDate),me=new Date(c.previsionFinishDate);!isNaN(Z.getTime())&&!isNaN(me.getTime())&&(ee=Z,W=me<=Z?se(Z,1):me)}const ne=o?.filter(Z=>Z.successorId===c.id).map(Z=>Z.predecessorId)||[],_=c.conclusionPercent!=null?Number(c.conclusionPercent):0;b.push({id:c.id,name:c.name,start:m,end:K,progress:_>1?Math.min(_,100):_*100,originalType:"step",deps:ne,colorIdx:w%le.length,previsionStart:ee,previsionEnd:W,hasActualDates:D,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)}),w++}),s?.forEach(c=>{if(!c.date)return;const D=new Date(c.date);if(isNaN(D.getTime()))return;const L=o?.filter(V=>V.successorId===c.id).map(V=>V.predecessorId)||[];b.push({id:c.id,name:c.name,start:D,end:D,progress:c.finished?100:0,originalType:"milestone",deps:L,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)})}),r?.forEach(c=>{if(!c.date)return;const D=new Date(c.date);if(isNaN(D.getTime()))return;const L=o?.filter(V=>V.successorId===c.id).map(V=>V.predecessorId)||[];b.push({id:c.id,name:c.title,start:D,end:D,progress:c.finished?100:0,originalType:"event",deps:L,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)})}),b},[n,s,r,i,o]),O=g.useMemo(()=>Ut(C,l,d,a),[C,l,d,a]),A=g.useMemo(()=>{const b=[],h=["step","milestone","event"];if(x){const w=new Map;C.forEach(c=>{c.projectId&&!w.has(c.projectId)&&w.set(c.projectId,c.projectTitle||c.projectId)});for(const[c,D]of Array.from(w.entries())){const L=T.has(c);if(b.push({kind:"projectHeader",projectId:c,projectTitle:D,collapsed:L}),!L){const V=C.filter(m=>m.projectId===c);for(const m of h){if(!v.has(m))continue;const K=V.filter(ne=>ne.originalType===m);if(K.length===0)continue;const ee=`${c}-${m}`,W=S.has(ee);b.push({kind:"group",groupType:m,label:ut[m],count:K.length,collapsed:W,projectId:c}),W||K.forEach(ne=>b.push({kind:"task",task:ne}))}}}}else for(const w of h){if(!v.has(w))continue;const c=C.filter(L=>L.originalType===w);if(c.length===0)continue;const D=S.has(w);b.push({kind:"group",groupType:w,label:ut[w],count:c.length,collapsed:D}),D||c.forEach(L=>b.push({kind:"task",task:L}))}return b},[C,v,S,T,x]),R=g.useMemo(()=>{const b=new Map;return A.forEach((h,w)=>{h.kind==="task"&&b.set(h.task.id,w)}),b},[A]),I=g.useMemo(()=>Qt(C,o||[],O,R),[C,o,O,R]),u=g.useMemo(()=>tn(C,o||[]),[C,o]),z=g.useMemo(()=>{const b=new Set,h=new Date;return C.forEach(w=>{w.originalType==="step"&&w.end<h&&w.progress<100&&b.add(w.id)}),b},[C]),f=g.useMemo(()=>{if(!k||!o?.length)return new Set;const b=new Set,h=[k];for(;h.length;){const w=h.shift();for(const c of o)c.predecessorId===w&&!b.has(c.successorId)&&(b.add(c.successorId),h.push(c.successorId)),c.successorId===w&&!b.has(c.predecessorId)&&(b.add(c.predecessorId),h.push(c.predecessorId))}return b},[k,o]);return{tasks:C,timeline:O,displayRows:A,taskRowIndex:R,arrows:I,criticalIds:u,delayedIds:z,relatedIds:f}}const et=260,tt=170,ue=20;function on(){const{props:n,activePinboardTask:s,setActivePinboardTask:r,t:i}=Ae(),o=!!s,l=g.useRef(null),[a,d]=g.useState({}),[x,v]=g.useState(null),S=()=>r(null),T=s?.id||null,k=s?.attachedNotes||[],C=g.useMemo(()=>T?a[T]||{}:{},[T,a]),O=g.useCallback((I,u)=>{d(z=>{const f=z[I]||{};if(Object.keys(f).length>=u)return z;const b={...f};return{...z,[I]:b}})},[]),A=g.useCallback(()=>{if(!s)return;const{id:I}=s,u={};k.forEach((z,f)=>{const b=f%4,h=Math.floor(f/4),w=ue+b*(et+18),c=ue+h*(tt+18),D=(f%5-2)*.8;u[z.id]={x:w,y:c,z:f+1,rotate:D}}),d(z=>({...z,[I]:u}))},[s,k]);g.useEffect(()=>{s&&(O(s.id,k.length),(!a[s.id]||Object.keys(a[s.id]).length===0)&&A())},[s,O,a,k.length,A]),g.useEffect(()=>{if(!o)return;const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=I}},[o]),g.useEffect(()=>{if(!x||!T)return;const I=z=>{if(z.pointerId!==x.pointerId)return;const f=l.current;if(!f)return;const b=f.getBoundingClientRect(),h=Math.max(ue,b.width-et-ue),w=Math.max(ue,b.height-tt-ue),c=Math.max(ue,Math.min(h,z.clientX-b.left-x.offsetX)),D=Math.max(ue,Math.min(w,z.clientY-b.top-x.offsetY));d(L=>{const V=L[T]||{},m=V[x.noteId];return m?{...L,[T]:{...V,[x.noteId]:{...m,x:c,y:D}}}:L})},u=z=>{z.pointerId===x.pointerId&&v(null)};return document.addEventListener("pointermove",I),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}},[T,x]);const R=g.useCallback((I,u)=>{if(!T)return;const z=l.current;if(!z)return;const f=a[T]?.[u];if(!f)return;const b=Object.values(a[T]||{}).reduce((w,c)=>Math.max(w,c.z),0);d(w=>{const c=w[T]||{},D=c[u];return D?{...w,[T]:{...c,[u]:{...D,z:b+1}}}:w});const h=z.getBoundingClientRect();v({pointerId:I.pointerId,taskId:T,noteId:u,offsetX:I.clientX-h.left-f.x,offsetY:I.clientY-h.top-f.y})},[T,a]);return t.jsxs(t.Fragment,{children:[o&&t.jsx("div",{onClick:S,style:{position:"fixed",inset:0,backgroundColor:e.overlaySoft,zIndex:999,backdropFilter:"blur(5px)",transition:"opacity 0.3s ease"}}),o&&t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i("pinboard.modalTitle","Pinboard"),style:{position:"fixed",inset:14,backgroundColor:e.surface,border:`1px solid ${e.border}`,borderRadius:18,boxShadow:"var(--zg-shadow-panel)",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},children:[t.jsxs("div",{style:{padding:"16px 18px",backgroundColor:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:10,fontWeight:700,backgroundColor:e.milestoneRing,color:e.group,padding:"3px 8px",borderRadius:999,letterSpacing:"0.06em",textTransform:"uppercase"},children:s?.originalType||""}),t.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700,color:e.textTitle},children:s?.name||""}),t.jsxs("span",{style:{fontSize:12,color:e.textSecondary,display:"flex",alignItems:"center",gap:4},children:[t.jsx(H.Calendar,{size:12}),s&&re(s.start,n.locale),s?.originalType==="step"&&` - ${re(s.end,n.locale)}`]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsxs("button",{onClick:A,style:{display:"flex",alignItems:"center",gap:6,background:e.surface,border:`1px solid ${e.border}`,borderRadius:8,fontSize:12,fontWeight:600,color:e.textPrimary,padding:"8px 10px",cursor:"pointer"},children:[t.jsx(H.RotateCcw,{size:14}),i("pinboard.reset","Reset layout")]}),t.jsx("button",{onClick:S,style:{background:e.surface,border:`1px solid ${e.border}`,borderRadius:8,cursor:"pointer",width:34,height:34,display:"grid",placeItems:"center"},children:t.jsx(H.X,{size:18})})]})]}),t.jsxs("div",{ref:l,style:{position:"relative",flex:1,overflow:"hidden",background:`linear-gradient(180deg, ${e.surfaceAlt} 0%, ${e.surface} 100%)`,backgroundImage:`
|
|
5
|
-
linear-gradient(${e.borderLight} 1px, transparent 1px),
|
|
6
|
-
linear-gradient(90deg, ${e.borderLight} 1px, transparent 1px)
|
|
7
|
-
`,backgroundSize:"28px 28px",cursor:x?"grabbing":"default"},children:[t.jsx("p",{style:{margin:0,position:"absolute",left:20,top:14,fontSize:12,color:e.textSecondary},children:i("pinboard.dragHint","Drag the notes to organize your board freely.")}),k.map((I,u)=>{const z={x:ue+u%4*(et+18),y:ue+Math.floor(u/4)*(tt+18),z:u+1,rotate:(u%5-2)*.8},f=C[I.id]||z,b=x?.noteId===I.id;return t.jsxs("div",{onPointerDown:h=>R(h,I.id),style:{position:"absolute",left:f.x,top:f.y,width:et,minHeight:tt,padding:"18px 14px 14px",borderRadius:6,border:`1px solid ${e.groupSoftStrong}`,background:I.color||e.note,boxShadow:b?e.shadowStickyHover:e.shadowSticky,transform:`rotate(${f.rotate}deg)`,userSelect:"none",touchAction:"none",cursor:b?"grabbing":"grab",zIndex:f.z,transition:b?"none":"box-shadow 0.2s ease"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:10,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[t.jsx("h3",{style:{margin:0,fontSize:14,fontWeight:700,color:e.inkSoft,lineHeight:1.3},children:I.title}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:e.inkSoft4},children:[t.jsx(H.Grip,{size:12}),i("pinboard.drag","Drag")]})]}),t.jsx("p",{style:{margin:0,fontSize:13,color:e.inkSoft2,lineHeight:1.4},children:I.description||""}),I.author&&t.jsxs("div",{style:{marginTop:12,fontSize:11,fontWeight:600,color:e.inkSoft4,textAlign:"right"},children:["- ",I.author]})]},I.id)}),k.length===0&&t.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textMuted,textAlign:"center",gap:12,opacity:.7},children:[t.jsx("div",{style:{width:60,height:60,borderRadius:"50%",background:e.headerBg,display:"grid",placeItems:"center"},children:t.jsx(H.Plus,{size:30})}),t.jsx("p",{style:{margin:0,fontSize:14},children:i("pinboard.empty","Nenhuma nota vinculada")})]})]}),t.jsx("div",{style:{padding:"14px 18px",borderTop:`1px solid ${e.borderLight}`,background:e.surface},children:t.jsxs("button",{onClick:()=>{s&&n.onAddNote?.(s.start,s.projectId)},style:{width:"100%",padding:"12px",display:"flex",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:e.group,color:e.white,border:"none",borderRadius:10,fontSize:14,fontWeight:700,cursor:"pointer"},children:[t.jsx(H.Plus,{size:18})," ",i("pinboard.newBtn","Nova Nota nesta Etapa")]})})]})]})}const rn={"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"},Tt={"planning.gantt":"PROJECT PLANNING","charts.gantt.month":"Month","charts.gantt.year":"Year","charts.gantt.stepName":"STEP NAME","charts.gantt.start":"START","charts.gantt.end":"END","charts.gantt.newAction":"New Action","charts.gantt.progress":"Progress","gantt.filter.steps":"Steps","gantt.filter.milestones":"Milestones","gantt.filter.events":"Events","gantt.filter.notes":"Notes","gantt.newAction.step":"Step","gantt.newAction.milestone":"Milestone","gantt.newAction.event":"Event","gantt.newAction.note":"Note","gantt.group.step":"Steps","gantt.group.milestone":"Milestones","gantt.group.event":"Events","gantt.group.note":"Notes","gantt.tooltip.planned":"Planned","gantt.tooltip.actual":"Actual","gantt.tooltip.plannedInUse":"Planned (in use)","gantt.tooltip.start":"Start","gantt.tooltip.end":"End","gantt.tooltip.duration":"Duration","gantt.tooltip.progress":"Progress","gantt.tooltip.date":"Date","gantt.tooltip.attachments":"Attachments","gantt.popup.viewDetails":"View details","gantt.popup.edit":"Edit","gantt.popup.delete":"Delete","gantt.popup.relations":"Relations","gantt.chart.addOn":"Add on","gantt.depType.fs":"Finish to Start","gantt.depType.ss":"Start to Start","gantt.depType.ff":"Finish to Finish","gantt.depType.sf":"Start to Finish","gantt.depModal.title":"Relation Type","gantt.depModal.subtitle":"Choose how the two tasks relate","gantt.depModal.fs":"Finish to Start","gantt.depModal.fsDesc":"B starts when A finishes","gantt.depModal.ss":"Start to Start","gantt.depModal.ssDesc":"A and B start together","gantt.depModal.ff":"Finish to Finish","gantt.depModal.ffDesc":"A and B finish together","gantt.depModal.sf":"Start to Finish","gantt.depModal.sfDesc":"B finishes when A starts","gantt.depModal.lagLabel":"Lag (days)","gantt.depModal.cancel":"Cancel","gantt.depModal.create":"Create Dependency","gantt.depModal.saving":"Saving...","noteModal.titlePlaceholder":"Note title...","noteModal.contentPlaceholder":"Write your note here...","noteModal.attachFiles":"Attach files","noteModal.removeFile":"Remove","noteModal.dependency":"Dependency","noteModal.none":"None","noteModal.milestones":"Milestones","noteModal.cancel":"Cancel","noteModal.create":"Create Note","noteModal.errorEmpty":"Please provide a title or content for the note.","noteModal.errorSave":"Error creating note.","noteModal.untitled":"Untitled","pinboard.description":"Board with notes and files linked to this task.","pinboard.empty":"No linked notes","pinboard.newBtn":"New note for this task","gantt.error.circularDependency":"Circular dependency is not allowed."};function bt(n,s,r){const i=Tt[s]||r||s;return n?typeof n=="function"?n(s,i)||i:n[s]||i:i}const sn=1.6,an=140,Et=1.2,ln=1/Et,fe=n=>{const s=n.touches[0]||n.changedTouches[0];return s?{clientX:s.clientX,clientY:s.clientY}:{clientX:0,clientY:0}},vt=n=>{if(n.length<2)return 0;const s=n[0],r=n[1];return Math.hypot(r.clientX-s.clientX,r.clientY-s.clientY)},St=n=>{if(n.length<2)return n.length===1?{clientX:n[0].clientX,clientY:n[0].clientY}:{clientX:0,clientY:0};const s=n[0],r=n[1];return{clientX:(s.clientX+r.clientX)/2,clientY:(s.clientY+r.clientY)/2}},dn=n=>Math.min(an,Math.max(sn,n));function cn(n){const{onTaskChange:s,onCreateDependency:r,onDependencyError:i,dependencies:o,translations:l}=n,a=!!n.infiniteCanvas,[d,x]=g.useState("day"),[v,S]=g.useState(Xe),T=g.useRef(v),[k,C]=g.useState(null),[O,A]=g.useState(null),[R,I]=g.useState(null),[u,z]=g.useState({isOpen:!1,position:{x:0,y:0},task:null}),[f,b]=g.useState(null),[h,w]=g.useState(null),[c,D]=g.useState(null),[L,V]=g.useState(null),[m,K]=g.useState("FS"),[ee,W]=g.useState(0),[ne,_]=g.useState(!1),[Z,me]=g.useState(null),[Ie,ye]=g.useState(null),[Be,ot]=g.useState(!1),rt=g.useRef(null),[Le,st]=g.useState(null),[We,_e]=g.useState(new Set(["step","milestone","event","note"])),[$e,Me]=g.useState(new Set),[Pe,He]=g.useState(new Set);g.useEffect(()=>{T.current=v},[v]);const Oe=g.useCallback((p,y)=>a?y==="day"&&p<=7?"month":y==="month"&&p>=10?"day":y:y,[a]),it=g.useCallback(p=>{x(p),a||S(p==="day"?Xe:jt)},[a]),Ve=g.useCallback(p=>{_e(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Ge=g.useCallback(p=>{Me(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Ue=g.useCallback(p=>{He(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Y=nn({steps:n.steps,milestones:n.milestones,events:n.events,notes:n.notes,dependencies:n.dependencies,viewMode:d,dayWidth:v,locale:n.locale,visibleTypes:We,collapsedGroups:$e,collapsedProjects:Pe,groupByProject:n.groupByProject,selectedTaskId:O||null}),F=Jt(Y.timeline),de=g.useCallback(p=>{const y=dn(p);return S(y),a&&x(j=>Oe(y,j)),y},[Oe,a]),ke=g.useCallback((p,y)=>{const j=F.rightBodyRef.current;if(!j){de(y);return}const M=j.getBoundingClientRect(),$=p-M.left,P=Number.isFinite($)?$:j.clientWidth/2,B=T.current||Xe,N=j.scrollLeft+P,q=de(y)/B;requestAnimationFrame(()=>{const te=F.rightBodyRef.current;te&&(te.scrollLeft=Math.max(0,N*q-P),F.timeHeaderRef.current&&(F.timeHeaderRef.current.scrollLeft=te.scrollLeft))})},[F.rightBodyRef,F.timeHeaderRef,de]),be=g.useCallback((p,y)=>{const j=F.rightBodyRef.current,M=y??(j?j.getBoundingClientRect().left+j.clientWidth/2:0);ke(M,T.current*p)},[ke,F.rightBodyRef]),ce=g.useCallback(()=>{be(Et)},[be]),ze=g.useCallback(()=>{be(ln)},[be]),Te=g.useCallback(()=>{const p=F.rightBodyRef.current;if(!p||Y.tasks.length===0)return;let y=Y.tasks[0].start,j=Y.tasks[0].end;for(const N of Y.tasks)N.start<y&&(y=N.start),N.end>j&&(j=N.end);const M=Math.max(1,we(y,j)+1),$=40,P=Math.max(80,p.clientWidth-$*2),B=de(P/M);requestAnimationFrame(()=>{const N=F.rightBodyRef.current;if(!N)return;const G=we(Y.timeline.start,y);N.scrollLeft=Math.max(0,G*B-$),N.scrollTop=0,F.leftBodyRef.current&&(F.leftBodyRef.current.scrollTop=N.scrollTop),F.timeHeaderRef.current&&(F.timeHeaderRef.current.scrollLeft=N.scrollLeft)})},[Y.tasks,Y.timeline.start,F.rightBodyRef,F.leftBodyRef,F.timeHeaderRef,de]),Ee=g.useRef(!1);g.useEffect(()=>{if(!a||!n.initialFitToScreen||Ee.current||Y.tasks.length===0)return;const p=F.rightBodyRef.current;!p||p.clientWidth<=0||(Te(),Ee.current=!0)},[a,n.initialFitToScreen,Y.tasks.length,Te,F.rightBodyRef]);const E=g.useCallback((p,y)=>{p.preventDefault(),p.stopPropagation(),b({task:y,startMouseX:p.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),U=g.useCallback((p,y)=>{p.preventDefault(),p.stopPropagation();const j=fe(p);b({task:y,startMouseX:j.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),X=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation(),w({task:y,edge:j,startMouseX:p.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),ie=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation();const M=fe(p);w({task:y,edge:j,startMouseX:M.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),ve=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation(),D({fromTaskId:y.id,fromEdge:j,fromScreenX:p.clientX,fromScreenY:p.clientY,currentScreenX:p.clientX,currentScreenY:p.clientY,hoverTargetId:null})},[]),De=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation();const M=fe(p);D({fromTaskId:y.id,fromEdge:j,fromScreenX:M.clientX,fromScreenY:M.clientY,currentScreenX:M.clientX,currentScreenY:M.clientY,hoverTargetId:null})},[]),J=g.useCallback(async()=>{if(!L||!r)return;const p=new Map(Y.tasks.map(B=>[B.id,B])),y=p.get(L.fromTaskId),j=p.get(L.toTaskId);if(!y||!j)return;const M=B=>B.originalType==="step"?"STEP":"MILESTONE",$=L.fromEdge==="right"?y:j,P=L.fromEdge==="right"?j:y;if(en(o||[],$.id,P.id)){const B=bt(l,"gantt.error.circularDependency","Circular dependency is not allowed.");i?.({code:"CYCLIC_DEPENDENCY",message:B,predecessorId:$.id,successorId:P.id}),i||window.alert(B),V(null);return}_(!0);try{await r({predecessorId:$.id,predecessorType:M($),successorId:P.id,successorType:M(P),type:m,lag:ee}),V(null)}finally{_(!1)}},[L,Y.tasks,r,o,l,i,m,ee]);g.useEffect(()=>{if(!f)return;const p={passive:!1},y=P=>{const B=P.clientX-f.startMouseX,N=Math.round(B/Y.timeline.dayWidth);N!==f.offsetDays&&b(G=>G?{...G,offsetDays:N}:null)},j=P=>{P.cancelable&&P.preventDefault();const N=fe(P).clientX-f.startMouseX,G=Math.round(N/Y.timeline.dayWidth);G!==f.offsetDays&&b(q=>q?{...q,offsetDays:G}:null)},M=()=>{f.offsetDays!==0&&s&&s({id:f.task.id,name:f.task.name,start:se(f.originalStart,f.offsetDays),end:se(f.originalEnd,f.offsetDays),type:f.task.originalType==="step"?"task":"milestone",progress:f.task.progress}),b(null)},$=()=>M();return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[f,Y.timeline.dayWidth,s]),g.useEffect(()=>{if(!h)return;const p={passive:!1},y=P=>{const B=P.clientX-h.startMouseX,N=Math.round(B/Y.timeline.dayWidth);N!==h.offsetDays&&w(G=>G?{...G,offsetDays:N}:null)},j=P=>{P.cancelable&&P.preventDefault();const N=fe(P).clientX-h.startMouseX,G=Math.round(N/Y.timeline.dayWidth);G!==h.offsetDays&&w(q=>q?{...q,offsetDays:G}:null)},M=()=>{if(h.offsetDays!==0&&s){const P=h.edge==="left"?se(h.originalStart,h.offsetDays):h.originalStart,B=h.edge==="right"?se(h.originalEnd,h.offsetDays):h.originalEnd;B>P&&s({id:h.task.id,name:h.task.name,start:P,end:B,type:"task",progress:h.task.progress})}w(null)},$=()=>M();return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[h,Y.timeline.dayWidth,s]);const Se=c?.fromTaskId,he=c?.fromEdge;g.useEffect(()=>{if(!Se||!he)return;const p={passive:!1},y=Se,j=he,M=N=>{let G=null;for(const q of document.elementsFromPoint(N.clientX,N.clientY)){const te=q.dataset?.taskId;if(te&&te!==y){G=te;break}}D(q=>q?{...q,currentScreenX:N.clientX,currentScreenY:N.clientY,hoverTargetId:G}:null)},$=N=>{N.cancelable&&N.preventDefault();const G=fe(N);let q=null;for(const te of document.elementsFromPoint(G.clientX,G.clientY)){const je=te.dataset?.taskId;if(je&&je!==y){q=je;break}}D(te=>te?{...te,currentScreenX:G.clientX,currentScreenY:G.clientY,hoverTargetId:q}:null)},P=N=>{let G=null;for(const q of document.elementsFromPoint(N.clientX,N.clientY)){const te=q.dataset?.taskId;if(te&&te!==y){G=te;break}}G&&r&&(V({fromTaskId:y,fromEdge:j,toTaskId:G}),K("FS"),W(0)),D(null)},B=N=>{const G=fe(N);let q=null;for(const te of document.elementsFromPoint(G.clientX,G.clientY)){const je=te.dataset?.taskId;if(je&&je!==y){q=je;break}}q&&r&&(V({fromTaskId:y,fromEdge:j,toTaskId:q}),K("FS"),W(0)),D(null)};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",P),document.addEventListener("touchmove",$,p),document.addEventListener("touchend",B),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",$),document.removeEventListener("touchend",B)}},[Se,he,r]);const[Q,pe]=g.useState(null),[ge,Ce]=g.useState(null),qe=g.useCallback(p=>{if(h||f||p.button===2)return;const y=F.rightBodyRef.current;y&&(p.preventDefault(),pe({startX:p.clientX,startY:p.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop}))},[h,f,F.rightBodyRef]),Ke=g.useCallback(p=>{if(h||f||c)return;const y=F.rightBodyRef.current;if(!y)return;if(a&&p.touches.length>=2){p.cancelable&&p.preventDefault(),pe(null);const M=vt(p.touches),$=St(p.touches);Ce({startDistance:Math.max(1,M),startDayWidth:T.current,centerClientY:$.clientY,startScrollTop:y.scrollTop});return}const j=fe(p);pe({startX:j.clientX,startY:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop})},[h,f,c,F.rightBodyRef,a]),Ze=g.useCallback(p=>{if(!a){F.handleChartWheel(p);return}if(!F.rightBodyRef.current)return;p.preventDefault();const j=Math.abs(p.deltaY)>0?p.deltaY:p.deltaX,M=Math.exp(-j*.0015);ke(p.clientX,T.current*M)},[a,F,ke]);g.useEffect(()=>{if(!Q)return;const p={passive:!1},y=P=>{const B=F.rightBodyRef.current;B&&(B.scrollLeft=Q.scrollLeft-(P.clientX-Q.startX),B.scrollTop=Q.scrollTop-(P.clientY-Q.startY),F.leftBodyRef.current&&(F.leftBodyRef.current.scrollTop=B.scrollTop),F.timeHeaderRef.current&&(F.timeHeaderRef.current.scrollLeft=B.scrollLeft))},j=P=>{P.cancelable&&P.preventDefault();const B=F.rightBodyRef.current;if(!B)return;const N=fe(P);B.scrollLeft=Q.scrollLeft-(N.clientX-Q.startX),B.scrollTop=Q.scrollTop-(N.clientY-Q.startY),F.leftBodyRef.current&&(F.leftBodyRef.current.scrollTop=B.scrollTop),F.timeHeaderRef.current&&(F.timeHeaderRef.current.scrollLeft=B.scrollLeft)},M=()=>pe(null),$=()=>pe(null);return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[Q,F.rightBodyRef,F.leftBodyRef,F.timeHeaderRef]),g.useEffect(()=>{if(!ge||!a)return;const p={passive:!1},y=M=>{if(M.touches.length<2)return;M.cancelable&&M.preventDefault();const $=F.rightBodyRef.current;if(!$)return;const P=vt(M.touches),B=St(M.touches),N=Math.max(.1,P/ge.startDistance);ke(B.clientX,ge.startDayWidth*N),$.scrollTop=ge.startScrollTop-(B.clientY-ge.centerClientY),F.leftBodyRef.current&&(F.leftBodyRef.current.scrollTop=$.scrollTop)},j=M=>{M.touches.length<2&&Ce(null)};return document.addEventListener("touchmove",y,p),document.addEventListener("touchend",j),document.addEventListener("touchcancel",j),()=>{document.removeEventListener("touchmove",y),document.removeEventListener("touchend",j),document.removeEventListener("touchcancel",j)}},[ge,a,F.rightBodyRef,F.leftBodyRef,ke]);const Je=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=M=>{const $=F.rightBodyRef.current;if(!$)return new Date;const P=$.getBoundingClientRect(),B=M-P.left+$.scrollLeft;return se(Y.timeline.start,Math.max(0,Math.floor(B/Y.timeline.dayWidth)))},j=M=>{if(!n.groupByProject)return;const $=F.leftBodyRef.current;if(!$)return;const P=$.getBoundingClientRect(),B=M-P.top+$.scrollTop,N=Math.max(0,Math.floor(B/50));for(let G=Math.min(N,Y.displayRows.length-1);G>=0;G--){const q=Y.displayRows[G];if(q.kind==="projectHeader")return q.projectId;if(q.kind==="task"&&q.task.projectId)return q.task.projectId;if(q.kind==="group"&&q.projectId)return q.projectId}};ye({x:p.clientX,y:p.clientY,date:y(p.clientX),projectId:j(p.clientY)}),pe(null)},[Y.timeline,Y.displayRows,n.groupByProject,F.rightBodyRef,F.leftBodyRef]);g.useEffect(()=>{if(!Ie)return;const p=$=>{$.key==="Escape"&&ye(null)},y=$=>{$.target.closest('[data-menu="chart-create"]')||ye(null)},j=$=>{$.target.closest('[data-menu="chart-create"]')||ye(null)},M=()=>ye(null);return document.addEventListener("keydown",p),document.addEventListener("click",y),document.addEventListener("touchstart",j),window.addEventListener("scroll",M,!0),()=>{document.removeEventListener("keydown",p),document.removeEventListener("click",y),document.removeEventListener("touchstart",j),window.removeEventListener("scroll",M,!0)}},[Ie]);const at=g.useMemo(()=>({props:n,t:(p,y)=>bt(n.translations,p,y),viewMode:d,setViewMode:it,isInfiniteCanvas:a,dayWidth:v,zoomPercent:Math.round(v/Xe*100),zoomIn:ce,zoomOut:ze,fitToScreen:Te,hoveredTaskId:k,setHoveredTaskId:C,selectedTaskId:O,setSelectedTaskId:A,tooltip:R,setTooltip:I,popupState:u,setPopupState:z,dragState:f,setDragState:b,resizeState:h,setResizeState:w,connectState:c,setConnectState:D,visibleTypes:We,setVisibleTypes:_e,toggleVisibility:Ve,collapsedGroups:$e,setCollapsedGroups:Me,toggleGroup:Ge,collapsedProjects:Pe,setCollapsedProjects:He,toggleProject:Ue,pendingConnection:L,setPendingConnection:V,depModalType:m,setDepModalType:K,depModalLag:ee,setDepModalLag:W,depCreating:ne,setDepCreating:_,deletingDepId:Z,setDeletingDepId:me,chartMenu:Ie,setChartMenu:ye,newActionOpen:Be,setNewActionOpen:ot,activePinboardTask:Le,setActivePinboardTask:st,tasks:Y.tasks,timeline:Y.timeline,displayRows:Y.displayRows,taskRowIndex:Y.taskRowIndex||new Map,arrows:Y.arrows,criticalIds:Y.criticalIds,delayedIds:Y.delayedIds,relatedIds:Y.relatedIds,...F,newActionRef:rt,screenXToDate:p=>{const y=F.rightBodyRef.current;if(!y)return new Date;const j=y.getBoundingClientRect(),M=p-j.left+y.scrollLeft;return se(Y.timeline.start,Math.max(0,Math.floor(M/Y.timeline.dayWidth)))},screenYToProjectId:p=>{if(!n.groupByProject)return;const y=F.leftBodyRef.current;if(!y)return;const j=y.getBoundingClientRect(),M=p-j.top+y.scrollTop,$=Math.max(0,Math.floor(M/50));for(let P=Math.min($,Y.displayRows.length-1);P>=0;P--){const B=Y.displayRows[P];if(B.kind==="projectHeader")return B.projectId;if(B.kind==="task"&&B.task.projectId)return B.task.projectId;if(B.kind==="group"&&B.projectId)return B.projectId}},handleChartMouseDown:qe,handleChartTouchStart:Ke,handleChartWheel:Ze,openChartMenu:Je,handleBarMouseDown:E,handleBarTouchStart:U,handleResizeMouseDown:X,handleResizeTouchStart:ie,handleConnectDotMouseDown:ve,handleConnectDotTouchStart:De,handleCreateDependency:J}),[n,d,a,v,ce,ze,Te,k,O,R,u,f,h,c,We,$e,Pe,L,m,ee,ne,Z,Ie,Be,Le,Y,F,Ve,Ge,Ue,qe,Ke,Ze,Je,E,U,X,ie,ve,De,J]);return n.loading?t.jsx("div",{role:"status","aria-live":"polite",style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textSecondary},children:t.jsx(H.Loader2,{size:32,style:{animation:"zg-spin 1.5s linear infinite",color:e.group}})}):t.jsx(Rt,{value:at,children:t.jsxs("div",{className:`zg-root ${a?"zg-root--infinite":"zg-root--framed"} ${Le?"zg-root--muted":""}`,style:{width:"100%",display:"flex",flexDirection:"column",marginLeft:"auto",marginRight:"auto",background:a?"transparent":"var(--zg-surface)",borderRadius:a?0:12,boxShadow:a?"none":"var(--zg-shadow-panel)",overflow:"hidden",height:a?"100%":"calc(100vh - 48px)",minHeight:a?0:600,border:a?"none":`1px solid ${e.borderLight}`,opacity:1,transition:"opacity 0.3s ease"},children:[t.jsx(Bt,{}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",position:"relative",background:e.surfaceAlt},children:[!n.hideSidebar&&t.jsx(Gt,{}),t.jsx(Zt,{})]}),t.jsx(on,{})]})})}const un=[{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"}],wt={FS:"Finish → Start (FS)",SS:"Start → Start (SS)",FF:"Finish → Finish (FF)",SF:"Start → Finish (SF)"};function hn({isOpen:n,onClose:s,availableMilestones:r=[],initialDate:i,translations:o,onSaveNote:l}){const a=(m,K)=>o?typeof o=="function"?o(m,K):o[m]||K:K,[d,x]=g.useState(""),[v,S]=g.useState(""),[T,k]=g.useState("#FEF08A"),[C,O]=g.useState(""),[A,R]=g.useState(""),[I,u]=g.useState("FS"),[z,f]=g.useState(!1),[b,h]=g.useState([]),[w,c]=g.useState(""),D=g.useRef(null);g.useEffect(()=>{n&&(x(""),S(""),k("#FEF08A"),O(i??new Date().toISOString().split("T")[0]),R(""),u("FS"),h([]),c(""))},[n,i]);const L=[...r.map(m=>({id:m.id,name:m.name,type:"MILESTONE"}))],V=async()=>{if(!d.trim()&&!v.trim()){c(a("noteModal.errorEmpty","Please provide a title or content for the note."));return}c("");try{f(!0),await l({title:d||a("noteModal.untitled","Untitled"),description:v,color:T,date:C?`${C}T00:00:00`:new Date().toISOString(),predecessorId:A,dependencyType:I,files:b}),s()}catch(m){console.error(m),c(a("noteModal.errorSave","Error creating note."))}finally{f(!1)}};return n?t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlaySoft,backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},onClick:s,children:t.jsxs("div",{onClick:m=>m.stopPropagation(),style:{width:400,maxHeight:"90vh",background:T||e.noteDefaultBg,borderRadius:4,boxShadow:"var(--zg-shadow-popover)",transform:"rotate(-1deg)",position:"relative",display:"flex",flexDirection:"column",fontFamily:"'Inter', sans-serif",overflow:"hidden",transition:"background 0.3s"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:64,height:16,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("button",{onClick:s,style:{position:"absolute",top:10,right:10,width:24,height:24,borderRadius:"50%",background:e.groupSoftStrong,border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:14,color:e.inkMedium},onMouseEnter:m=>m.currentTarget.style.background=e.groupBorderWeak,onMouseLeave:m=>m.currentTarget.style.background=e.groupSoftStrong,children:"✕"}),t.jsxs("div",{style:{padding:"28px 24px 20px",flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:[w&&t.jsx("div",{style:{background:e.todaySoft,color:e.dangerText,padding:"8px 12px",borderRadius:6,fontSize:12,marginBottom:12,border:`1px solid ${e.todayMid}`},children:w}),t.jsx("input",{type:"text",value:d,onChange:m=>x(m.target.value),placeholder:a("noteModal.titlePlaceholder","Note title..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:20,fontWeight:800,color:e.inkStrong,lineHeight:"1.3",padding:0,margin:0,marginBottom:14,fontFamily:"inherit"}}),t.jsx("div",{style:{width:"100%",height:1,background:e.groupSoftStrong,marginBottom:14}}),t.jsx("textarea",{value:v,onChange:m=>S(m.target.value),rows:6,placeholder:a("noteModal.contentPlaceholder","Write your note here..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:14,color:e.inkMedium,lineHeight:"1.6",resize:"vertical",padding:0,margin:0,fontFamily:"inherit",flex:1,minHeight:100}}),t.jsxs("div",{style:{marginTop:14,paddingTop:10,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("input",{ref:D,type:"file",multiple:!0,onChange:m=>{const K=m.target.files?Array.from(m.target.files):[];K.length>0&&h(ee=>[...ee,...K]),D.current&&(D.current.value="")},style:{display:"none"}}),t.jsxs("button",{type:"button",onClick:()=>D.current?.click(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:6,background:e.groupSoft,border:`1px dashed ${e.groupBorderWeak}`,cursor:"pointer",fontSize:12,color:e.inkMedium,fontWeight:500,transition:"background 0.15s",width:"100%",justifyContent:"center"},onMouseEnter:m=>m.currentTarget.style.background=e.groupSoftStrong,onMouseLeave:m=>m.currentTarget.style.background=e.groupSoft,children:[t.jsx(H.Upload,{size:13}),a("noteModal.attachFiles","Attach files")]}),b.length>0&&t.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:b.map((m,K)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,background:e.surfaceFrost,fontSize:11,color:e.inkMedium},children:[t.jsx(H.Paperclip,{size:10,style:{flexShrink:0}}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.name}),t.jsxs("span",{style:{fontSize:9,color:e.inkSoft4,flexShrink:0},children:[(m.size/1024).toFixed(0),"KB"]}),t.jsx("button",{type:"button",onClick:()=>h(ee=>ee.filter((W,ne)=>ne!==K)),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:e.dangerText},title:a("noteModal.removeFile","Remove"),children:t.jsx(H.X,{size:12})})]},`file-${K}`))})]}),t.jsxs("div",{style:{marginTop:16,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`,display:"flex",alignItems:"center",justifyItems:"flex-start",justifyContent:"space-between",gap:12},children:[t.jsx("input",{type:"date",value:C,onChange:m=>O(m.target.value),style:{background:"transparent",border:"none",outline:"none",fontSize:12,color:e.inkSoft3,fontWeight:500,fontFamily:"inherit",padding:0,cursor:"pointer",width:"auto"}}),t.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:un.map(m=>t.jsx("button",{type:"button",onClick:()=>k(m.value),style:{width:22,height:22,borderRadius:"50%",border:T===m.value?`2px solid ${e.group}`:`1.5px solid ${e.groupSoftStrong}`,backgroundColor:m.value,cursor:"pointer",padding:0,transform:T===m.value?"scale(1.15)":"scale(1)",transition:"all 0.15s",boxShadow:T===m.value?e.shadowSmall:"none"},title:m.label},m.value))})]}),L.length>0&&t.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[t.jsx(H.Link2,{size:14,style:{color:e.inkSoft3}}),t.jsx("span",{style:{fontSize:11,color:e.inkSoft3,fontWeight:600},children:a("noteModal.dependency","Dependency")})]}),t.jsxs("select",{value:A,onChange:m=>R(m.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer"},children:[t.jsx("option",{value:"",children:a("noteModal.none","None")}),r.length>0&&t.jsx("optgroup",{label:a("noteModal.milestones","Milestones"),children:r.map(m=>t.jsx("option",{value:m.id,children:m.name},m.id))})]}),A&&t.jsx("select",{value:I,onChange:m=>u(m.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer",marginTop:6},children:Object.keys(wt).map(m=>t.jsx("option",{value:m,children:wt[m]},m))})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10,paddingTop:16,marginTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("button",{onClick:s,style:{padding:"8px 16px",fontSize:13,color:e.inkMedium,background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:8,cursor:"pointer"},children:a("noteModal.cancel","Cancel")}),t.jsxs("button",{onClick:V,disabled:z,style:{padding:"8px 20px",fontSize:13,color:e.white,background:e.group,border:"none",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,opacity:z?.5:1},children:[z&&t.jsx(H.Loader2,{size:16,style:{animation:"zg-spin 1s linear infinite"}}),a("noteModal.create","Create Note")]})]})]})]})}):null}exports.NoteModal=hn;exports.ProjectGantt=cn;exports.enUS=Tt;exports.ptBR=rn;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*R,120))}deg 100% 31%);`,r?.key)}return r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(o),l=!1,o}return a.updateDeps=d=>{i=d},a}function ht(n,s){if(n===void 0)throw new Error("Unexpected undefined");return n}const Lt=(n,s)=>Math.abs(n-s)<1.01,Wt=(n,s,r)=>{let i;return function(...o){n.clearTimeout(i),i=n.setTimeout(()=>s.apply(this,o),r)}},pt=n=>{const{offsetWidth:s,offsetHeight:r}=n;return{width:s,height:r}},$t=n=>n,Pt=n=>{const s=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1),i=[];for(let o=s;o<=r;o++)i.push(o);return i},Ot=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;const o=a=>{const{width:d,height:x}=a;s({width:Math.round(d),height:Math.round(x)})};if(o(pt(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(a=>{const d=()=>{const x=a[0];if(x?.borderBoxSize){const v=x.borderBoxSize[0];if(v){o({width:v.inlineSize,height:v.blockSize});return}}o(pt(r))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},gt={passive:!0},ft=typeof window>"u"?!0:"onscrollend"in window,Nt=(n,s)=>{const r=n.scrollElement;if(!r)return;const i=n.targetWindow;if(!i)return;let o=0;const l=n.options.useScrollendEvent&&ft?()=>{}:Wt(i,()=>{s(o,!1)},n.options.isScrollingResetDelay),a=S=>()=>{const{horizontal:T,isRtl:k}=n.options;o=T?r.scrollLeft*(k&&-1||1):r.scrollTop,l(),s(o,S)},d=a(!0),x=a(!1);r.addEventListener("scroll",d,gt);const v=n.options.useScrollendEvent&&ft;return v&&r.addEventListener("scrollend",x,gt),()=>{r.removeEventListener("scroll",d),v&&r.removeEventListener("scrollend",x)}},Yt=(n,s,r)=>{if(s?.borderBoxSize){const i=s.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}return n[r.options.horizontal?"offsetWidth":"offsetHeight"]},Xt=(n,{adjustments:s=0,behavior:r},i)=>{var o,l;const a=n+s;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:a,behavior:r})};class _t{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const a=()=>{const d=l.target,x=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);return}this.shouldMeasureDuringScroll(x)&&this.resizeItem(x,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([i,o])=>{typeof o>"u"&&delete r[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$t,rangeExtractor:Pt,onChange:()=>{},measureElement:Yt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Ae(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,l=new Map;for(let a=i-1;a>=0;a--){const d=r[a];if(o.has(d.lane))continue;const x=l.get(d.lane);if(x==null||d.end>x.end?l.set(d.lane,d):d.end<x.end&&o.set(d.lane,!0),o.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((a,d)=>a.end===d.end?a.index-d.index:a.end-d.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(r,i,o,l,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:d}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:a,lanes:d},x)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const k of this.laneAssignments.keys())k>=r&&this.laneAssignments.delete(k);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(k=>{this.itemSizeCache.set(k.key,k.size)}));const v=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const S=this.measurementsCache.slice(0,v),T=new Array(d).fill(void 0);for(let k=0;k<v;k++){const C=S[k];C&&(T[C.lane]=k)}for(let k=v;k<r;k++){const C=l(k),O=this.laneAssignments.get(k);let F,R;if(O!==void 0&&this.options.lanes>1){F=O;const f=T[F],b=f!==void 0?S[f]:void 0;R=b?b.end+this.options.gap:i+o}else{const f=this.options.lanes===1?S[k-1]:this.getFurthestMeasurement(S,k);R=f?f.end+this.options.gap:i+o,F=f?f.lane:k%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(k,F)}const I=x.get(C),u=typeof I=="number"?I:this.options.estimateSize(k),z=R+u;S[k]={index:k,start:R,size:u,end:z,key:C,lane:F},T[F]=k}return this.measurementsCache=S,S},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,l)=>this.range=r.length>0&&i>0?Ht({measurements:r,outerSize:i,scrollOffset:o,lanes:l}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,l,a)=>l===null||a===null?[]:r({startIndex:l,endIndex:a,overscan:i,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-l),d=Math.min(this.options.count-1,o+l);return r>=a&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((a,d)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o;const l=this.measurementsCache[r];if(!l)return;const a=this.itemSizeCache.get(l.key)??l.size,d=i-a;d!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,d,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",d),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=d,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let l=0,a=r.length;l<a;l++){const d=r[l],x=i[d];o.push(x)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length!==0)return ht(i[It(0,i.length-1,o=>ht(i[o]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),a=this.getScrollOffset();i==="auto"&&(i=r>=a+l?"end":"start"),i==="center"?r+=(o-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),a=this.measurementsCache[r];if(!a)return;if(i==="auto")if(a.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(a.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,a.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),a=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[a,d]=l,x=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:x,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((r=i[i.length-1])==null?void 0:r.end)??0;else{const l=Array(this.options.lanes).fill(null);let a=i.length-1;for(;a>=0&&l.some(d=>d===null);){const d=i[a];l[d.lane]===null&&(l[d.lane]=d.end),a--}o=Math.max(...l.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Lt(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const It=(n,s,r,i)=>{for(;n<=s;){const o=(n+s)/2|0,l=r(o);if(l<i)n=o+1;else if(l>i)s=o-1;else return o}return n>0?n-1:0};function Ht({measurements:n,outerSize:s,scrollOffset:r,lanes:i}){const o=n.length-1,l=x=>n[x].start;if(n.length<=i)return{startIndex:0,endIndex:o};let a=It(0,o,l,r),d=a;if(i===1)for(;d<o&&n[d].end<r+s;)d++;else if(i>1){const x=Array(i).fill(0);for(;d<o&&x.some(S=>S<r+s);){const S=n[d];x[S.lane]=S.end,d++}const v=Array(i).fill(r+s);for(;a>=0&&v.some(S=>S>=r);){const S=n[a];v[S.lane]=S.start,a--}a=Math.max(0,a-a%i),d=Math.min(o,d+(i-1-d%i))}return{startIndex:a,endIndex:d}}const xt=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function Vt({useFlushSync:n=!0,...s}){const r=nt.useReducer(()=>({}),{})[1],i={...s,onChange:(l,a)=>{var d;n&&a?Dt.flushSync(r):r(),(d=s.onChange)==null||d.call(s,l,a)}},[o]=nt.useState(()=>new _t(i));return o.setOptions(i),xt(()=>o._didMount(),[]),xt(()=>o._willUpdate()),o}function ct(n){return Vt({observeElementRect:Ot,observeElementOffset:Nt,scrollToFn:Xt,...n})}const Mt=864e5,se=(n,s)=>new Date(n.getTime()+s*Mt),we=(n,s)=>Math.round((s.getTime()-n.getTime())/Mt),mt=n=>new Date(n.getFullYear(),n.getMonth(),1),lt=n=>new Date(n.getFullYear(),n.getMonth()+1,0),zt=n=>{if(!n)return"en-US";try{return new Intl.DateTimeFormat(n).resolvedOptions().locale}catch{return"en-US"}},re=(n,s="en-US")=>new Intl.DateTimeFormat(zt(s),{day:"2-digit",month:"2-digit",year:"numeric"}).format(n),yt=(n,s="en")=>new Intl.DateTimeFormat(zt(s),{month:"long"}).format(n).toUpperCase();function Gt(){const{props:n,t:s,displayRows:r,leftBodyRef:i,handleLeftScroll:o,toggleProject:l,toggleGroup:a,hoveredTaskId:d,setHoveredTaskId:x,selectedTaskId:v,setSelectedTaskId:S,delayedIds:T,criticalIds:k,relatedIds:C,setActivePinboardTask:O}=Fe(),F=b=>({id:b.id,name:b.name,start:b.start,end:b.end,type:b.originalType==="step"?"task":"milestone",progress:b.progress}),R=ct({count:r.length,getScrollElement:()=>i.current,estimateSize:()=>oe,overscan:12}),I=R.getVirtualItems(),u=Math.max(R.getTotalSize(),400)+80,z=g.useMemo(()=>r.filter(b=>b.kind==="task").map(b=>b.task.id),[r]),f=g.useCallback((b,h)=>{const w=z.indexOf(b);if(w<0)return;const c=Math.min(Math.max(0,w+h),z.length-1),D=z[c];D&&S(D)},[z,S]);return t.jsxs("div",{style:{width:Ft,flexShrink:0,borderRight:`1px solid ${e.border}`,display:"flex",flexDirection:"column",height:"100%"},children:[t.jsxs("div",{style:{boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",height:At,background:e.headerBg,borderBottom:`1px solid ${e.border}`},children:[t.jsx("div",{style:{flex:1,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textSecondary},children:s("charts.gantt.stepName","STEP NAME")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:s("charts.gantt.start","START")}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",textAlign:"center",color:e.textSecondary},children:s("charts.gantt.end","END")})]}),t.jsx("div",{ref:i,onScroll:o,className:"zg-no-scrollbar",style:{overflowY:"auto",overflowX:"hidden",flex:1},role:"grid","aria-rowcount":r.length,children:t.jsx("div",{style:{height:u,position:"relative"},children:I.map(b=>{const h=r[b.index];if(!h)return null;const w={position:"absolute",top:b.start,left:0,width:"100%",height:oe};if(h.kind==="projectHeader")return t.jsx("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1.5px solid ${e.groupBorderWeak}`,background:e.groupSoft},onClick:()=>l(h.projectId),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),l(h.projectId))},role:"button",tabIndex:0,"aria-label":`Toggle project ${h.projectTitle}`,"aria-expanded":!h.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[h.collapsed?t.jsx(H.ChevronRight,{size:15,style:{color:e.group,flexShrink:0}}):t.jsx(H.ChevronDown,{size:15,style:{color:e.group,flexShrink:0}}),t.jsx("span",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",color:e.group,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.projectTitle})]})},`ph-${h.projectId}`);if(h.kind==="group"){const _=h.projectId?`${h.projectId}-${h.groupType}`:h.groupType;return t.jsx("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",userSelect:"none",borderBottom:`1px solid ${e.border}`,background:e.headerBg},onClick:()=>a(_),onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),a(_))},role:"button",tabIndex:0,"aria-label":`Toggle group ${h.label}`,"aria-expanded":!h.collapsed,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[h.collapsed?t.jsx(H.ChevronRight,{size:14,style:{color:e.textSecondary,flexShrink:0}}):t.jsx(H.ChevronDown,{size:14,style:{color:e.textSecondary,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textTitle},children:s(`gantt.group.${h.groupType}`,h.label)}),t.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:9999,background:e.groupSoftStrong,color:e.textSecondary},children:h.count})]})},`g-${_}`)}const c=h.task,D=v===c.id,L=d===c.id,V=c.originalType!=="step",m=T.has(c.id),K=k.has(c.id),ee=v!==null&&c.id!==v&&!C.has(c.id),W=v!==null&&C.has(c.id),ne=m?e.dangerBgSoft:D?e.groupLight:W?e.groupLightStrong:L?e.pageBg:e.surface;return t.jsxs("div",{style:{...w,boxSizing:"border-box",display:"flex",alignItems:"center",padding:"0 16px",cursor:"pointer",transition:"opacity 0.18s, background 0.15s",borderBottom:`1px solid ${e.borderLight}`,background:ne,borderLeft:D?`3px solid ${e.group}`:W?`3px solid ${e.groupGlow}`:K?`3px solid ${e.today}`:void 0,opacity:ee?.3:1},onClick:()=>S(_=>_===c.id?null:c.id),onDoubleClick:()=>n.onTaskClick?.(F(c)),onMouseEnter:()=>x(c.id),onMouseLeave:()=>x(null),onKeyDown:_=>{if(_.key==="Enter"){_.preventDefault(),n.onTaskClick?.(F(c));return}if(_.key===" "){_.preventDefault(),S(Z=>Z===c.id?null:c.id);return}if(_.key==="ArrowDown"){_.preventDefault(),f(c.id,1);return}_.key==="ArrowUp"&&(_.preventDefault(),f(c.id,-1))},role:"button",tabIndex:0,"aria-selected":D,"aria-label":`Task ${c.name}`,children:[t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,paddingRight:8},children:[c.originalType==="step"&&t.jsx("div",{style:{flexShrink:0,borderRadius:4,width:14,height:14,background:le[c.colorIdx??0].bar,border:`1.5px solid ${le[c.colorIdx??0].barBorder}`}}),c.originalType==="milestone"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.milestoneRingSoft,border:`1.5px solid ${e.milestoneRing}`},children:t.jsx(H.Flag,{size:11,style:{color:e.milestone}})}),c.originalType==="event"&&t.jsx("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:22,height:22,background:e.eventSoft,border:`1.5px solid ${e.eventBorderSoft}`},children:t.jsx(H.Clock,{size:11,style:{color:e.event}})}),t.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:t.jsx("span",{style:{fontSize:13,fontWeight:500,lineHeight:1.25,color:D?e.group:m?e.today:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.name})}),(c.attachedNotes?.length||0)>0&&t.jsxs("button",{className:"zg-note-badge-btn","aria-label":`Open ${c.attachedNotes?.length} linked notes`,style:{flexShrink:0,display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:700,padding:"4px 10px",borderRadius:6,color:e.noteBadgeText,background:e.noteBadgeBg,border:"none",cursor:"pointer",boxShadow:e.shadowSmall,transition:"transform 0.12s ease"},onClick:_=>{_.stopPropagation(),O(c)},children:[t.jsx(H.Paperclip,{size:12}),c.attachedNotes?.length]}),m&&t.jsx(H.AlertTriangle,{size:12,style:{flexShrink:0,color:e.today}})]}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:m?e.today:e.textMuted},children:re(c.start,n.locale)}),t.jsx("div",{style:{width:80,fontSize:11,fontWeight:500,textAlign:"center",fontVariantNumeric:"tabular-nums",color:m?e.today:e.textMuted},children:V?"—":re(c.end,n.locale)})]},c.id)})})})]})}function Ut(n,s,r="en",i){const o=i??(s==="day"?Xe:jt),l=(R,I)=>{const u=[],z=new Date().toDateString();let f=-1;for(let b=0;b<I;b++){const h=se(R,b),w=h.toDateString()===z;w&&(f=b),u.push({date:h,isToday:w,isWeekend:h.getDay()===0||h.getDay()===6})}return{daysArr:u,todayIndex:f}};if(n.length===0){const R=new Date,I=mt(R),u=lt(R),z=we(I,u)+1,{daysArr:f,todayIndex:b}=l(I,z);return{start:I,end:u,totalDays:z,dayWidth:o,totalWidth:z*o,months:[{date:I,label:`${yt(I,r)} ${I.getFullYear()}`,startDay:0,days:z,width:z*o}],years:[{label:I.getFullYear().toString(),width:z*o}],days:f,todayIndex:b}}let a=new Date(n[0].start),d=new Date(n[0].end);n.forEach(R=>{R.start<a&&(a=new Date(R.start)),R.end>d&&(d=new Date(R.end))});const x=mt(se(a,-14)),v=lt(se(d,14)),S=we(x,v)+1,T=[];let k=new Date(x);for(;k<=v;){const R=lt(k),I=R>v?v:R,u=we(x,k),z=we(k,I)+1;T.push({date:new Date(k),label:`${yt(k,r)} ${k.getFullYear()}`,startDay:u,days:z,width:z*o}),k=new Date(k.getFullYear(),k.getMonth()+1,1)}const{daysArr:C,todayIndex:O}=l(x,S),F=[];if(s==="month"){let R="",I=0;for(const u of T){const z=u.date.getFullYear().toString();z!==R?(R&&F.push({label:R,width:I*o}),R=z,I=u.days):I+=u.days}R&&F.push({label:R,width:I*o})}return{start:x,end:v,totalDays:S,dayWidth:o,totalWidth:S*o,months:T,years:F,days:C,todayIndex:O}}function xe(n,s){return we(s.start,n)*s.dayWidth}function qt({task:n,x:s,y:r,w:i,progW:o,isHov:l,isDrag:a,isResize:d,isCritical:x,isDelayed:v,isConnectTarget:S,showDots:T,isBarDimmed:k,isBarHighlighted:C,commonEvents:O,handleResizeMouseDown:F,handleResizeTouchStart:R,handleConnectDotMouseDown:I,handleConnectDotTouchStart:u}){const{timeline:z,viewMode:f,props:b}=Fe();if(n.originalType==="step"){const h=le[n.colorIdx??0],w=r+(oe-ae)/2,c=!!(n.previsionStart&&n.previsionEnd),D=c?xe(n.previsionStart,z):0,L=c?Math.max(xe(n.previsionEnd,z)-D,f==="month"?z.dayWidth:6):0,V=w+ae+3;return t.jsxs(t.Fragment,{children:[c&&t.jsx("div",{title:`Previsto: ${re(n.previsionStart,b.locale)} → ${re(n.previsionEnd,b.locale)}`,style:{position:"absolute",left:D,top:V,width:L,height:5,borderRadius:3,background:`${h.progress}33`,border:`1.5px solid ${h.progress}66`,boxShadow:`inset 0 0 0 1px ${h.progress}22`,pointerEvents:"none",zIndex:5}}),t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Task bar ${n.name}`,style:{position:"absolute",left:s,top:w,width:i,height:ae,borderRadius:ae/2,background:v?e.delayedTaskBg:h.bar,border:x?`2px solid ${e.today}`:v?`1.5px solid ${e.todayStrong}`:`1.5px solid ${h.barBorder}`,cursor:a||d?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${h.progress}22`:"none",transform:l?"scaleY(1.06)":"scaleY(1)",opacity:k?.15:1,transition:a||d?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",overflow:"visible"},children:[t.jsxs("div",{style:{position:"absolute",left:0,top:0,width:i,height:"100%",borderRadius:ae/2,overflow:"hidden",pointerEvents:"none"},children:[t.jsx("div",{style:{position:"absolute",left:0,top:0,width:o,height:"100%",background:v?e.today:h.progress,borderRadius:`${ae/2}px 0 0 ${ae/2}px`,transition:a||d?"none":"width 0.3s"}}),i>50&&t.jsxs("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,letterSpacing:"0.05em",color:n.progress>50?e.white:v?e.today:h.progress,zIndex:1,pointerEvents:"none"},children:[Math.round(n.progress),"%"]})]}),t.jsx("div",{onMouseDown:m=>F(m,n,"left"),onTouchStart:m=>R(m,n,"left"),style:{position:"absolute",left:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`${ae/2}px 0 0 ${ae/2}px`}}),t.jsx("div",{onMouseDown:m=>F(m,n,"right"),onTouchStart:m=>R(m,n,"right"),style:{position:"absolute",right:0,top:0,width:8,height:"100%",cursor:"col-resize",zIndex:2,borderRadius:`0 ${ae/2}px ${ae/2}px 0`}}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:m=>I(m,n,"left"),onTouchStart:m=>u(m,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:m=>I(m,n,"right"),onTouchStart:m=>u(m,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})]})}if(n.originalType==="milestone"){const h=r+(oe-Re)/2;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Milestone ${n.name}`,style:{position:"absolute",left:s-6,top:h,height:Re,minWidth:dt,borderRadius:Re/2,background:x?e.criticalPillBg:e.milestonePillBg,border:S?`2px solid ${e.group}`:x?`2px solid ${e.today}`:`1.5px solid ${e.milestoneRing}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.milestoneRingSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:x?e.today:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:x?e.today:e.milestone,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.milestoneRing,borderRadius:6,padding:"1px 5px"},children:"✓"}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"left"),onTouchStart:w=>u(w,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"right"),onTouchStart:w=>u(w,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="event"){const h=r+(oe-Re)/2;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Event ${n.name}`,style:{position:"absolute",left:s-6,top:h,height:Re,minWidth:dt,borderRadius:Re/2,background:x?e.criticalPillBg:e.eventPillBg,border:S?`2px solid ${e.group}`:x?`2px solid ${e.today}`:`1.5px solid ${e.event}`,display:"flex",alignItems:"center",gap:6,paddingLeft:4,paddingRight:12,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, 0 4px 16px ${e.groupGlowSoft}`:x?`0 0 0 1px ${e.todayMid}, 0 3px 12px ${e.todaySoft}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, 0 3px 14px ${e.groupGlowSoft}`:l?`0 3px 12px ${e.eventBorderSoft}`:e.shadowSoft,opacity:k?.15:1,transition:"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"translateY(-1px)":"none",whiteSpace:"nowrap",overflow:"visible"},children:[t.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:x?e.today:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:11,color:e.white,strokeWidth:2.5})}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:x?e.today:e.event,overflow:"hidden",textOverflow:"ellipsis",maxWidth:130},children:n.name}),n.progress>=100&&t.jsx("span",{style:{fontSize:9,fontWeight:700,color:e.white,background:e.event,borderRadius:6,padding:"1px 5px"},children:"✓"}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"left"),onTouchStart:w=>u(w,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:w=>I(w,n,"right"),onTouchStart:w=>u(w,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}if(n.originalType==="note"){const w=r+4,c=n.noteColor||e.noteDefaultBg,D=n.filesCount||0;return t.jsxs("div",{"data-task-id":n.id,...O,role:"button",tabIndex:0,"aria-label":`Note ${n.name}`,style:{position:"absolute",left:s,top:w,width:148,minHeight:72,background:c,borderRadius:3,cursor:a?"grabbing":"grab",zIndex:l||S?20:10,boxShadow:S?`0 0 0 2px ${e.group}, ${e.shadowStickyStrong}`:C&&!l?`0 0 0 2px ${e.groupGlowStrong}, ${e.shadowStickyHover}`:l?e.shadowStickyHover:e.shadowSticky,opacity:k?.2:1,transition:a?"none":"box-shadow 0.2s, transform 0.15s, opacity 0.18s",transform:l?"rotate(-1.5deg) scale(1.03) translateY(-2px)":"rotate(0deg)",border:`1px solid ${e.groupSoftStrong}`,padding:"12px 10px 10px",display:"flex",flexDirection:"column",gap:2,userSelect:"none"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:11,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.inkStrong,lineHeight:"1.3",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.name}),n.projectTitle&&t.jsx("span",{style:{fontSize:10,fontWeight:400,color:e.inkSoft3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.projectTitle}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:2},children:[t.jsx("span",{style:{fontSize:9,fontWeight:500,color:e.inkSoft4},children:re(n.start,b.locale)}),D>0&&t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:9,color:e.inkSoft4},children:[t.jsx(H.Paperclip,{size:8})," ",D]})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"data-task-id":n.id,onMouseDown:L=>I(L,n,"left"),onTouchStart:L=>u(L,n,"left"),style:{position:"absolute",left:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}}),t.jsx("div",{"data-task-id":n.id,onMouseDown:L=>I(L,n,"right"),onTouchStart:L=>u(L,n,"right"),style:{position:"absolute",right:-7,top:"50%",transform:"translateY(-50%)",width:14,height:14,borderRadius:"50%",background:e.group,border:`2.5px solid ${e.connectorDotBorder}`,boxShadow:e.shadowLarge,cursor:"crosshair",zIndex:30}})]})]})}return null}function Kt({arrows:n}){const{arrows:s,hoveredTaskId:r,selectedTaskId:i,relatedIds:o}=Fe(),l=n||s;return t.jsx(t.Fragment,{children:l.map((a,d)=>{const x=r===a.predId||r===a.succId,v=!i||a.predId===i||a.succId===i||o.has(a.predId)||o.has(a.succId),S=i!==null&&v,T=x?e.arrowHover:S?e.group:e.arrow;return t.jsxs("g",{style:{opacity:v?S?1:void 0:.08,transition:"opacity 0.18s"},children:[t.jsx("path",{d:a.path,fill:"none",stroke:T,strokeWidth:S?2.5:x?2:1.5,style:{transition:"stroke 0.2s, stroke-width 0.2s"}}),t.jsx("polygon",{points:`${a.headX},${a.headY} ${a.headX-6},${a.headY-4} ${a.headX-6},${a.headY+4}`,fill:T,style:{transition:"fill 0.2s"}})]},d)})})}const Qe=n=>({id:n.id,name:n.name,start:n.start,end:n.end,type:n.originalType==="step"?"task":n.originalType,progress:n.progress}),Ne=(n,s)=>{switch(n){case"step":return t.jsx("div",{style:{width:12,height:12,borderRadius:2,background:le[s??0].bar,border:`1.5px solid ${le[s??0].barBorder}`,flexShrink:0}});case"milestone":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.milestone,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Flag,{size:8,color:e.white})});case"event":return t.jsx("div",{style:{width:16,height:16,borderRadius:"50%",background:e.event,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(H.Clock,{size:8,color:e.white})});case"note":return t.jsx("div",{style:{width:12,height:14,background:e.note,borderRadius:2,boxShadow:e.shadowSmall,flexShrink:0}});default:return null}};function Zt(){const{props:n,t:s,viewMode:r,isInfiniteCanvas:i,timeline:o,displayRows:l,dragState:a,resizeState:d,connectState:x,pendingConnection:v,setPendingConnection:S,depModalType:T,setDepModalType:k,depModalLag:C,setDepModalLag:O,depCreating:F,deletingDepId:R,setDeletingDepId:I,chartMenu:u,setChartMenu:z,rightBodyRef:f,timeHeaderRef:b,handleChartMouseDown:h,handleChartTouchStart:w,handleChartWheel:c,openChartMenu:D,handleRightScroll:L,hoveredTaskId:V,setHoveredTaskId:m,selectedTaskId:K,setSelectedTaskId:ee,tooltip:W,setTooltip:ne,popupState:_,setPopupState:Z,arrows:me,criticalIds:Ie,delayedIds:ye,relatedIds:Be,handleBarMouseDown:ot,handleBarTouchStart:rt,handleResizeMouseDown:Le,handleResizeTouchStart:st,handleConnectDotMouseDown:We,handleConnectDotTouchStart:_e,handleCreateDependency:$e}=Fe(),{onViewStage:Me,onEditStage:Pe,onDeleteStage:He,onDeleteDependency:Oe,onAddNewStage:it,onAddMilestone:Ve,onAddEvent:Ge,onAddNote:Ue}=n,Y=(E,U)=>Math.round((U.getTime()-E.getTime())/864e5)+1,A=ct({count:l.length,getScrollElement:()=>f.current,estimateSize:()=>oe,overscan:12}),de=A.getVirtualItems(),be=ct({horizontal:!0,count:o.days.length,getScrollElement:()=>f.current,estimateSize:()=>o.dayWidth,overscan:10}).getVirtualItems(),ce=Math.max(A.getTotalSize(),400)+80,ze=g.useMemo(()=>{const E=new Set;for(const U of de){const X=l[U.index];X?.kind==="task"&&E.add(X.task.id)}return E},[de,l]),Te=g.useMemo(()=>me.filter(E=>ze.has(E.predId)||ze.has(E.succId)),[me,ze]),Ee=()=>Z({isOpen:!1,position:{x:0,y:0},task:null});return t.jsxs("div",{style:{flex:1,width:"100%",background:"var(--zg-surface-alt)",display:"flex",flexDirection:"column",position:"relative",overflow:"hidden",borderLeft:n.hideSidebar?"none":`1px solid ${e.borderLight}`},children:[t.jsx("div",{ref:b,style:{boxSizing:"border-box",height:Ye*2,background:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,overflow:"hidden",position:"relative",flexShrink:0,boxShadow:e.shadowTiny},onWheel:c,children:t.jsxs("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:[t.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ye,display:"flex"},children:[r==="day"&&o.months.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:E.label})},U)),r==="month"&&o.years?.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,paddingLeft:12,display:"flex",alignItems:"flex-end",paddingBottom:6},children:t.jsx("span",{style:{fontSize:13,fontWeight:700,color:e.textTitle,letterSpacing:"0.02em"},children:E.label})},U))]}),t.jsxs("div",{style:{position:"absolute",top:Ye,left:0,right:0,height:Ye,display:"flex"},children:[r==="day"&&t.jsx("div",{style:{width:o.totalWidth,height:"100%",position:"relative"},children:be.map(E=>{const U=o.days[E.index];if(!U)return null;const X=U.isToday;return t.jsx("div",{style:{position:"absolute",left:E.start,width:E.size,height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:X?800:500,color:X?e.today:e.textSecondary,letterSpacing:"-0.03em"},children:U.date.getDate().toString().padStart(2,"0")})},`day-${E.index}`)})}),r==="month"&&o.months.map((E,U)=>t.jsx("div",{style:{width:E.width,position:"relative",height:"100%",borderRight:`1px solid ${e.borderLight}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:E.label.substring(0,3)})},U))]})]})}),t.jsx("div",{ref:f,className:"zg-no-scrollbar",style:{flex:1,overflow:"auto",background:"var(--zg-surface)",position:"relative",cursor:i?"grab":"default",transform:"translate3d(0,0,0)",willChange:"scroll-position"},onScroll:L,onMouseDown:h,onTouchStart:w,onWheel:c,onContextMenu:D,children:t.jsxs("div",{style:{width:o.totalWidth,height:ce,position:"relative"},children:[t.jsxs("svg",{width:o.totalWidth,height:ce,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[t.jsxs("defs",{children:[t.jsx("pattern",{id:"gantt-y-lines",x:"0",y:"0",width:o.dayWidth,height:oe,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:o.dayWidth,y1:"0",x2:o.dayWidth,y2:oe,stroke:e.border,strokeWidth:"1",strokeDasharray:"4 4",opacity:"0.4"})}),t.jsx("pattern",{id:"gantt-x-lines",x:"0",y:"0",width:o.dayWidth,height:oe,patternUnits:"userSpaceOnUse",children:t.jsx("line",{x1:"0",y1:oe,x2:o.dayWidth,y2:oe,stroke:e.borderLight,strokeWidth:"1"})})]}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-x-lines)"}),t.jsx("rect",{width:"100%",height:"100%",fill:"url(#gantt-y-lines)"}),r==="day"&&be.map(E=>o.days[E.index]?.isWeekend?t.jsx("rect",{x:E.start,y:0,width:E.size,height:ce,fill:e.weekendBg,opacity:.6},`we-${E.index}`):null),r==="month"&&be.map(E=>o.days[E.index]?.isWeekend?t.jsx("rect",{x:E.start,y:0,width:E.size,height:ce,fill:e.weekendBg,opacity:.3},`wem-${E.index}`):null),o.todayIndex>=0&&t.jsxs("g",{children:[t.jsx("rect",{x:o.todayIndex*o.dayWidth,y:0,width:o.dayWidth,height:ce,fill:e.todayBg}),t.jsx("line",{x1:(o.todayIndex+.5)*o.dayWidth,y1:0,x2:(o.todayIndex+.5)*o.dayWidth,y2:ce,stroke:e.today,strokeWidth:2,strokeDasharray:"4 4",opacity:.3})]})]}),de.map(E=>{const U=l[E.index];return U&&(U.kind==="group"||U.kind==="projectHeader")?t.jsx("div",{style:{boxSizing:"border-box",position:"absolute",left:0,top:E.start,width:"100%",height:oe,background:U.kind==="projectHeader"?e.headerBg:e.groupLightSoft,borderBottom:`1px solid ${e.borderLight}`,pointerEvents:"none"}},`bg-${E.index}`):null}),t.jsxs("div",{style:{position:"absolute",inset:0},children:[de.map(E=>{const U=l[E.index];if(!U||U.kind!=="task")return null;const X=U.task,ie=a?.task.id===X.id,ve=d?.task.id===X.id,De=ie||ve&&d.edge==="left"?se(X.start,ie?a.offsetDays:d.offsetDays):X.start,J=ie||ve&&d.edge==="right"?se(X.end,ie?a.offsetDays:d.offsetDays):X.end,Se=X.originalType!=="step",he=xe(De,o);let Q=0,pe=0;Se||(Q=Math.max(xe(J,o)-he,o.dayWidth),pe=Q*(X.progress/100));const ge=V===X.id,Ce=K===X.id,qe=ye.has(X.id),Ke=Ie.has(X.id),Ze=!!K&&!Ce&&!Be.has(X.id),Je=Ce||!!K&&Be.has(X.id),at=x?.hoverTargetId===X.id,p=ge||Ce,y=E.start,j={onMouseEnter:M=>{m(X.id),!a&&!d&&ne({task:X,x:M.clientX,y:M.clientY})},onMouseMove:M=>{V===X.id&&!a&&!d&&ne({task:X,x:M.clientX,y:M.clientY})},onMouseLeave:()=>{m(null),ne(null)},onClick:M=>{M.stopPropagation(),ee(X.id),M.detail===2&&Me?.(Qe(X)),Z(!_.isOpen||_.task?.id!==X.id?{isOpen:!0,position:{x:M.clientX,y:M.clientY},task:X}:{isOpen:!1,position:{x:0,y:0},task:null})},onMouseDown:M=>ot(M,X),onTouchStart:M=>rt(M,X),onKeyDown:M=>{if(M.key==="Enter"){M.preventDefault(),Me?.(Qe(X));return}M.key===" "&&(M.preventDefault(),ee(X.id))}};return t.jsx(qt,{task:X,x:he,y,w:Q,progW:pe,isHov:ge,isDrag:ie,isResize:ve,isCritical:Ke,isDelayed:qe,isConnectTarget:at,showDots:p,isBarDimmed:Ze,isBarHighlighted:Je,commonEvents:j,handleResizeMouseDown:Le,handleResizeTouchStart:st,handleConnectDotMouseDown:We,handleConnectDotTouchStart:_e},X.id)}),t.jsx("svg",{width:o.totalWidth,height:ce,style:{position:"absolute",inset:0,pointerEvents:"none"},children:t.jsx(Kt,{arrows:Te})}),W&&!a&&t.jsx("div",{style:{position:"fixed",left:W.x+16,top:W.y-10,zIndex:9999,pointerEvents:"none"},children:t.jsxs("div",{style:{borderRadius:12,padding:"12px 16px",minWidth:220,maxWidth:340,background:e.surfaceFrost,border:`1px solid ${e.borderLight}`,boxShadow:"var(--zg-shadow-popover)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[Ne(W.task.originalType,W.task.colorIdx),t.jsx("span",{style:{fontSize:12,fontWeight:700,color:e.textTitle,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.task.name})]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:e.textSecondary},children:W.task.originalType==="step"?t.jsxs(t.Fragment,{children:[W.task.previsionStart&&W.task.previsionEnd&&t.jsxs("div",{style:{background:`${e.headerBg}`,borderRadius:6,padding:"4px 6px",marginBottom:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:e.textSecondarySoft,border:`1.5px solid ${e.textSecondaryMid}`}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:e.textSecondary},children:s("gantt.tooltip.planned","Planned")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.previsionStart,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.previsionEnd,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Y(W.task.previsionStart,W.task.previsionEnd),"d"]})]})]}),t.jsxs("div",{style:{background:W.task.hasActualDates?e.groupLightSoft:"transparent",borderRadius:6,padding:"4px 6px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{width:20,height:4,borderRadius:2,background:le[W.task.colorIdx??0].progress}}),t.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:W.task.hasActualDates?e.group:e.textSecondary},children:W.task.hasActualDates?s("gantt.tooltip.actual","Actual"):s("gantt.tooltip.plannedInUse","Planned (in use)")})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.end","End"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.end,n.locale)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.duration","Duration"),":"]}),t.jsxs("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:[Y(W.task.start,W.task.end),"d"]})]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,paddingTop:4,marginTop:4,borderTop:`1px solid ${e.borderLight}`},children:[t.jsxs("span",{children:[s("charts.gantt.progress","Progress"),":"]}),t.jsxs("span",{style:{fontWeight:700,color:e.group},children:[Math.round(W.task.progress),"%"]})]})]}):W.task.originalType==="note"?t.jsxs(t.Fragment,{children:[W.task.noteProjectTitle&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[t.jsx("div",{style:{width:8,height:8,borderRadius:2,background:W.task.noteColor||e.note,flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:600,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.task.noteProjectTitle})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.date","Date"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]}),(W.task.filesCount||0)>0&&t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("gantt.tooltip.attachments","Attachments"),":"]}),t.jsxs("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:4,color:e.textPrimary},children:[t.jsx(H.Paperclip,{size:10}),W.task.filesCount]})]})]}):t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16},children:[t.jsxs("span",{children:[s("charts.gantt.start","Start"),":"]}),t.jsx("span",{style:{fontWeight:600,fontVariantNumeric:"tabular-nums",color:e.textPrimary},children:re(W.task.start,n.locale)})]})})]})})]})]})}),_.task&&_.isOpen&&(()=>{const E=_.task,U=(n.dependencies||[]).filter(J=>J.predecessorId===E.id||J.successorId===E.id),X={FS:s("gantt.depType.fs","Finish to Start"),SS:s("gantt.depType.ss","Start to Start"),FF:s("gantt.depType.ff","Finish to Finish"),SF:s("gantt.depType.sf","Start to Finish")},ie=U.length>0?300:220,ve=Math.min(_.position.x,window.innerWidth-ie-16),De=_.position.y+8;return t.jsxs("div",{"data-popup":"gantt-action",style:{position:"fixed",left:ve,top:De,zIndex:9999,background:"var(--zg-surface)",borderRadius:4,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:ie,overflow:"hidden"},onMouseDown:J=>J.stopPropagation(),children:[t.jsx("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${e.borderLight}`},children:t.jsx("p",{style:{fontSize:13,fontWeight:700,color:e.group,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:E.name,children:E.name})}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 6px"},children:[t.jsxs("button",{onClick:()=>{Me?.(Qe(E)),Ee()},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:[t.jsx(H.Eye,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.viewDetails","View details")})]}),t.jsxs("button",{onClick:()=>{Pe?.(Qe(E)),Ee()},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:[t.jsx(H.Edit2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.edit","Edit")})]}),t.jsxs("button",{onClick:()=>{He?.(E.id),Ee()},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:e.dangerText,textAlign:"left"},children:[t.jsx(H.Trash2,{size:15})," ",t.jsx("span",{style:{flex:1,textAlign:"left"},children:s("gantt.popup.delete","Delete")})]})]}),U.length>0&&t.jsxs("div",{style:{borderTop:`1px solid ${e.borderLight}`,padding:"10px 14px 12px"},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:[s("gantt.popup.relations","Relations")," (",U.length,")"]}),t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:U.map(J=>{const Se=J.predecessorId===E.id,he=Se?J.successorName:J.predecessorName,Q=R===J.id;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:8,background:"var(--zg-surface-alt)",border:`1px solid ${e.borderLight}`},children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{fontSize:10,fontWeight:700,color:e.group,marginBottom:2},children:[t.jsx("span",{style:{background:e.groupSoftStrong,borderRadius:4,padding:"1px 5px"},children:J.type})," ",t.jsx("span",{style:{color:e.textSecondary,fontWeight:500},children:Se?"→ ":"← "}),t.jsx("span",{style:{color:e.textMuted,fontWeight:400,fontSize:9},children:X[J.type]??J.type})]}),t.jsx("div",{style:{fontSize:11,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:he,children:he})]}),Oe&&t.jsx("button",{disabled:!!Q,onClick:async()=>{I(J.id);try{await Oe(J.id)}finally{I(null)}},style:{flexShrink:0,padding:"4px 6px",borderRadius:6,border:"none",background:Q?e.dangerBgSoft:"transparent",cursor:Q?"wait":"pointer",color:e.dangerText,fontSize:14,opacity:Q?.5:1,transition:"background 0.12s"},children:Q?"⟳":"🗑"})]},J.id)})})]})]})})(),u&&t.jsxs("div",{"data-menu":"chart-create",style:{position:"fixed",left:Math.min(u.x,window.innerWidth-220),top:Math.min(u.y,window.innerHeight-220),zIndex:99999,background:"var(--zg-surface)",borderRadius:10,boxShadow:"var(--zg-shadow-popover)",border:`1.5px solid ${e.borderLight}`,width:200,overflow:"hidden"},onClick:E=>E.stopPropagation(),children:[t.jsx("div",{style:{padding:"9px 13px 8px",borderBottom:`1px solid ${e.borderLight}`,background:e.headerBg},children:t.jsxs("p",{style:{margin:0,fontSize:10,fontWeight:700,color:e.textSecondary,textTransform:"uppercase",letterSpacing:"0.08em"},children:[s("gantt.chart.addOn","Add on")," ",re(u.date,n.locale)]})}),t.jsx("div",{style:{padding:"5px 5px"},children:[{label:s("gantt.newAction.step","Step"),icon:Ne("step",0),action:()=>{it?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.milestone","Milestone"),icon:Ne("milestone"),action:()=>{Ve?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.event","Event"),icon:Ne("event"),action:()=>{Ge?.(u.date,u.projectId),z(null)}},{label:s("gantt.newAction.note","Note"),icon:Ne("note"),action:()=>{Ue?.(u.date,u.projectId),z(null)}}].map(E=>t.jsxs("button",{onClick:E.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:e.textPrimary,textAlign:"left",transition:"background 0.12s"},children:[E.icon," ",E.label]},E.label))})]}),x&&t.jsxs("svg",{style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:99999},children:[t.jsx("defs",{children:t.jsx("marker",{id:"connect-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:t.jsx("path",{d:"M0,0 L0,6 L6,3 z",fill:e.group})})}),t.jsx("line",{x1:x.fromScreenX,y1:x.fromScreenY,x2:x.currentScreenX,y2:x.currentScreenY,stroke:e.group,strokeWidth:2.5,strokeDasharray:"8 5",markerEnd:"url(#connect-arrow)",opacity:.85,style:{animation:"zg-dash 0.5s linear infinite"}})]}),v&&t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlayMedium,display:"flex",alignItems:"center",justifyContent:"center",zIndex:99998},onClick:()=>S(null),children:t.jsxs("div",{style:{background:"var(--zg-surface)",borderRadius:20,padding:"32px 36px",width:420,boxShadow:"var(--zg-shadow-popover)"},onClick:E=>E.stopPropagation(),children:[t.jsxs("div",{style:{marginBottom:20},children:[t.jsx("h3",{style:{fontSize:18,fontWeight:700,color:e.textTitle,marginBottom:4},children:s("gantt.depModal.title","Relation Type")}),t.jsx("p",{style:{fontSize:13,color:e.textSecondary},children:s("gantt.depModal.subtitle","Choose how the two tasks relate")})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[{type:"FS",label:s("gantt.depModal.fs","Finish to Start"),desc:s("gantt.depModal.fsDesc","B starts when A finishes")},{type:"SS",label:s("gantt.depModal.ss","Start to Start"),desc:s("gantt.depModal.ssDesc","A and B start together")},{type:"FF",label:s("gantt.depModal.ff","Finish to Finish"),desc:s("gantt.depModal.ffDesc","A and B finish together")},{type:"SF",label:s("gantt.depModal.sf","Start to Finish"),desc:s("gantt.depModal.sfDesc","B finishes when A starts")}].map(E=>t.jsxs("button",{onClick:()=>k(E.type),style:{border:T===E.type?`2px solid ${e.group}`:`1.5px solid ${e.borderLight}`,borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",background:T===E.type?e.groupSoft:"var(--zg-surface-alt)"},children:[t.jsx("div",{style:{fontSize:11,fontFamily:"monospace",fontWeight:700,color:e.group,marginBottom:4,background:T===E.type?e.groupSoftStrong:e.groupSoft,borderRadius:6,padding:"2px 6px",display:"inline-block"},children:E.type}),t.jsx("div",{style:{fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:2},children:E.label}),t.jsx("div",{style:{fontSize:11,color:e.textSecondary},children:E.desc})]},E.type))}),t.jsxs("div",{style:{marginBottom:24},children:[t.jsx("label",{style:{display:"block",fontSize:13,fontWeight:600,color:e.textTitle,marginBottom:6},children:s("gantt.depModal.lagLabel","Lag (days)")}),t.jsx("input",{type:"number",value:C,onChange:E=>O(parseInt(E.target.value)||0),style:{width:"100%",padding:"10px 12px",border:`1.5px solid ${e.borderLight}`,borderRadius:8,fontSize:14}})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[t.jsx("button",{onClick:()=>S(null),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${e.borderLight}`,background:"var(--zg-surface)",cursor:"pointer",fontWeight:600},children:s("gantt.depModal.cancel","Cancel")}),t.jsx("button",{onClick:$e,disabled:F,style:{padding:"10px 16px",borderRadius:8,border:"none",background:e.group,color:e.white,cursor:F?"wait":"pointer",fontWeight:600},children:F?s("gantt.depModal.saving","Saving..."):s("gantt.depModal.create","Create Dependency")})]})]})})]})}function Jt(n){const s=g.useRef(null),r=g.useRef(null),i=g.useRef(null),o=g.useRef(!1),l=g.useCallback(()=>{if(o.current)return;o.current=!0;const v=r.current;v&&s.current&&(s.current.scrollTop=v.scrollTop),v&&i.current&&(i.current.scrollLeft=v.scrollLeft),o.current=!1},[]),a=g.useCallback(()=>{o.current||(o.current=!0,s.current&&r.current&&(r.current.scrollTop=s.current.scrollTop),o.current=!1)},[]),d=g.useRef(!1);g.useEffect(()=>{if(d.current||!n.totalWidth)return;const v=r.current;if(!v)return;const S=xe(new Date,n);if(S>=0&&S<=n.totalWidth){const T=S-v.clientWidth/2;v.scrollLeft=Math.max(0,T),i.current&&(i.current.scrollLeft=v.scrollLeft),d.current=!0}},[n]);const x=g.useCallback(v=>{const S=r.current;if(S)if(v.preventDefault(),v.shiftKey||Math.abs(v.deltaX)>Math.abs(v.deltaY)){const T=v.shiftKey?v.deltaY:v.deltaX;S.scrollLeft+=T,i.current&&(i.current.scrollLeft=S.scrollLeft)}else S.scrollTop+=v.deltaY,s.current&&(s.current.scrollTop=S.scrollTop)},[]);return{leftBodyRef:s,rightBodyRef:r,timeHeaderRef:i,handleRightScroll:l,handleLeftScroll:a,handleChartWheel:x}}function Qt(n,s,r,i){const o=new Map;return n.forEach(l=>o.set(l.id,l)),s.map(l=>{const a=o.get(l.predecessorId),d=o.get(l.successorId);if(!a||!d)return null;const x=i.get(a.id),v=i.get(d.id);if(x==null||v==null)return null;const S=a.originalType!=="step",T=d.originalType!=="step",k=S?xe(a.start,r)+dt:xe(a.end,r),C=x*oe+oe/2,O=T?xe(d.start,r)-10:xe(d.start,r),F=v*oe+oe/2,R=14,I=Math.max(k+R,O-R),u=C===F?`M${k},${C} L${O-6},${F}`:`M${k},${C} L${I},${C} L${I},${F} L${O-6},${F}`;return{predId:a.id,succId:d.id,path:u,headX:O-6,headY:F}}).filter(Boolean)}function en(n,s,r){if(s===r)return!0;const i=new Map;for(const d of n){const x=i.get(d.predecessorId)||[];x.push(d.successorId),i.set(d.predecessorId,x)}const o=i.get(s)||[];o.push(r),i.set(s,o);const l=[r],a=new Set;for(;l.length>0;){const d=l.pop();if(d===s)return!0;if(a.has(d))continue;a.add(d);const x=i.get(d)||[];for(const v of x)a.has(v)||l.push(v)}return!1}function tn(n,s){if(n.length===0||s.length===0)return new Set;const r=new Map;n.forEach(u=>r.set(u.id,u));const i=new Set(n.map(u=>u.id)),o=s.filter(u=>i.has(u.predecessorId)&&i.has(u.successorId));if(o.length===0)return new Set;const l=new Map,a=new Map;o.forEach(u=>{l.has(u.predecessorId)||l.set(u.predecessorId,[]),l.get(u.predecessorId).push(u.successorId),a.has(u.successorId)||a.set(u.successorId,[]),a.get(u.successorId).push(u.predecessorId)});const d=u=>Math.max(1,we(u.start,u.end)),x=new Set,v=[];function S(u){x.has(u)||(x.add(u),(l.get(u)||[]).forEach(S),v.unshift(u))}n.forEach(u=>S(u.id));const T=new Map,k=new Map;for(const u of v){const z=r.get(u),f=a.get(u)||[];let b=0;for(const w of f)b=Math.max(b,k.get(w)||0);const h=f.length>0?b:0;T.set(u,h),k.set(u,h+d(z))}let C=0;k.forEach(u=>{u>C&&(C=u)});const O=new Map,F=new Map;for(let u=v.length-1;u>=0;u--){const z=v[u],f=r.get(z),b=l.get(z)||[];let h=C;for(const w of b)h=Math.min(h,O.get(w)??C);F.set(z,b.length>0?h:C),O.set(z,(F.get(z)||0)-d(f))}const R=new Set;o.forEach(u=>{R.add(u.predecessorId),R.add(u.successorId)});const I=new Set;for(const u of v){if(!R.has(u))continue;const z=(O.get(u)||0)-(T.get(u)||0);Math.abs(z)<.5&&I.add(u)}return I}function nn({steps:n,milestones:s,events:r,notes:i,dependencies:o,viewMode:l,dayWidth:a,locale:d,groupByProject:x,visibleTypes:v,collapsedGroups:S,collapsedProjects:T,selectedTaskId:k}){const C=g.useMemo(()=>{const b=[],h=new Map;i?.forEach(c=>{let D=c.targetId||c.predecessorId;if(!D&&o){const V=o.find(m=>m.successorId===c.id);V&&(D=V.predecessorId)}if(!D)return;const L=h.get(D)||[];h.set(D,[...L,c])});let w=0;return n.forEach(c=>{const D=!!(c.startDate&&c.finishDate),L=c.startDate||c.previsionStartDate,V=c.finishDate||c.previsionFinishDate;if(!L||!V)return;const m=new Date(L),K=new Date(V);if(isNaN(m.getTime())||isNaN(K.getTime()))return;K<=m&&K.setDate(K.getDate()+1);let ee,W;if(c.previsionStartDate&&c.previsionFinishDate){const Z=new Date(c.previsionStartDate),me=new Date(c.previsionFinishDate);!isNaN(Z.getTime())&&!isNaN(me.getTime())&&(ee=Z,W=me<=Z?se(Z,1):me)}const ne=o?.filter(Z=>Z.successorId===c.id).map(Z=>Z.predecessorId)||[],_=c.conclusionPercent!=null?Number(c.conclusionPercent):0;b.push({id:c.id,name:c.name,start:m,end:K,progress:_>1?Math.min(_,100):_*100,originalType:"step",deps:ne,colorIdx:w%le.length,previsionStart:ee,previsionEnd:W,hasActualDates:D,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)}),w++}),s?.forEach(c=>{if(!c.date)return;const D=new Date(c.date);if(isNaN(D.getTime()))return;const L=o?.filter(V=>V.successorId===c.id).map(V=>V.predecessorId)||[];b.push({id:c.id,name:c.name,start:D,end:D,progress:c.finished?100:0,originalType:"milestone",deps:L,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)})}),r?.forEach(c=>{if(!c.date)return;const D=new Date(c.date);if(isNaN(D.getTime()))return;const L=o?.filter(V=>V.successorId===c.id).map(V=>V.predecessorId)||[];b.push({id:c.id,name:c.title,start:D,end:D,progress:c.finished?100:0,originalType:"event",deps:L,projectId:c.projectId||void 0,projectTitle:c.projectTitle||void 0,attachedNotes:h.get(c.id)})}),b},[n,s,r,i,o]),O=g.useMemo(()=>Ut(C,l,d,a),[C,l,d,a]),F=g.useMemo(()=>{const b=[],h=["step","milestone","event"];if(x){const w=new Map;C.forEach(c=>{c.projectId&&!w.has(c.projectId)&&w.set(c.projectId,c.projectTitle||c.projectId)});for(const[c,D]of Array.from(w.entries())){const L=T.has(c);if(b.push({kind:"projectHeader",projectId:c,projectTitle:D,collapsed:L}),!L){const V=C.filter(m=>m.projectId===c);for(const m of h){if(!v.has(m))continue;const K=V.filter(ne=>ne.originalType===m);if(K.length===0)continue;const ee=`${c}-${m}`,W=S.has(ee);b.push({kind:"group",groupType:m,label:ut[m],count:K.length,collapsed:W,projectId:c}),W||K.forEach(ne=>b.push({kind:"task",task:ne}))}}}}else for(const w of h){if(!v.has(w))continue;const c=C.filter(L=>L.originalType===w);if(c.length===0)continue;const D=S.has(w);b.push({kind:"group",groupType:w,label:ut[w],count:c.length,collapsed:D}),D||c.forEach(L=>b.push({kind:"task",task:L}))}return b},[C,v,S,T,x]),R=g.useMemo(()=>{const b=new Map;return F.forEach((h,w)=>{h.kind==="task"&&b.set(h.task.id,w)}),b},[F]),I=g.useMemo(()=>Qt(C,o||[],O,R),[C,o,O,R]),u=g.useMemo(()=>tn(C,o||[]),[C,o]),z=g.useMemo(()=>{const b=new Set,h=new Date;return C.forEach(w=>{w.originalType==="step"&&w.end<h&&w.progress<100&&b.add(w.id)}),b},[C]),f=g.useMemo(()=>{if(!k||!o?.length)return new Set;const b=new Set,h=[k];for(;h.length;){const w=h.shift();for(const c of o)c.predecessorId===w&&!b.has(c.successorId)&&(b.add(c.successorId),h.push(c.successorId)),c.successorId===w&&!b.has(c.predecessorId)&&(b.add(c.predecessorId),h.push(c.predecessorId))}return b},[k,o]);return{tasks:C,timeline:O,displayRows:F,taskRowIndex:R,arrows:I,criticalIds:u,delayedIds:z,relatedIds:f}}const et=260,tt=170,ue=20;function on(){const{props:n,activePinboardTask:s,setActivePinboardTask:r,t:i}=Fe(),o=!!s,l=g.useRef(null),[a,d]=g.useState({}),[x,v]=g.useState(null),S=()=>r(null),T=s?.id||null,k=s?.attachedNotes||[],C=g.useMemo(()=>T?a[T]||{}:{},[T,a]),O=g.useCallback((I,u)=>{d(z=>{const f=z[I]||{};if(Object.keys(f).length>=u)return z;const b={...f};return{...z,[I]:b}})},[]),F=g.useCallback(()=>{if(!s)return;const{id:I}=s,u={};k.forEach((z,f)=>{const b=f%4,h=Math.floor(f/4),w=ue+b*(et+18),c=ue+h*(tt+18),D=(f%5-2)*.8;u[z.id]={x:w,y:c,z:f+1,rotate:D}}),d(z=>({...z,[I]:u}))},[s,k]);g.useEffect(()=>{s&&(O(s.id,k.length),(!a[s.id]||Object.keys(a[s.id]).length===0)&&F())},[s,O,a,k.length,F]),g.useEffect(()=>{if(!o)return;const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=I}},[o]),g.useEffect(()=>{if(!x||!T)return;const I=z=>{if(z.pointerId!==x.pointerId)return;const f=l.current;if(!f)return;const b=f.getBoundingClientRect(),h=Math.max(ue,b.width-et-ue),w=Math.max(ue,b.height-tt-ue),c=Math.max(ue,Math.min(h,z.clientX-b.left-x.offsetX)),D=Math.max(ue,Math.min(w,z.clientY-b.top-x.offsetY));d(L=>{const V=L[T]||{},m=V[x.noteId];return m?{...L,[T]:{...V,[x.noteId]:{...m,x:c,y:D}}}:L})},u=z=>{z.pointerId===x.pointerId&&v(null)};return document.addEventListener("pointermove",I),document.addEventListener("pointerup",u),document.addEventListener("pointercancel",u),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",u),document.removeEventListener("pointercancel",u)}},[T,x]);const R=g.useCallback((I,u)=>{if(!T)return;const z=l.current;if(!z)return;const f=a[T]?.[u];if(!f)return;const b=Object.values(a[T]||{}).reduce((w,c)=>Math.max(w,c.z),0);d(w=>{const c=w[T]||{},D=c[u];return D?{...w,[T]:{...c,[u]:{...D,z:b+1}}}:w});const h=z.getBoundingClientRect();v({pointerId:I.pointerId,taskId:T,noteId:u,offsetX:I.clientX-h.left-f.x,offsetY:I.clientY-h.top-f.y})},[T,a]);return t.jsxs(t.Fragment,{children:[o&&t.jsx("div",{onClick:S,style:{position:"fixed",inset:0,backgroundColor:e.overlaySoft,zIndex:999,transition:"opacity 0.3s ease"}}),o&&t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i("pinboard.modalTitle","Pinboard"),style:{position:"fixed",inset:14,backgroundColor:e.surface,border:`1px solid ${e.border}`,borderRadius:18,boxShadow:"var(--zg-shadow-panel)",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},children:[t.jsxs("div",{style:{padding:"16px 18px",backgroundColor:e.headerBg,borderBottom:`1px solid ${e.borderLight}`,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:10,fontWeight:700,backgroundColor:e.milestoneRing,color:e.group,padding:"3px 8px",borderRadius:999,letterSpacing:"0.06em",textTransform:"uppercase"},children:s?.originalType||""}),t.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700,color:e.textTitle},children:s?.name||""}),t.jsxs("span",{style:{fontSize:12,color:e.textSecondary,display:"flex",alignItems:"center",gap:4},children:[t.jsx(H.Calendar,{size:12}),s&&re(s.start,n.locale),s?.originalType==="step"&&` - ${re(s.end,n.locale)}`]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsxs("button",{onClick:F,style:{display:"flex",alignItems:"center",gap:6,background:e.surface,border:`1px solid ${e.border}`,borderRadius:8,fontSize:12,fontWeight:600,color:e.textPrimary,padding:"8px 10px",cursor:"pointer"},children:[t.jsx(H.RotateCcw,{size:14}),i("pinboard.reset","Reset layout")]}),t.jsx("button",{onClick:S,style:{background:e.surface,border:`1px solid ${e.border}`,borderRadius:8,cursor:"pointer",width:34,height:34,display:"grid",placeItems:"center"},children:t.jsx(H.X,{size:18})})]})]}),t.jsxs("div",{ref:l,style:{position:"relative",flex:1,overflow:"hidden",background:e.surface,cursor:x?"grabbing":"default"},children:[t.jsx("p",{style:{margin:0,position:"absolute",left:20,top:14,fontSize:12,color:e.textSecondary},children:i("pinboard.dragHint","Drag the notes to organize your board freely.")}),k.map((I,u)=>{const z={x:ue+u%4*(et+18),y:ue+Math.floor(u/4)*(tt+18),z:u+1,rotate:(u%5-2)*.8},f=C[I.id]||z,b=x?.noteId===I.id;return t.jsxs("div",{onPointerDown:h=>R(h,I.id),style:{position:"absolute",left:f.x,top:f.y,width:et,minHeight:tt,padding:"18px 14px 14px",borderRadius:6,border:`1px solid ${e.groupSoftStrong}`,background:I.color||e.note,boxShadow:b?e.shadowStickyHover:e.shadowSticky,transform:`rotate(${f.rotate}deg)`,userSelect:"none",touchAction:"none",cursor:b?"grabbing":"grab",zIndex:f.z,transition:b?"none":"box-shadow 0.2s ease"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:40,height:10,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[t.jsx("h3",{style:{margin:0,fontSize:14,fontWeight:700,color:e.inkSoft,lineHeight:1.3},children:I.title}),t.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:e.inkSoft4},children:i("pinboard.noteBadge","NOTA")})]}),t.jsx("p",{style:{margin:0,fontSize:12,lineHeight:1.5,color:e.inkSoft2,whiteSpace:"pre-wrap"},children:I.description||""}),I.author&&t.jsxs("div",{style:{marginTop:12,fontSize:11,fontWeight:600,color:e.inkSoft4,textAlign:"right"},children:["- ",I.author]})]},I.id)}),k.length===0&&t.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textMuted,textAlign:"center",gap:12,opacity:.7},children:[t.jsx("div",{style:{width:60,height:60,borderRadius:"50%",background:e.headerBg,display:"grid",placeItems:"center"},children:t.jsx(H.Plus,{size:30})}),t.jsx("p",{style:{margin:0,fontSize:14},children:i("pinboard.empty","Nenhuma nota vinculada")})]})]}),t.jsx("div",{style:{padding:"14px 18px",borderTop:`1px solid ${e.borderLight}`,background:e.surface},children:t.jsxs("button",{onClick:()=>{s&&n.onAddNote?.(s.start,s.projectId)},style:{width:"100%",padding:"12px",display:"flex",alignItems:"center",justifyContent:"center",gap:8,backgroundColor:e.group,color:e.white,border:"none",borderRadius:10,fontSize:14,fontWeight:700,cursor:"pointer"},children:[t.jsx(H.Plus,{size:18})," ",i("pinboard.newBtn","Nova Nota nesta Etapa")]})})]})]})}const rn={"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"},Tt={"planning.gantt":"PROJECT PLANNING","charts.gantt.month":"Month","charts.gantt.year":"Year","charts.gantt.stepName":"STEP NAME","charts.gantt.start":"START","charts.gantt.end":"END","charts.gantt.newAction":"New Action","charts.gantt.progress":"Progress","gantt.filter.steps":"Steps","gantt.filter.milestones":"Milestones","gantt.filter.events":"Events","gantt.filter.notes":"Notes","gantt.newAction.step":"Step","gantt.newAction.milestone":"Milestone","gantt.newAction.event":"Event","gantt.newAction.note":"Note","gantt.group.step":"Steps","gantt.group.milestone":"Milestones","gantt.group.event":"Events","gantt.group.note":"Notes","gantt.tooltip.planned":"Planned","gantt.tooltip.actual":"Actual","gantt.tooltip.plannedInUse":"Planned (in use)","gantt.tooltip.start":"Start","gantt.tooltip.end":"End","gantt.tooltip.duration":"Duration","gantt.tooltip.progress":"Progress","gantt.tooltip.date":"Date","gantt.tooltip.attachments":"Attachments","gantt.popup.viewDetails":"View details","gantt.popup.edit":"Edit","gantt.popup.delete":"Delete","gantt.popup.relations":"Relations","gantt.chart.addOn":"Add on","gantt.depType.fs":"Finish to Start","gantt.depType.ss":"Start to Start","gantt.depType.ff":"Finish to Finish","gantt.depType.sf":"Start to Finish","gantt.depModal.title":"Relation Type","gantt.depModal.subtitle":"Choose how the two tasks relate","gantt.depModal.fs":"Finish to Start","gantt.depModal.fsDesc":"B starts when A finishes","gantt.depModal.ss":"Start to Start","gantt.depModal.ssDesc":"A and B start together","gantt.depModal.ff":"Finish to Finish","gantt.depModal.ffDesc":"A and B finish together","gantt.depModal.sf":"Start to Finish","gantt.depModal.sfDesc":"B finishes when A starts","gantt.depModal.lagLabel":"Lag (days)","gantt.depModal.cancel":"Cancel","gantt.depModal.create":"Create Dependency","gantt.depModal.saving":"Saving...","noteModal.titlePlaceholder":"Note title...","noteModal.contentPlaceholder":"Write your note here...","noteModal.attachFiles":"Attach files","noteModal.removeFile":"Remove","noteModal.dependency":"Dependency","noteModal.none":"None","noteModal.milestones":"Milestones","noteModal.cancel":"Cancel","noteModal.create":"Create Note","noteModal.errorEmpty":"Please provide a title or content for the note.","noteModal.errorSave":"Error creating note.","noteModal.untitled":"Untitled","pinboard.description":"Board with notes and files linked to this task.","pinboard.empty":"No linked notes","pinboard.newBtn":"New note for this task","gantt.error.circularDependency":"Circular dependency is not allowed."};function bt(n,s,r){const i=Tt[s]||r||s;return n?typeof n=="function"?n(s,i)||i:n[s]||i:i}const sn=1.6,an=140,Et=1.2,ln=1/Et,fe=n=>{const s=n.touches[0]||n.changedTouches[0];return s?{clientX:s.clientX,clientY:s.clientY}:{clientX:0,clientY:0}},vt=n=>{if(n.length<2)return 0;const s=n[0],r=n[1];return Math.hypot(r.clientX-s.clientX,r.clientY-s.clientY)},St=n=>{if(n.length<2)return n.length===1?{clientX:n[0].clientX,clientY:n[0].clientY}:{clientX:0,clientY:0};const s=n[0],r=n[1];return{clientX:(s.clientX+r.clientX)/2,clientY:(s.clientY+r.clientY)/2}},dn=n=>Math.min(an,Math.max(sn,n));function cn(n){const{onTaskChange:s,onCreateDependency:r,onDependencyError:i,dependencies:o,translations:l}=n,a=!!n.infiniteCanvas,[d,x]=g.useState("day"),[v,S]=g.useState(Xe),T=g.useRef(v),[k,C]=g.useState(null),[O,F]=g.useState(null),[R,I]=g.useState(null),[u,z]=g.useState({isOpen:!1,position:{x:0,y:0},task:null}),[f,b]=g.useState(null),[h,w]=g.useState(null),[c,D]=g.useState(null),[L,V]=g.useState(null),[m,K]=g.useState("FS"),[ee,W]=g.useState(0),[ne,_]=g.useState(!1),[Z,me]=g.useState(null),[Ie,ye]=g.useState(null),[Be,ot]=g.useState(!1),rt=g.useRef(null),[Le,st]=g.useState(null),[We,_e]=g.useState(new Set(["step","milestone","event","note"])),[$e,Me]=g.useState(new Set),[Pe,He]=g.useState(new Set);g.useEffect(()=>{T.current=v},[v]);const Oe=g.useCallback((p,y)=>a?y==="day"&&p<=7?"month":y==="month"&&p>=10?"day":y:y,[a]),it=g.useCallback(p=>{x(p),a||S(p==="day"?Xe:jt)},[a]),Ve=g.useCallback(p=>{_e(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Ge=g.useCallback(p=>{Me(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Ue=g.useCallback(p=>{He(y=>{const j=new Set(y);return j.has(p)?j.delete(p):j.add(p),j})},[]),Y=nn({steps:n.steps,milestones:n.milestones,events:n.events,notes:n.notes,dependencies:n.dependencies,viewMode:d,dayWidth:v,locale:n.locale,visibleTypes:We,collapsedGroups:$e,collapsedProjects:Pe,groupByProject:n.groupByProject,selectedTaskId:O||null}),A=Jt(Y.timeline),de=g.useCallback(p=>{const y=dn(p);return S(y),a&&x(j=>Oe(y,j)),y},[Oe,a]),ke=g.useCallback((p,y)=>{const j=A.rightBodyRef.current;if(!j){de(y);return}const M=j.getBoundingClientRect(),$=p-M.left,P=Number.isFinite($)?$:j.clientWidth/2,B=T.current||Xe,N=j.scrollLeft+P,q=de(y)/B;requestAnimationFrame(()=>{const te=A.rightBodyRef.current;te&&(te.scrollLeft=Math.max(0,N*q-P),A.timeHeaderRef.current&&(A.timeHeaderRef.current.scrollLeft=te.scrollLeft))})},[A.rightBodyRef,A.timeHeaderRef,de]),be=g.useCallback((p,y)=>{const j=A.rightBodyRef.current,M=y??(j?j.getBoundingClientRect().left+j.clientWidth/2:0);ke(M,T.current*p)},[ke,A.rightBodyRef]),ce=g.useCallback(()=>{be(Et)},[be]),ze=g.useCallback(()=>{be(ln)},[be]),Te=g.useCallback(()=>{const p=A.rightBodyRef.current;if(!p||Y.tasks.length===0)return;let y=Y.tasks[0].start,j=Y.tasks[0].end;for(const N of Y.tasks)N.start<y&&(y=N.start),N.end>j&&(j=N.end);const M=Math.max(1,we(y,j)+1),$=40,P=Math.max(80,p.clientWidth-$*2),B=de(P/M);requestAnimationFrame(()=>{const N=A.rightBodyRef.current;if(!N)return;const G=we(Y.timeline.start,y);N.scrollLeft=Math.max(0,G*B-$),N.scrollTop=0,A.leftBodyRef.current&&(A.leftBodyRef.current.scrollTop=N.scrollTop),A.timeHeaderRef.current&&(A.timeHeaderRef.current.scrollLeft=N.scrollLeft)})},[Y.tasks,Y.timeline.start,A.rightBodyRef,A.leftBodyRef,A.timeHeaderRef,de]),Ee=g.useRef(!1);g.useEffect(()=>{if(!a||!n.initialFitToScreen||Ee.current||Y.tasks.length===0)return;const p=A.rightBodyRef.current;!p||p.clientWidth<=0||(Te(),Ee.current=!0)},[a,n.initialFitToScreen,Y.tasks.length,Te,A.rightBodyRef]);const E=g.useCallback((p,y)=>{p.preventDefault(),p.stopPropagation(),b({task:y,startMouseX:p.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),U=g.useCallback((p,y)=>{p.preventDefault(),p.stopPropagation();const j=fe(p);b({task:y,startMouseX:j.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),X=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation(),w({task:y,edge:j,startMouseX:p.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),ie=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation();const M=fe(p);w({task:y,edge:j,startMouseX:M.clientX,originalStart:new Date(y.start),originalEnd:new Date(y.end),offsetDays:0})},[]),ve=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation(),D({fromTaskId:y.id,fromEdge:j,fromScreenX:p.clientX,fromScreenY:p.clientY,currentScreenX:p.clientX,currentScreenY:p.clientY,hoverTargetId:null})},[]),De=g.useCallback((p,y,j)=>{p.preventDefault(),p.stopPropagation();const M=fe(p);D({fromTaskId:y.id,fromEdge:j,fromScreenX:M.clientX,fromScreenY:M.clientY,currentScreenX:M.clientX,currentScreenY:M.clientY,hoverTargetId:null})},[]),J=g.useCallback(async()=>{if(!L||!r)return;const p=new Map(Y.tasks.map(B=>[B.id,B])),y=p.get(L.fromTaskId),j=p.get(L.toTaskId);if(!y||!j)return;const M=B=>B.originalType==="step"?"STEP":"MILESTONE",$=L.fromEdge==="right"?y:j,P=L.fromEdge==="right"?j:y;if(en(o||[],$.id,P.id)){const B=bt(l,"gantt.error.circularDependency","Circular dependency is not allowed.");i?.({code:"CYCLIC_DEPENDENCY",message:B,predecessorId:$.id,successorId:P.id}),i||window.alert(B),V(null);return}_(!0);try{await r({predecessorId:$.id,predecessorType:M($),successorId:P.id,successorType:M(P),type:m,lag:ee}),V(null)}finally{_(!1)}},[L,Y.tasks,r,o,l,i,m,ee]);g.useEffect(()=>{if(!f)return;const p={passive:!1},y=P=>{const B=P.clientX-f.startMouseX,N=Math.round(B/Y.timeline.dayWidth);N!==f.offsetDays&&b(G=>G?{...G,offsetDays:N}:null)},j=P=>{P.cancelable&&P.preventDefault();const N=fe(P).clientX-f.startMouseX,G=Math.round(N/Y.timeline.dayWidth);G!==f.offsetDays&&b(q=>q?{...q,offsetDays:G}:null)},M=()=>{f.offsetDays!==0&&s&&s({id:f.task.id,name:f.task.name,start:se(f.originalStart,f.offsetDays),end:se(f.originalEnd,f.offsetDays),type:f.task.originalType==="step"?"task":"milestone",progress:f.task.progress}),b(null)},$=()=>M();return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[f,Y.timeline.dayWidth,s]),g.useEffect(()=>{if(!h)return;const p={passive:!1},y=P=>{const B=P.clientX-h.startMouseX,N=Math.round(B/Y.timeline.dayWidth);N!==h.offsetDays&&w(G=>G?{...G,offsetDays:N}:null)},j=P=>{P.cancelable&&P.preventDefault();const N=fe(P).clientX-h.startMouseX,G=Math.round(N/Y.timeline.dayWidth);G!==h.offsetDays&&w(q=>q?{...q,offsetDays:G}:null)},M=()=>{if(h.offsetDays!==0&&s){const P=h.edge==="left"?se(h.originalStart,h.offsetDays):h.originalStart,B=h.edge==="right"?se(h.originalEnd,h.offsetDays):h.originalEnd;B>P&&s({id:h.task.id,name:h.task.name,start:P,end:B,type:"task",progress:h.task.progress})}w(null)},$=()=>M();return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[h,Y.timeline.dayWidth,s]);const Se=c?.fromTaskId,he=c?.fromEdge;g.useEffect(()=>{if(!Se||!he)return;const p={passive:!1},y=Se,j=he,M=N=>{let G=null;for(const q of document.elementsFromPoint(N.clientX,N.clientY)){const te=q.dataset?.taskId;if(te&&te!==y){G=te;break}}D(q=>q?{...q,currentScreenX:N.clientX,currentScreenY:N.clientY,hoverTargetId:G}:null)},$=N=>{N.cancelable&&N.preventDefault();const G=fe(N);let q=null;for(const te of document.elementsFromPoint(G.clientX,G.clientY)){const je=te.dataset?.taskId;if(je&&je!==y){q=je;break}}D(te=>te?{...te,currentScreenX:G.clientX,currentScreenY:G.clientY,hoverTargetId:q}:null)},P=N=>{let G=null;for(const q of document.elementsFromPoint(N.clientX,N.clientY)){const te=q.dataset?.taskId;if(te&&te!==y){G=te;break}}G&&r&&(V({fromTaskId:y,fromEdge:j,toTaskId:G}),K("FS"),W(0)),D(null)},B=N=>{const G=fe(N);let q=null;for(const te of document.elementsFromPoint(G.clientX,G.clientY)){const je=te.dataset?.taskId;if(je&&je!==y){q=je;break}}q&&r&&(V({fromTaskId:y,fromEdge:j,toTaskId:q}),K("FS"),W(0)),D(null)};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",P),document.addEventListener("touchmove",$,p),document.addEventListener("touchend",B),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",$),document.removeEventListener("touchend",B)}},[Se,he,r]);const[Q,pe]=g.useState(null),[ge,Ce]=g.useState(null),qe=g.useCallback(p=>{if(h||f||p.button===2)return;const y=A.rightBodyRef.current;y&&(p.preventDefault(),pe({startX:p.clientX,startY:p.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop}))},[h,f,A.rightBodyRef]),Ke=g.useCallback(p=>{if(h||f||c)return;const y=A.rightBodyRef.current;if(!y)return;if(a&&p.touches.length>=2){p.cancelable&&p.preventDefault(),pe(null);const M=vt(p.touches),$=St(p.touches);Ce({startDistance:Math.max(1,M),startDayWidth:T.current,centerClientY:$.clientY,startScrollTop:y.scrollTop});return}const j=fe(p);pe({startX:j.clientX,startY:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop})},[h,f,c,A.rightBodyRef,a]),Ze=g.useCallback(p=>{if(!a){A.handleChartWheel(p);return}if(!A.rightBodyRef.current)return;p.preventDefault();const j=Math.abs(p.deltaY)>0?p.deltaY:p.deltaX,M=Math.exp(-j*.0015);ke(p.clientX,T.current*M)},[a,A,ke]);g.useEffect(()=>{if(!Q)return;const p={passive:!1},y=P=>{const B=A.rightBodyRef.current;B&&(B.scrollLeft=Q.scrollLeft-(P.clientX-Q.startX),B.scrollTop=Q.scrollTop-(P.clientY-Q.startY),A.leftBodyRef.current&&(A.leftBodyRef.current.scrollTop=B.scrollTop),A.timeHeaderRef.current&&(A.timeHeaderRef.current.scrollLeft=B.scrollLeft))},j=P=>{P.cancelable&&P.preventDefault();const B=A.rightBodyRef.current;if(!B)return;const N=fe(P);B.scrollLeft=Q.scrollLeft-(N.clientX-Q.startX),B.scrollTop=Q.scrollTop-(N.clientY-Q.startY),A.leftBodyRef.current&&(A.leftBodyRef.current.scrollTop=B.scrollTop),A.timeHeaderRef.current&&(A.timeHeaderRef.current.scrollLeft=B.scrollLeft)},M=()=>pe(null),$=()=>pe(null);return document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",j,p),document.addEventListener("touchend",$),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",$)}},[Q,A.rightBodyRef,A.leftBodyRef,A.timeHeaderRef]),g.useEffect(()=>{if(!ge||!a)return;const p={passive:!1},y=M=>{if(M.touches.length<2)return;M.cancelable&&M.preventDefault();const $=A.rightBodyRef.current;if(!$)return;const P=vt(M.touches),B=St(M.touches),N=Math.max(.1,P/ge.startDistance);ke(B.clientX,ge.startDayWidth*N),$.scrollTop=ge.startScrollTop-(B.clientY-ge.centerClientY),A.leftBodyRef.current&&(A.leftBodyRef.current.scrollTop=$.scrollTop)},j=M=>{M.touches.length<2&&Ce(null)};return document.addEventListener("touchmove",y,p),document.addEventListener("touchend",j),document.addEventListener("touchcancel",j),()=>{document.removeEventListener("touchmove",y),document.removeEventListener("touchend",j),document.removeEventListener("touchcancel",j)}},[ge,a,A.rightBodyRef,A.leftBodyRef,ke]);const Je=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=M=>{const $=A.rightBodyRef.current;if(!$)return new Date;const P=$.getBoundingClientRect(),B=M-P.left+$.scrollLeft;return se(Y.timeline.start,Math.max(0,Math.floor(B/Y.timeline.dayWidth)))},j=M=>{if(!n.groupByProject)return;const $=A.leftBodyRef.current;if(!$)return;const P=$.getBoundingClientRect(),B=M-P.top+$.scrollTop,N=Math.max(0,Math.floor(B/50));for(let G=Math.min(N,Y.displayRows.length-1);G>=0;G--){const q=Y.displayRows[G];if(q.kind==="projectHeader")return q.projectId;if(q.kind==="task"&&q.task.projectId)return q.task.projectId;if(q.kind==="group"&&q.projectId)return q.projectId}};ye({x:p.clientX,y:p.clientY,date:y(p.clientX),projectId:j(p.clientY)}),pe(null)},[Y.timeline,Y.displayRows,n.groupByProject,A.rightBodyRef,A.leftBodyRef]);g.useEffect(()=>{if(!Ie)return;const p=$=>{$.key==="Escape"&&ye(null)},y=$=>{$.target.closest('[data-menu="chart-create"]')||ye(null)},j=$=>{$.target.closest('[data-menu="chart-create"]')||ye(null)},M=()=>ye(null);return document.addEventListener("keydown",p),document.addEventListener("click",y),document.addEventListener("touchstart",j),window.addEventListener("scroll",M,!0),()=>{document.removeEventListener("keydown",p),document.removeEventListener("click",y),document.removeEventListener("touchstart",j),window.removeEventListener("scroll",M,!0)}},[Ie]);const at=g.useMemo(()=>({props:n,t:(p,y)=>bt(n.translations,p,y),viewMode:d,setViewMode:it,isInfiniteCanvas:a,dayWidth:v,zoomPercent:Math.round(v/Xe*100),zoomIn:ce,zoomOut:ze,fitToScreen:Te,hoveredTaskId:k,setHoveredTaskId:C,selectedTaskId:O,setSelectedTaskId:F,tooltip:R,setTooltip:I,popupState:u,setPopupState:z,dragState:f,setDragState:b,resizeState:h,setResizeState:w,connectState:c,setConnectState:D,visibleTypes:We,setVisibleTypes:_e,toggleVisibility:Ve,collapsedGroups:$e,setCollapsedGroups:Me,toggleGroup:Ge,collapsedProjects:Pe,setCollapsedProjects:He,toggleProject:Ue,pendingConnection:L,setPendingConnection:V,depModalType:m,setDepModalType:K,depModalLag:ee,setDepModalLag:W,depCreating:ne,setDepCreating:_,deletingDepId:Z,setDeletingDepId:me,chartMenu:Ie,setChartMenu:ye,newActionOpen:Be,setNewActionOpen:ot,activePinboardTask:Le,setActivePinboardTask:st,tasks:Y.tasks,timeline:Y.timeline,displayRows:Y.displayRows,taskRowIndex:Y.taskRowIndex||new Map,arrows:Y.arrows,criticalIds:Y.criticalIds,delayedIds:Y.delayedIds,relatedIds:Y.relatedIds,...A,newActionRef:rt,screenXToDate:p=>{const y=A.rightBodyRef.current;if(!y)return new Date;const j=y.getBoundingClientRect(),M=p-j.left+y.scrollLeft;return se(Y.timeline.start,Math.max(0,Math.floor(M/Y.timeline.dayWidth)))},screenYToProjectId:p=>{if(!n.groupByProject)return;const y=A.leftBodyRef.current;if(!y)return;const j=y.getBoundingClientRect(),M=p-j.top+y.scrollTop,$=Math.max(0,Math.floor(M/50));for(let P=Math.min($,Y.displayRows.length-1);P>=0;P--){const B=Y.displayRows[P];if(B.kind==="projectHeader")return B.projectId;if(B.kind==="task"&&B.task.projectId)return B.task.projectId;if(B.kind==="group"&&B.projectId)return B.projectId}},handleChartMouseDown:qe,handleChartTouchStart:Ke,handleChartWheel:Ze,openChartMenu:Je,handleBarMouseDown:E,handleBarTouchStart:U,handleResizeMouseDown:X,handleResizeTouchStart:ie,handleConnectDotMouseDown:ve,handleConnectDotTouchStart:De,handleCreateDependency:J}),[n,d,a,v,ce,ze,Te,k,O,R,u,f,h,c,We,$e,Pe,L,m,ee,ne,Z,Ie,Be,Le,Y,A,Ve,Ge,Ue,qe,Ke,Ze,Je,E,U,X,ie,ve,De,J]);return n.loading?t.jsx("div",{role:"status","aria-live":"polite",style:{padding:48,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.textSecondary},children:t.jsx(H.Loader2,{size:32,style:{animation:"zg-spin 1.5s linear infinite",color:e.group}})}):t.jsx(Rt,{value:at,children:t.jsxs("div",{className:`zg-root ${a?"zg-root--infinite":"zg-root--framed"} ${Le?"zg-root--muted":""}`,style:{width:"100%",display:"flex",flexDirection:"column",marginLeft:"auto",marginRight:"auto",background:a?"transparent":"var(--zg-surface)",borderRadius:a?0:12,boxShadow:a?"none":"var(--zg-shadow-panel)",overflow:"hidden",height:a?"100%":"calc(100vh - 48px)",minHeight:a?0:600,border:a?"none":`1px solid ${e.borderLight}`,opacity:1,transition:"opacity 0.3s ease"},children:[t.jsx(Bt,{}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",position:"relative",background:e.surfaceAlt},children:[!n.hideSidebar&&t.jsx(Gt,{}),t.jsx(Zt,{})]}),t.jsx(on,{})]})})}const un=[{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"}],wt={FS:"Finish → Start (FS)",SS:"Start → Start (SS)",FF:"Finish → Finish (FF)",SF:"Start → Finish (SF)"};function hn({isOpen:n,onClose:s,availableMilestones:r=[],initialDate:i,translations:o,onSaveNote:l}){const a=(m,K)=>o?typeof o=="function"?o(m,K):o[m]||K:K,[d,x]=g.useState(""),[v,S]=g.useState(""),[T,k]=g.useState("#FEF08A"),[C,O]=g.useState(""),[F,R]=g.useState(""),[I,u]=g.useState("FS"),[z,f]=g.useState(!1),[b,h]=g.useState([]),[w,c]=g.useState(""),D=g.useRef(null);g.useEffect(()=>{n&&(x(""),S(""),k("#FEF08A"),O(i??new Date().toISOString().split("T")[0]),R(""),u("FS"),h([]),c(""))},[n,i]);const L=[...r.map(m=>({id:m.id,name:m.name,type:"MILESTONE"}))],V=async()=>{if(!d.trim()&&!v.trim()){c(a("noteModal.errorEmpty","Please provide a title or content for the note."));return}c("");try{f(!0),await l({title:d||a("noteModal.untitled","Untitled"),description:v,color:T,date:C?`${C}T00:00:00`:new Date().toISOString(),predecessorId:F,dependencyType:I,files:b}),s()}catch(m){console.error(m),c(a("noteModal.errorSave","Error creating note."))}finally{f(!1)}};return n?t.jsx("div",{style:{position:"fixed",inset:0,background:e.overlaySoft,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},onClick:s,children:t.jsxs("div",{onClick:m=>m.stopPropagation(),style:{width:400,maxHeight:"90vh",background:T||e.noteDefaultBg,borderRadius:4,boxShadow:"var(--zg-shadow-popover)",transform:"rotate(-1deg)",position:"relative",display:"flex",flexDirection:"column",fontFamily:"'Inter', sans-serif",overflow:"hidden",transition:"background 0.3s"},children:[t.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%)",width:64,height:16,background:e.stickyTape,borderRadius:2,boxShadow:e.shadowTiny}}),t.jsx("button",{onClick:s,style:{position:"absolute",top:10,right:10,width:24,height:24,borderRadius:"50%",background:e.groupSoftStrong,border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:14,color:e.inkMedium},onMouseEnter:m=>m.currentTarget.style.background=e.groupBorderWeak,onMouseLeave:m=>m.currentTarget.style.background=e.groupSoftStrong,children:"✕"}),t.jsxs("div",{style:{padding:"28px 24px 20px",flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:[w&&t.jsx("div",{style:{background:e.todaySoft,color:e.dangerText,padding:"8px 12px",borderRadius:6,fontSize:12,marginBottom:12,border:`1px solid ${e.todayMid}`},children:w}),t.jsx("input",{type:"text",value:d,onChange:m=>x(m.target.value),placeholder:a("noteModal.titlePlaceholder","Note title..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:20,fontWeight:800,color:e.inkStrong,lineHeight:"1.3",padding:0,margin:0,marginBottom:14,fontFamily:"inherit"}}),t.jsx("div",{style:{width:"100%",height:1,background:e.groupSoftStrong,marginBottom:14}}),t.jsx("textarea",{value:v,onChange:m=>S(m.target.value),rows:6,placeholder:a("noteModal.contentPlaceholder","Write your note here..."),style:{width:"100%",background:"transparent",border:"none",outline:"none",fontSize:14,color:e.inkMedium,lineHeight:"1.6",resize:"vertical",padding:0,margin:0,fontFamily:"inherit",flex:1,minHeight:100}}),t.jsxs("div",{style:{marginTop:14,paddingTop:10,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("input",{ref:D,type:"file",multiple:!0,onChange:m=>{const K=m.target.files?Array.from(m.target.files):[];K.length>0&&h(ee=>[...ee,...K]),D.current&&(D.current.value="")},style:{display:"none"}}),t.jsxs("button",{type:"button",onClick:()=>D.current?.click(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:6,background:e.groupSoft,border:`1px dashed ${e.groupBorderWeak}`,cursor:"pointer",fontSize:12,color:e.inkMedium,fontWeight:500,transition:"background 0.15s",width:"100%",justifyContent:"center"},onMouseEnter:m=>m.currentTarget.style.background=e.groupSoftStrong,onMouseLeave:m=>m.currentTarget.style.background=e.groupSoft,children:[t.jsx(H.Upload,{size:13}),a("noteModal.attachFiles","Attach files")]}),b.length>0&&t.jsx("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:b.map((m,K)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,background:e.surfaceFrost,fontSize:11,color:e.inkMedium},children:[t.jsx(H.Paperclip,{size:10,style:{flexShrink:0}}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.name}),t.jsxs("span",{style:{fontSize:9,color:e.inkSoft4,flexShrink:0},children:[(m.size/1024).toFixed(0),"KB"]}),t.jsx("button",{type:"button",onClick:()=>h(ee=>ee.filter((W,ne)=>ne!==K)),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:e.dangerText},title:a("noteModal.removeFile","Remove"),children:t.jsx(H.X,{size:12})})]},`file-${K}`))})]}),t.jsxs("div",{style:{marginTop:16,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`,display:"flex",alignItems:"center",justifyItems:"flex-start",justifyContent:"space-between",gap:12},children:[t.jsx("input",{type:"date",value:C,onChange:m=>O(m.target.value),style:{background:"transparent",border:"none",outline:"none",fontSize:12,color:e.inkSoft3,fontWeight:500,fontFamily:"inherit",padding:0,cursor:"pointer",width:"auto"}}),t.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:un.map(m=>t.jsx("button",{type:"button",onClick:()=>k(m.value),style:{width:22,height:22,borderRadius:"50%",border:T===m.value?`2px solid ${e.group}`:`1.5px solid ${e.groupSoftStrong}`,backgroundColor:m.value,cursor:"pointer",padding:0,transform:T===m.value?"scale(1.15)":"scale(1)",transition:"all 0.15s",boxShadow:T===m.value?e.shadowSmall:"none"},title:m.label},m.value))})]}),L.length>0&&t.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[t.jsx(H.Link2,{size:14,style:{color:e.inkSoft3}}),t.jsx("span",{style:{fontSize:11,color:e.inkSoft3,fontWeight:600},children:a("noteModal.dependency","Dependency")})]}),t.jsxs("select",{value:F,onChange:m=>R(m.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer"},children:[t.jsx("option",{value:"",children:a("noteModal.none","None")}),r.length>0&&t.jsx("optgroup",{label:a("noteModal.milestones","Milestones"),children:r.map(m=>t.jsx("option",{value:m.id,children:m.name},m.id))})]}),F&&t.jsx("select",{value:I,onChange:m=>u(m.target.value),style:{width:"100%",background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:6,fontSize:12,color:e.inkMedium,padding:"6px 8px",outline:"none",fontFamily:"inherit",cursor:"pointer",marginTop:6},children:Object.keys(wt).map(m=>t.jsx("option",{value:m,children:wt[m]},m))})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10,paddingTop:16,marginTop:12,borderTop:`1px solid ${e.groupSoftStrong}`},children:[t.jsx("button",{onClick:s,style:{padding:"8px 16px",fontSize:13,color:e.inkMedium,background:e.surfaceFrost,border:`1px solid ${e.groupSoftStrong}`,borderRadius:8,cursor:"pointer"},children:a("noteModal.cancel","Cancel")}),t.jsxs("button",{onClick:V,disabled:z,style:{padding:"8px 20px",fontSize:13,color:e.white,background:e.group,border:"none",borderRadius:8,cursor:"pointer",display:"flex",alignItems:"center",gap:6,opacity:z?.5:1},children:[z&&t.jsx(H.Loader2,{size:16,style:{animation:"zg-spin 1s linear infinite"}}),a("noteModal.create","Create Note")]})]})]})]})}):null}exports.NoteModal=hn;exports.ProjectGantt=cn;exports.enUS=Tt;exports.ptBR=rn;
|