iris-gantt 1.4.0 → 1.4.2
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/README.md +121 -7
- package/USAGE.md +33 -0
- package/dist/Gantt/Chart.d.ts +2 -2
- package/dist/Gantt/Chart.d.ts.map +1 -1
- package/dist/Gantt/DragDrop.d.ts +2 -2
- package/dist/Gantt/DragDrop.d.ts.map +1 -1
- package/dist/Gantt/Gantt.d.ts +2 -1
- package/dist/Gantt/Gantt.d.ts.map +1 -1
- package/dist/Gantt/TaskBar.d.ts.map +1 -1
- package/dist/Gantt/Timeline.d.ts +2 -2
- package/dist/Gantt/Timeline.d.ts.map +1 -1
- package/dist/Gantt/types.d.ts +58 -5
- package/dist/Gantt/types.d.ts.map +1 -1
- package/dist/gantt.css +1 -1
- package/dist/iris-gantt.js +1782 -1696
- package/dist/iris-gantt.umd.cjs +14 -14
- package/package.json +1 -1
package/dist/iris-gantt.umd.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`+
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`+
|
|
1
|
+
(function(q,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("antd"),require("@fortawesome/react-fontawesome"),require("@fortawesome/free-solid-svg-icons"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","react","antd","@fortawesome/react-fontawesome","@fortawesome/free-solid-svg-icons","dayjs"],y):(q=typeof globalThis<"u"?globalThis:q||self,y(q.IrisGantt={},q.React,q.antd,q.ReactFontawesome,q.FontAwesomeSolid,q.dayjs))})(this,(function(q,y,g,fe,ne,Ot){"use strict";var at={exports:{}},Ge={};var $t;function Qt(){if($t)return Ge;$t=1;var e=y,a=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function x(l,s,w){var p,S={},P=null,m=null;w!==void 0&&(P=""+w),s.key!==void 0&&(P=""+s.key),s.ref!==void 0&&(m=s.ref);for(p in s)i.call(s,p)&&!h.hasOwnProperty(p)&&(S[p]=s[p]);if(l&&l.defaultProps)for(p in s=l.defaultProps,s)S[p]===void 0&&(S[p]=s[p]);return{$$typeof:a,type:l,key:P,ref:m,props:S,_owner:r.current}}return Ge.Fragment=o,Ge.jsx=x,Ge.jsxs=x,Ge}var Je={};var Ct;function er(){return Ct||(Ct=1,process.env.NODE_ENV!=="production"&&(function(){var e=y,a=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),l=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),T=Symbol.iterator,M="@@iterator";function C(n){if(n===null||typeof n!="object")return null;var d=T&&n[T]||n[M];return typeof d=="function"?d:null}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(n){{for(var d=arguments.length,b=new Array(d>1?d-1:0),L=1;L<d;L++)b[L-1]=arguments[L];A("error",n,b)}}function A(n,d,b){{var L=j.ReactDebugCurrentFrame,I=L.getStackAddendum();I!==""&&(d+="%s",b=b.concat([I]));var R=b.map(function(_){return String(_)});R.unshift("Warning: "+d),Function.prototype.apply.call(console[n],console,R)}}var K=!1,k=!1,U=!1,ee=!1,F=!1,J;J=Symbol.for("react.module.reference");function X(n){return!!(typeof n=="string"||typeof n=="function"||n===i||n===h||F||n===r||n===w||n===p||ee||n===m||K||k||U||typeof n=="object"&&n!==null&&(n.$$typeof===P||n.$$typeof===S||n.$$typeof===x||n.$$typeof===l||n.$$typeof===s||n.$$typeof===J||n.getModuleId!==void 0))}function E(n,d,b){var L=n.displayName;if(L)return L;var I=d.displayName||d.name||"";return I!==""?b+"("+I+")":b}function W(n){return n.displayName||"Context"}function Q(n){if(n==null)return null;if(typeof n.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case i:return"Fragment";case o:return"Portal";case h:return"Profiler";case r:return"StrictMode";case w:return"Suspense";case p:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case l:var d=n;return W(d)+".Consumer";case x:var b=n;return W(b._context)+".Provider";case s:return E(n,n.render,"ForwardRef");case S:var L=n.displayName||null;return L!==null?L:Q(n.type)||"Memo";case P:{var I=n,R=I._payload,_=I._init;try{return Q(_(R))}catch{return null}}}return null}var oe=Object.assign,H=0,he,le,B,ue,me,ye,re;function pe(){}pe.__reactDisabledLog=!0;function Z(){{if(H===0){he=console.log,le=console.info,B=console.warn,ue=console.error,me=console.group,ye=console.groupCollapsed,re=console.groupEnd;var n={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:n,log:n,warn:n,error:n,group:n,groupCollapsed:n,groupEnd:n})}H++}}function be(){{if(H--,H===0){var n={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:oe({},n,{value:he}),info:oe({},n,{value:le}),warn:oe({},n,{value:B}),error:oe({},n,{value:ue}),group:oe({},n,{value:me}),groupCollapsed:oe({},n,{value:ye}),groupEnd:oe({},n,{value:re})})}H<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=j.ReactCurrentDispatcher,ve;function O(n,d,b){{if(ve===void 0)try{throw Error()}catch(I){var L=I.stack.trim().match(/\n( *(at )?)/);ve=L&&L[1]||""}return`
|
|
2
|
+
`+ve+n}}var c=!1,v;{var $=typeof WeakMap=="function"?WeakMap:Map;v=new $}function N(n,d){if(!n||c)return"";{var b=v.get(n);if(b!==void 0)return b}var L;c=!0;var I=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=ae.current,ae.current=null,Z();try{if(d){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(Y){L=Y}Reflect.construct(n,[],_)}else{try{_.call()}catch(Y){L=Y}n.call(_.prototype)}}else{try{throw Error()}catch(Y){L=Y}n()}}catch(Y){if(Y&&L&&typeof Y.stack=="string"){for(var z=Y.stack.split(`
|
|
3
|
+
`),ge=L.stack.split(`
|
|
4
|
+
`),te=z.length-1,ce=ge.length-1;te>=1&&ce>=0&&z[te]!==ge[ce];)ce--;for(;te>=1&&ce>=0;te--,ce--)if(z[te]!==ge[ce]){if(te!==1||ce!==1)do if(te--,ce--,ce<0||z[te]!==ge[ce]){var Se=`
|
|
5
|
+
`+z[te].replace(" at new "," at ");return n.displayName&&Se.includes("<anonymous>")&&(Se=Se.replace("<anonymous>",n.displayName)),typeof n=="function"&&v.set(n,Se),Se}while(te>=1&&ce>=0);break}}}finally{c=!1,ae.current=R,be(),Error.prepareStackTrace=I}var Oe=n?n.displayName||n.name:"",Pe=Oe?O(Oe):"";return typeof n=="function"&&v.set(n,Pe),Pe}function V(n,d,b){return N(n,!1)}function se(n){var d=n.prototype;return!!(d&&d.isReactComponent)}function G(n,d,b){if(n==null)return"";if(typeof n=="function")return N(n,se(n));if(typeof n=="string")return O(n);switch(n){case w:return O("Suspense");case p:return O("SuspenseList")}if(typeof n=="object")switch(n.$$typeof){case s:return V(n.render);case S:return G(n.type,d,b);case P:{var L=n,I=L._payload,R=L._init;try{return G(R(I),d,b)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,ie={},je=j.ReactDebugCurrentFrame;function De(n){if(n){var d=n._owner,b=G(n.type,n._source,d?d.type:null);je.setExtraStackFrame(b)}else je.setExtraStackFrame(null)}function Ve(n,d,b,L,I){{var R=Function.call.bind(de);for(var _ in n)if(R(n,_)){var z=void 0;try{if(typeof n[_]!="function"){var ge=Error((L||"React class")+": "+b+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof n[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ge.name="Invariant Violation",ge}z=n[_](d,_,L,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(te){z=te}z&&!(z instanceof Error)&&(De(I),f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",L||"React class",b,_,typeof z),De(null)),z instanceof Error&&!(z.message in ie)&&(ie[z.message]=!0,De(I),f("Failed %s type: %s",b,z.message),De(null))}}}var Ae=Array.isArray;function Fe(n){return Ae(n)}function it(n){{var d=typeof Symbol=="function"&&Symbol.toStringTag,b=d&&n[Symbol.toStringTag]||n.constructor.name||"Object";return b}}function lt(n){try{return dt(n),!1}catch{return!0}}function dt(n){return""+n}function Qe(n){if(lt(n))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",it(n)),dt(n)}var Xe=j.ReactCurrentOwner,Dt={key:!0,ref:!0,__self:!0,__source:!0},et,ke;function ct(n){if(de.call(n,"ref")){var d=Object.getOwnPropertyDescriptor(n,"ref").get;if(d&&d.isReactWarning)return!1}return n.ref!==void 0}function Ee(n){if(de.call(n,"key")){var d=Object.getOwnPropertyDescriptor(n,"key").get;if(d&&d.isReactWarning)return!1}return n.key!==void 0}function Mt(n,d){typeof n.ref=="string"&&Xe.current}function Zt(n,d){{var b=function(){et||(et=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};b.isReactWarning=!0,Object.defineProperty(n,"key",{get:b,configurable:!0})}}function Et(n,d){{var b=function(){ke||(ke=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};b.isReactWarning=!0,Object.defineProperty(n,"ref",{get:b,configurable:!0})}}var Lt=function(n,d,b,L,I,R,_){var z={$$typeof:a,type:n,key:d,ref:b,props:_,_owner:R};return z._store={},Object.defineProperty(z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(z,"_self",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.defineProperty(z,"_source",{configurable:!1,enumerable:!1,writable:!1,value:I}),Object.freeze&&(Object.freeze(z.props),Object.freeze(z)),z};function Ft(n,d,b,L,I){{var R,_={},z=null,ge=null;b!==void 0&&(Qe(b),z=""+b),Ee(d)&&(Qe(d.key),z=""+d.key),ct(d)&&(ge=d.ref,Mt(d,I));for(R in d)de.call(d,R)&&!Dt.hasOwnProperty(R)&&(_[R]=d[R]);if(n&&n.defaultProps){var te=n.defaultProps;for(R in te)_[R]===void 0&&(_[R]=te[R])}if(z||ge){var ce=typeof n=="function"?n.displayName||n.name||"Unknown":n;z&&Zt(_,ce),ge&&Et(_,ce)}return Lt(n,z,ge,I,L,Xe.current,_)}}var tt=j.ReactCurrentOwner,Ue=j.ReactDebugCurrentFrame;function Le(n){if(n){var d=n._owner,b=G(n.type,n._source,d?d.type:null);Ue.setExtraStackFrame(b)}else Ue.setExtraStackFrame(null)}var qe;qe=!1;function rt(n){return typeof n=="object"&&n!==null&&n.$$typeof===a}function ut(){{if(tt.current){var n=Q(tt.current.type);if(n)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+n+"`."}return""}}function
|
|
7
|
+
Check the render method of \``+n+"`."}return""}}function nt(n){return""}var pt={};function ht(n){{var d=ut();if(!d){var b=typeof n=="string"?n:n.displayName||n.name;b&&(d=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+b+">.")}return
|
|
9
|
+
Check the top-level render call using <`+b+">.")}return d}}function mt(n,d){{if(!n._store||n._store.validated||n.key!=null)return;n._store.validated=!0;var b=ht(d);if(pt[b])return;pt[b]=!0;var L="";n&&n._owner&&n._owner!==tt.current&&(L=" It was passed a child from "+Q(n._owner.type)+"."),Le(n),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,L),Le(null)}}function Be(n,d){{if(typeof n!="object")return;if(Fe(n))for(var b=0;b<n.length;b++){var L=n[b];rt(L)&&mt(L,d)}else if(rt(n))n._store&&(n._store.validated=!0);else if(n){var I=C(n);if(typeof I=="function"&&I!==n.entries)for(var R=I.call(n),_;!(_=R.next()).done;)rt(_.value)&&mt(_.value,d)}}}function ft(n){{var d=n.type;if(d==null||typeof d=="string")return;var b;if(typeof d=="function")b=d.propTypes;else if(typeof d=="object"&&(d.$$typeof===s||d.$$typeof===S))b=d.propTypes;else return;if(b){var L=Q(d);Ve(b,n.props,"prop",L,n)}else if(d.PropTypes!==void 0&&!qe){qe=!0;var I=Q(d);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",I||"Unknown")}typeof d.getDefaultProps=="function"&&!d.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gt(n){{for(var d=Object.keys(n.props),b=0;b<d.length;b++){var L=d[b];if(L!=="children"&&L!=="key"){Le(n),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",L),Le(null);break}}n.ref!==null&&(Le(n),f("Invalid attribute `ref` supplied to `React.Fragment`."),Le(null))}}var ot={};function xt(n,d,b,L,I,R){{var _=X(n);if(!_){var z="";(n===void 0||typeof n=="object"&&n!==null&&Object.keys(n).length===0)&&(z+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ge=nt();ge?z+=ge:z+=ut();var te;n===null?te="null":Fe(n)?te="array":n!==void 0&&n.$$typeof===a?(te="<"+(Q(n.type)||"Unknown")+" />",z=" Did you accidentally export a JSX literal instead of a component?"):te=typeof n,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",te,z)}var ce=Ft(n,d,b,I,R);if(ce==null)return ce;if(_){var Se=d.children;if(Se!==void 0)if(L)if(Fe(Se)){for(var Oe=0;Oe<Se.length;Oe++)Be(Se[Oe],n);Object.freeze&&Object.freeze(Se)}else f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Be(Se,n)}if(de.call(d,"key")){var Pe=Q(n),Y=Object.keys(d).filter(function(Ar){return Ar!=="key"}),Ie=Y.length>0?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}";if(!ot[Pe+Ie]){var kt=Y.length>0?"{"+Y.join(": ..., ")+": ...}":"{}";f(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,st,q,Nr,q),mt[q+st]=!0}}return n===i?ht(de):pt(de),de}}function Pt(n,c,b){return ft(n,c,b,!0)}function d(n,c,b){return ft(n,c,b,!1)}var v=d,N=Pt;Ke.Fragment=i,Ke.jsx=v,Ke.jsxs=N})()),Ke}var Ct;function er(){return Ct||(Ct=1,process.env.NODE_ENV==="production"?it.exports=Zt():it.exports=Qt()),it.exports}var t=er();const me=(e,a,o)=>{const i=new Date(e);switch(o){case"hour":i.setHours(i.getHours()+a);break;case"day":i.setDate(i.getDate()+a);break;case"week":i.setDate(i.getDate()+a*7);break;case"month":i.setMonth(i.getMonth()+a);break;case"quarter":i.setMonth(i.getMonth()+a*3);break;case"year":i.setFullYear(i.getFullYear()+a);break}return i},Ze=(e,a)=>{const o=a.getTime()-e.getTime();return Math.ceil(o/(1e3*60*60*24))},At=(e,a)=>{const o=a.getTime()-e.getTime();return Math.ceil(o/(1e3*60*60))},ge=(e,a)=>{const o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],f={YYYY:e.getFullYear().toString(),YY:e.getFullYear().toString().slice(-2),MMMM:i[e.getMonth()],MMM:o[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),dddd:r[e.getDay()],HH:String(e.getHours()).padStart(2,"0"),H:String(e.getHours()),mm:String(e.getMinutes()).padStart(2,"0"),m:String(e.getMinutes())};return a.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,g=>f[g])},xt=e=>{const a=e.getDay();return a===0||a===6},gt=(e,a)=>a.some(o=>o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()),Re=e=>{const a=new Date(e);return a.setHours(0,0,0,0),a},tr=e=>{const a=new Date(e);return a.setHours(23,59,59,999),a},rr=(e,a,o="day")=>{switch(o){case"hour":return At(e,a);case"day":return Ze(e,a);case"week":return Math.ceil(Ze(e,a)/7);case"month":return(a.getFullYear()-e.getFullYear())*12+(a.getMonth()-e.getMonth());default:return Ze(e,a)}};function nr(e){if(!e||typeof e!="string")return null;const a=e.trim(),o=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,i=a.match(o);if(!i)return null;const r=parseInt(i[1],10),f=i[2].toUpperCase();let g=0,l="day";if(i[3]){const s=i[4]==="-"?-1:1;switch(g=parseInt(i[5],10)*s,i[6].toLowerCase()){case"d":l="day";break;case"h":l="hour";break;case"w":l="week";break;case"m":l="month";break}}return{taskNumber:r,type:f,lag:g,lagUnit:l}}function yt(e,a){switch(a){case"hour":return e/24;case"day":return e;case"week":return e*7;case"month":return e*30;default:return e}}function or(e,a){const i={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[e.type];let r=`${a}${i}`;if(e.lag&&e.lag!==0){const f=e.lag>0?"+":"",l=(e.lagUnit||"day").charAt(0);let s=e.lag;if(e.lagUnit&&e.lagUnit!=="day")switch(e.lagUnit){case"hour":s=e.lag*24;break;case"week":s=e.lag/7;break;case"month":s=e.lag/30;break}r+=`${f}${Math.round(s)}${l}`}return r}function ar(e){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[e]}const Ue=e=>e?{popover:{backgroundColor:e.popoverBackground||"#fff",borderColor:e.popoverBorderColor||"#f0f0f0",borderRadius:e.popoverBorderRadius||"8px",boxShadow:e.popoverShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)",padding:e.popoverPadding||"0",fontFamily:e.popoverFontFamily||e.fontFamily||"inherit",fontSize:e.popoverFontSize||e.fontSize||"14px"},modal:{backgroundColor:e.modalBackground||"#fff",borderRadius:e.modalBorderRadius||"8px",borderColor:e.modalBorderColor||"#f0f0f0",boxShadow:e.modalShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)"},buttonPrimary:{backgroundColor:e.buttonPrimaryBackground||"#1677ff",color:e.buttonPrimaryColor||"#fff",borderRadius:e.buttonPrimaryBorderRadius||"6px",fontWeight:e.buttonPrimaryFontWeight||400,fontFamily:e.buttonPrimaryFontFamily||e.fontFamily||"inherit",boxShadow:"0 2px 0 rgba(5, 145, 255, 0.1)"},buttonDanger:{backgroundColor:e.buttonDangerBackground||"#ff4d4f",color:e.buttonDangerColor||"#fff",borderRadius:e.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(255, 38, 5, 0.06)"},buttonSecondary:{backgroundColor:e.buttonSecondaryBackground||"transparent",color:e.buttonSecondaryColor||"rgba(0, 0, 0, 0.88)",borderColor:e.buttonSecondaryBorderColor||"#d9d9d9",borderRadius:e.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(0, 0, 0, 0.02)"},input:{backgroundColor:e.inputBackground,borderColor:e.inputBorderColor,borderRadius:e.inputBorderRadius||"6px",fontFamily:e.inputFontFamily||e.fontFamily||"inherit",fontSize:e.inputFontSize||e.fontSize||"14px"},listItem:{hoverBackground:e.listItemHoverBackground||"#f5f5f5",selectedBackground:e.listItemSelectedBackground||"#e6f4ff",borderColor:e.listItemBorderColor||"#f0f0f0"},badge:{backgroundColor:e.badgeBackground||"#e6f4ff",borderColor:e.badgeBorderColor||"transparent",color:e.badgeColor||"#1677ff",fontSize:e.badgeFontSize||"12px",padding:e.badgePadding||"0 7px",borderRadius:e.badgeBorderRadius||"10px"},link:{color:e.linkColor||"#1677ff",hoverColor:e.linkHoverColor||"#69b1ff",fontWeight:e.linkFontWeight||400},font:{fontFamily:e.fontFamily||"inherit",fontSize:e.fontSize||"14px",fontWeight:e.fontWeight||400,lineHeight:e.lineHeight||1.5714285714285714,color:e.fontColor||"rgba(0, 0, 0, 0.88)"}}:{},{Text:Te,Paragraph:sr}=x.Typography,{Option:Ae}=x.Select,ir=({task:e,allTasks:a,links:o,onAddDependency:i,onRemoveDependency:r,onTaskUpdate:f,children:g,styleConfig:l})=>{const s=Ue(l),[w,u]=y.useState(!1),[p,L]=y.useState(null),[h,E]=y.useState("e2s"),[D,A]=y.useState("lag"),[S,k]=y.useState(0),[B,O]=y.useState(e.duration),[M,W]=y.useState(!0),G="day",T=o.find(I=>I.target===e.id),V=!!T,U=y.useMemo(()=>a.length===0?new Date:new Date(Math.min(...a.map(I=>I.start.getTime()))),[a]),j=()=>{if(p){const I=D==="lag"?S:-S,pe=yt(I,G);if(B!==e.duration&&f){const he=me(new Date(e.start),B,"day");f({...e,duration:B,end:he})}i(p,e.id,h,pe),u(!1),H()}},H=()=>{L(null),E("e2s"),A("lag"),k(0),O(e.duration)},K=()=>{T&&r&&(r(T.id),u(!1),H())},J=I=>{if(u(I),I){if(W(!0),T){L(T.source),E(T.type);const pe=T.lag||0;pe>=0?(A("lag"),k(pe)):(A("lead"),k(Math.abs(pe)))}else H();O(e.duration)}},Z=()=>{if(!M)return null;const I=h==="e2s",pe=h==="s2s",he=h==="e2e",ye=h==="s2e";let ne=0,se=0,oe="",Se=0,ce=-1;I?(ne=50,se=350,Se=250,ce=350,oe="M 250 60 L 300 60 L 300 140 L 348 140"):he?(ne=100,se=100,Se=300,ce=-1,oe="M 300 60 L 350 60 L 350 140 L 302 140"):pe?(ne=250,se=250,Se=250,ce=-1,oe="M 250 60 L 200 60 L 200 140 L 248 140"):ye&&(ne=350,se=50,Se=350,ce=250,oe="M 350 60 L 300 60 L 300 140 L 252 140");const De=p==="gantt-start-date",we=a.find(m=>m.id===p);return t.jsx("div",{style:{width:"100%",height:90,backgroundColor:"#fbfbfb",borderRadius:4,marginBottom:12,border:"1px solid #f0f0f0",position:"relative",overflow:"hidden",flexShrink:0},children:t.jsxs("svg",{viewBox:"0 0 600 200",style:{width:"100%",height:"100%"},preserveAspectRatio:"xMidYMid meet",children:[t.jsx("defs",{children:t.jsx("marker",{id:"arrowhead",markerWidth:"12",markerHeight:"9",refX:"12",refY:"4.5",orient:"auto",children:t.jsx("polygon",{points:"0 0, 12 4.5, 0 9",fill:"#8c8c8c"})})}),t.jsx("line",{x1:Se,x2:Se,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),ce!==-1&&t.jsx("line",{x1:ce,x2:ce,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),t.jsx("rect",{x:ne,y:"35",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),t.jsx("text",{x:ne+100,y:"66",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:De?"Start Date":we?`Stage ${a.indexOf(we)+1}`:"Predecessor"}),t.jsx("rect",{x:se,y:"115",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),t.jsxs("text",{x:se+100,y:"146",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:["Stage ",a.indexOf(e)+1]}),t.jsx("path",{d:oe,fill:"none",stroke:"#8c8c8c",strokeWidth:"2.5",markerEnd:"url(#arrowhead)"})]})})},fe=()=>{const I=p==="gantt-start-date",pe=a.find(se=>se.id===p);if(!p)return"Select a checklist from the list to see how it will relate to the current stage.";const he=a.indexOf(e)+1,ye=I?"Start Date":`Stage ${a.indexOf(pe)+1}`;let ne="";switch(h){case"e2s":ne=`Stage ${he} starts after ${ye} finishes`;break;case"s2s":ne=`Stage ${he} starts when ${ye} starts`;break;case"e2e":ne=`Stage ${he} finishes when ${ye} finishes`;break;case"s2e":ne=`Stage ${he} finishes when ${ye} starts`;break}if(S>0){const se=`${S} ${G}${S>1?"s":""}`;D==="lag"?ne+=` + ${se} delay`:ne+=` - ${se} overlap`}return ne+"."},xe=t.jsxs("div",{style:{width:550,backgroundColor:s.popover?.backgroundColor||"#fff",borderRadius:s.popover?.borderRadius||"8px",padding:"16px 20px",boxShadow:s.popover?.boxShadow,fontFamily:s.popover?.fontFamily},children:[t.jsx(Te,{strong:!0,style:{fontSize:"16px",display:"block",marginBottom:16,color:s.font?.color},children:"Add Dependency"}),t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[t.jsx("div",{style:{flex:1},children:t.jsxs(x.Select,{showSearch:!0,placeholder:"Select checklist",value:p,onChange:L,style:{width:"100%"},filterOption:(I,pe)=>{if(pe?.value==="gantt-start-date")return"start date".includes(I.toLowerCase());const he=a.find(ne=>ne.id===pe?.value);if(!he)return!1;const ye=a.indexOf(he)+1;return he.text.toLowerCase().includes(I.toLowerCase())||ye.toString().includes(I)},optionLabelProp:"label",children:[a.filter(I=>I.id!==e.id).map(I=>t.jsx(Ae,{value:I.id,label:I.text,children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0"},children:[t.jsxs(Te,{style:{fontSize:"13px"},children:[a.indexOf(I)+1,". ",I.text]}),t.jsxs(Te,{type:"secondary",style:{fontSize:"11px"},children:["Start: ",ge(I.start,"MMM D, YYYY")]})]})},I.id)),t.jsx(Ae,{value:"gantt-start-date",label:"Start Date",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",borderTop:"1px solid #f0f0f0",marginTop:"4px",paddingTop:"8px"},children:[t.jsx(Te,{style:{fontSize:"13px",fontWeight:600},children:"Start Date"}),t.jsx(Te,{type:"secondary",style:{fontSize:"11px"},children:ge(U,"MMM D, YYYY")})]})},"gantt-start-date")]})}),t.jsx("div",{style:{width:100},children:t.jsxs(x.Select,{value:h,onChange:E,style:{width:"100%"},children:[t.jsx(Ae,{value:"e2s",children:"FS"}),t.jsx(Ae,{value:"e2e",children:"FF"}),t.jsx(Ae,{value:"s2s",children:"SS"}),t.jsx(Ae,{value:"s2e",children:"SF"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Delay type"}),t.jsxs(x.Select,{value:D,onChange:A,style:{width:"100%"},children:[t.jsx(Ae,{value:"lag",children:"Lag by"}),t.jsx(Ae,{value:"lead",children:"Lead by"})]})]}),t.jsxs("div",{style:{flex:1},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Days"}),t.jsx(x.InputNumber,{min:0,value:S,onChange:I=>k(I||0),style:{width:"100%"},placeholder:"0"})]})]}),t.jsxs("div",{style:{marginBottom:14},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Duration (days)"}),t.jsx(x.InputNumber,{min:1,value:B,onChange:I=>O(I||1),style:{width:"100%"},placeholder:"Duration"})]}),t.jsx("div",{style:{backgroundColor:"#f5f5f5",padding:"10px 12px",borderRadius:"4px",marginBottom:14},children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"FS: Finish to Start"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"SS: Start to Start"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"FF: Finish to Finish"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"SF: Start to Finish"})]})}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[t.jsx(Te,{strong:!0,style:{fontSize:"13px",color:s.font?.color},children:"Dependency preview"}),t.jsx("a",{onClick:()=>W(!M),style:{fontSize:"12px",color:"#1890ff",cursor:"pointer",textDecoration:"none"},children:M?"Hide preview":"Show preview"})]}),M&&t.jsxs(t.Fragment,{children:[Z(),t.jsx(sr,{style:{fontSize:"12px",color:s.font?.color||"#262626",marginBottom:14,lineHeight:"1.5"},children:fe()})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[V&&t.jsx(x.Button,{danger:!0,onClick:K,style:{...s.buttonDanger},children:"Remove Dependency"}),t.jsx(x.Button,{type:"primary",onClick:j,disabled:!p,style:{...s.buttonPrimary,minWidth:100},children:V?"Update":"Add"})]})]});return t.jsx(x.Popover,{content:xe,trigger:"click",open:w,onOpenChange:J,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:g})},wt=y.memo(y.forwardRef(({tasks:e,allTasks:a=[],columns:o,selectedTask:i,onTaskClick:r,onTaskContextMenu:f,onTaskUpdate:g,onTaskDragStart:l,onAddTask:s,onAddDependency:w,onRemoveDependency:u,links:p=[],dropIndicator:L,reorderTask:h,styleConfig:E},D)=>{const A=y.useRef(null);y.useImperativeHandle(D,()=>A.current);const[S,k]=y.useState(null),[B,O]=y.useState(0),M=(T,V=0)=>{if(!T.parent)return V;const U=e.find(j=>j.id===T.parent);return U?M(U,V+1):V},W=(T,V)=>{if(V===T.duration)return;const U=me(new Date(T.start),V,"day");g?.({...T,duration:V,end:U})},G=(T,V)=>{if(V.template)return V.template(T);switch(V.name){case"text":{const U=M(T);return t.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:U*14},children:[t.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:j=>{j.preventDefault(),l?.(T.id,j.clientX,j.clientY,"reorder")},children:t.jsx(ue.FontAwesomeIcon,{icon:Q.faGripVertical})}),T.type==="project"?t.jsx("span",{className:"gantt-tree-icon",onClick:j=>{j.stopPropagation(),g?.({...T,open:!T.open})},children:t.jsx(ue.FontAwesomeIcon,{icon:T.open?Q.faChevronDown:Q.faChevronRight})}):t.jsx("span",{style:{width:16,display:"inline-block"}}),t.jsx("span",{className:"gantt-task-name-text",children:T.text})]})}case"start":return ge(T.start,"DD-MM-YYYY");case"end":return ge(T.end,"DD-MM-YYYY");case"duration":return S===T.id?t.jsx(x.InputNumber,{size:"small",min:1,value:B,onChange:j=>O(j||1),onBlur:()=>{W(T,B),k(null)},onPressEnter:()=>{W(T,B),k(null)},autoFocus:!0,style:{width:"100%",fontSize:"12px"}}):t.jsxs("div",{onClick:j=>{j.stopPropagation(),k(T.id),O(T.duration)},style:{backgroundColor:"#fff7e6",padding:"2px 8px",borderRadius:"4px",border:"1px solid #ffd591",fontWeight:400,color:"#d46b08",display:"inline-block",fontSize:"12px",cursor:"text"},children:[T.duration," day",T.duration!==1?"s":""]});case"predecessors":{const j=p.filter(H=>H.target===T.id)[0];return t.jsx(ir,{task:T,allTasks:a,links:p,onAddDependency:(H,K,J,Z)=>w?.(H,K,J,Z),onRemoveDependency:H=>u?.(H),onTaskUpdate:g,styleConfig:E,children:t.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:j?(()=>{const H=a.find(J=>J.id===j.source),K=H?a.indexOf(H)+1:0;return t.jsx("span",{style:{fontSize:"12px",backgroundColor:"#e6f4ff",border:"1px solid #91caff",color:"#1677ff",padding:"0 7px",borderRadius:"4px",whiteSpace:"nowrap"},children:or(j,K)})})():t.jsx("span",{style:{fontSize:"12px",color:"#1890ff",textDecoration:"none",fontWeight:500},onMouseEnter:H=>H.currentTarget.style.textDecoration="underline",onMouseLeave:H=>H.currentTarget.style.textDecoration="none",children:"Add"})})})}case"add":return t.jsx(x.Button,{type:"primary",size:"small",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faPlus,style:{fontSize:12}}),onClick:U=>{U.stopPropagation(),s?.(T.id)},title:"Add Subtask",style:{minWidth:"28px",width:"28px",height:"28px",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px"}});case"progress":return t.jsxs("div",{className:"gantt-progress-cell",children:[t.jsx("div",{className:"gantt-progress-bar-bg",children:t.jsx("div",{className:"gantt-progress-bar-fill",style:{width:`${T.progress}%`}})}),t.jsxs("span",{className:"gantt-progress-text",children:[T.progress,"%"]})]});case"index":return t.jsx("span",{style:{color:"#8c8c8c"},children:a.indexOf(T)+1});default:return T[V.name]||""}};return t.jsxs("div",{className:"gantt-grid",ref:A,children:[t.jsx("div",{className:"gantt-grid-header",style:{display:"flex",minWidth:"100%"},children:o.map(T=>t.jsx("div",{className:"gantt-grid-header-cell",style:{width:T.width,minWidth:T.width,justifyContent:T.align==="center"?"center":"flex-start"},children:T.name==="add"?t.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,whiteSpace:"nowrap"},children:"Add"}):t.jsxs(t.Fragment,{children:[T.label,T.name==="start"&&t.jsx(ue.FontAwesomeIcon,{icon:Q.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},T.name))}),t.jsx("div",{className:"gantt-grid-body",children:e.map(T=>{const V=h?.id===T.id,U=h?.descendantIds.includes(T.id);return t.jsxs("div",{className:`gantt-grid-row ${i===T.id?"selected":""} ${V?"dragging-row":""} ${U?"descendant-dragging-row":""} ${L?.taskId===T.id?`drop-target-${L.position}`:""}`,onClick:()=>r(T.id),onContextMenu:j=>f?.(j,T.id),style:{display:"flex",minWidth:"100%"},children:[o.map(j=>{const H=j.name==="add";return t.jsx("div",{className:"gantt-grid-cell",style:{width:j.width,minWidth:j.width,textAlign:j.align||"left",display:"flex",alignItems:"center",justifyContent:H?"center":j.name==="text"?"flex-start":j.align==="center"?"center":j.align==="right"?"flex-end":"flex-start",visibility:"visible",opacity:1},children:G(T,j)},`${T.id}-${j.name}`)}),L?.taskId===T.id&&t.jsx("div",{className:`gantt-drop-indicator ${L.position}`})]},T.id)})})]})}));wt.displayName="Grid";const _t=({task:e,position:a,selected:o,dragging:i,onClick:r,onDragStart:f,dragDeltaX:g=0,dragType:l=null,readonly:s=!1,baseline:w,dependencyRuleDescriptions:u=[],tooltipConfig:p})=>{const L=(M,W)=>{s||(M.preventDefault(),M.stopPropagation(),f(M.clientX,M.clientY,W))},h=()=>{const M=["gantt-task-bar"];return e.type==="milestone"&&M.push("milestone"),e.type==="project"&&M.push("project"),o&&M.push("selected"),i&&M.push("dragging"),e.status&&M.push(`status-${e.status}`),M.join(" ")},E=()=>{let M=a.left,W=a.width;return i&&l&&(l==="move"?M+=g:l==="resize-left"?(M+=g,W-=g):l==="resize-right"&&(W+=g)),{left:`${M}px`,width:`${Math.max(W,0)}px`,backgroundColor:e.color||void 0}},D=(M=!1)=>t.jsxs(t.Fragment,{children:[!s&&!M&&t.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:W=>L(W,"resize-left")}),!M&&e.type!=="milestone"&&t.jsx("div",{className:"gantt-task-progress",style:{width:`${e.progress}%`},children:e.progress>5&&e.progress<100&&t.jsxs("span",{className:"gantt-task-progress-text",children:[e.progress,"%"]})}),t.jsx("div",{className:"gantt-task-content",children:!M&&t.jsx("span",{className:"gantt-task-text",children:e.text})}),!s&&!M&&t.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:W=>L(W,"resize-right")})]}),A=p?.statusFormatter?p.statusFormatter(e.status):e.status?e.status.replace("-"," "):p?.emptyStatusText||"Not set",S=u.length>0?u.map(M=>p?.dependencyRuleFormatter?p.dependencyRuleFormatter(M,e):M).join(p?.dependencySeparator||" | "):p?.emptyDependencyRuleText||"No dependency rule",k=p?.progressFormatter?p.progressFormatter(e.progress,e):`${e.progress}%`,B=p?.dateFormat||"MMM D, YYYY",O=t.jsxs("div",{className:"gantt-tooltip",children:[p?.showTaskName!==!1&&t.jsx("div",{className:"gantt-tooltip-title",children:e.text}),p?.showPlannedDates!==!1&&t.jsxs("div",{className:"gantt-tooltip-dates",children:[p?.plannedLabel||"Planned",": ",ge(e.plannedStart??w?.start??e.start,B)," - ",ge(e.plannedEnd??w?.end??e.end,B)]}),p?.showActualDates!==!1&&t.jsxs("div",{className:"gantt-tooltip-dates",children:[p?.actualLabel||"Actual",": ",ge(e.actualStart??e.start,B)," - ",ge(e.actualEnd??e.end,B)]}),p?.showStatus!==!1&&t.jsxs("div",{className:"gantt-tooltip-progress",children:[p?.statusLabel||"Status",": ",A]}),p?.showOwner!==!1&&e.owner&&t.jsxs("div",{className:"gantt-tooltip-owner",children:[p?.ownerLabel||"Owner",": ",e.owner]}),p?.showDependencyRule!==!1&&t.jsxs("div",{className:"gantt-tooltip-owner",children:[p?.dependencyRuleLabel||"Dependency Rule",": ",S]}),p?.showProgress!==!1&&t.jsxs("div",{className:"gantt-tooltip-progress",children:[p?.progressLabel||"Progress",": ",k]})]});if(e.segments&&e.segments.length>0||e.onHoldPeriods&&e.onHoldPeriods.length>0){const M=e.end.getTime()-e.start.getTime(),W=e.segments&&e.segments.length>0?e.segments:[{start:e.start,end:e.end,duration:e.duration||0}];return t.jsxs("div",{className:"gantt-task-group",children:[M>0&&e.onHoldPeriods?.map((G,T)=>{const V=Math.max(G.start.getTime(),e.start.getTime()),j=Math.min(G.end.getTime(),e.end.getTime())-V;if(j<=0)return null;const H=a.left+(V-e.start.getTime())/M*a.width,K=j/M*a.width;return t.jsx("div",{className:"gantt-on-hold-period",style:{left:`${H}px`,width:`${K}px`}},`hold-${T}`)}),W.map((G,T)=>t.jsx(x.Tooltip,{title:O,mouseEnterDelay:.5,children:t.jsx("div",{className:h()+" segment",style:{left:`${M>0?a.left+(G.start.getTime()-e.start.getTime())/M*a.width:a.left}px`,width:`${M>0?(G.end.getTime()-G.start.getTime())/M*a.width:a.width}px`,backgroundColor:e.color||void 0},onClick:r,onMouseDown:V=>L(V,"move"),children:D(T>0)})},`seg-${T}`))]})}return t.jsx(x.Tooltip,{title:O,mouseEnterDelay:.5,children:t.jsx("div",{className:h(),style:E(),onClick:r,onMouseDown:M=>L(M,"move"),children:D()})})},lr=({links:e,tasks:a,getTaskPosition:o})=>{const i=y.useMemo(()=>{const l=new Map;return a.forEach(s=>l.set(s.id,s)),l},[a]),r=l=>i.get(l),f=y.useMemo(()=>{let l=0,s=0;return a.forEach(w=>{try{const u=o(w);u&&typeof u.left=="number"&&typeof u.width=="number"&&(l=Math.max(l,u.left+u.width)),u&&typeof u.top=="number"&&typeof u.height=="number"&&(s=Math.max(s,u.top+u.height))}catch(u){console.warn("Failed to position task for link rendering:",w.id,u)}}),{width:Math.max(l,1e3),height:Math.max(s,100)}},[a,o]),g=l=>{const s=r(l.source),w=r(l.target);if(!s||!w)return{path:"",arrow:""};const u=o(s),p=o(w),L=u.top+u.height/2,h=p.top+p.height/2,E={sourceStub:14,targetStub:8,detourPadding:24,minHorizontalSpan:18,arrowGap:2,arrowLength:14,arrowWidth:14,arrowStemOverlap:1,chevronNotchDepth:5};let D=0,A=0,S=1,k=1;switch(l.type){case"e2s":D=u.left+u.width,A=p.left,S=1,k=1;break;case"s2s":D=u.left,A=p.left,S=-1,k=1;break;case"e2e":D=u.left+u.width,A=p.left+p.width,S=1,k=-1;break;case"s2e":D=u.left,A=p.left+p.width,S=-1,k=-1;break}const B=D+S*E.sourceStub,O=A-k*E.arrowGap,M=O-k*E.arrowLength,W=M+k*E.chevronNotchDepth,G=W-k*E.targetStub,T=W+k*E.arrowStemOverlap,V=Math.abs(h-L)>1;let U;if(V){const fe=h>L;let xe=fe?Math.min(u.top+u.height+6,p.top-6):Math.max(u.top-6,p.top+p.height+6);Math.abs(xe-L)<2&&(xe=L+(fe?2:-2)),Math.abs(xe-h)<2&&(xe=h+(fe?-2:2)),U=[{x:D,y:L},{x:B,y:L},{x:B,y:xe},{x:G,y:xe},{x:G,y:h},{x:T,y:h}]}else{let Z;S===k&&(S===1?G-B>=E.minHorizontalSpan:B-G>=E.minHorizontalSpan)?Z=(B+G)/2:Z=S===1?Math.max(D,A)+E.detourPadding:Math.min(D,A)-E.detourPadding,U=[{x:D,y:L},{x:B,y:L},{x:Z,y:L},{x:Z,y:h},{x:G,y:h},{x:T,y:h}]}const j=U.filter((Z,fe)=>{if(fe===0)return!0;const xe=U[fe-1];return Math.abs(Z.x-xe.x)>.5||Math.abs(Z.y-xe.y)>.5}),H=j.length>0?j.map((Z,fe)=>`${fe===0?"M":"L"} ${Z.x},${Z.y}`).join(" "):"",K=E.arrowWidth/2,J=`M ${M},${h-K} L ${O},${h} L ${M},${h+K} L ${W},${h} Z`;return{path:H,arrow:J}};return e.length===0?null:t.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible",width:f.width,height:f.height,position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.map(l=>{const s=r(l.source),w=r(l.target);if(!s||!w)return null;const u=g(l),p=u.path,L=u.arrow;return!p||!L?null:t.jsxs("g",{className:"gantt-link",children:[t.jsx("path",{d:p,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),t.jsx("path",{d:L,className:"gantt-link-arrow"})]},l.id)})})},dr=(e,a,o=60,i="day",r=1)=>{const[f,g]=y.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),l=y.useCallback((u,p,L,h)=>{const E=e.find(D=>D.id===u);E&&g({taskId:u,initialX:p,initialY:L,initialStart:new Date(E.start),initialEnd:new Date(E.end),type:h,dragDeltaX:0,dragDeltaY:0})},[e]),s=y.useCallback((u,p)=>{if(!f.taskId||!f.type)return null;const L=u-f.initialX,h=p-f.initialY;if(g(B=>({...B,dragDeltaX:L,dragDeltaY:h})),f.type==="reorder")return null;const E=e.find(B=>B.id===f.taskId);if(!E)return null;const D=Math.round(L/o);let A=new Date(f.initialStart),S=new Date(f.initialEnd);switch(f.type){case"move":A=me(f.initialStart,D*r,i),S=me(f.initialEnd,D*r,i);break;case"resize-left":A=me(f.initialStart,D*r,i),A>=S&&(A=me(S,-r,i));break;case"resize-right":S=me(f.initialEnd,D*r,i),S<=A&&(S=me(A,r,i));break}const k=Ze(A,S);return{...E,start:A,end:S,duration:k}},[f,e,o,r,i]),w=y.useCallback(u=>{if(u&&a){const{id:p,...L}=u;a(p,L)}g({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[a]);return{dragState:f,handleDragStart:l,handleDrag:s,handleDragEnd:w}},bt=y.forwardRef(({tasks:e,links:a,range:o,scales:i,config:r,selectedTask:f,onTaskClick:g,onTaskDragStart:l,onTaskDragEnd:s,onTaskUpdate:w,zoomLevel:u,baselines:p,allowBaselineOnlyMode:L=!1,taskTooltipConfig:h},E)=>{const[D,A]=y.useState(e),S=(r.columnWidth||60)*u,k=r.baselines&&p&&p.size>0,B=y.useMemo(()=>{const m=new Map;return D.forEach(F=>m.set(F.id,F)),m},[D]),O=y.useMemo(()=>{const m=new Map,F={e2s:"Finish-to-Start",s2s:"Start-to-Start",e2e:"Finish-to-Finish",s2e:"Start-to-Finish"};return a.forEach(P=>{const C=B.get(P.source),ie=B.get(P.target),ae=C?.text||`Task ${P.source}`,te=ie?.text||`Task ${P.target}`,ee=F[P.type],ve=typeof P.lag=="number"&&P.lag!==0?` (${P.lag>0?"+":""}${P.lag} ${P.lagUnit||"day"})`:"",Fe=`${te} depends on ${ae} [${ee}]${ve}`,Me=m.get(P.target)||[];Me.push(Fe),m.set(P.target,Me)}),m},[a,B]),{dragState:M,handleDragStart:W,handleDrag:G,handleDragEnd:T}=dr(D,w,S,i[1].unit,i[1].step);y.useEffect(()=>{(e.length!==D.length||e.some((F,P)=>{const C=D[P];return!C||F.id!==C.id||F.start.getTime()!==C.start.getTime()||F.end.getTime()!==C.end.getTime()}))&&A(e)},[e]);const V=y.useCallback(m=>{const F=[];let P=new Date(o.start);for(;P<=o.end;)F.push({date:new Date(P),label:ge(P,m.format||"D")}),P=me(P,m.step,m.unit);return F},[o.start,o.end]),U=y.useCallback(m=>{const F=i[1],P=o.start.getTime(),ie=m.getTime()-P,te={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[F.unit]||864e5;return ie/(te*F.step)*S},[i,o.start,S]),j=m=>{const F=U(m.start),P=U(m.end);return{left:F,width:Math.max(P-F,0)}},H=m=>{const F=U(m.start),P=U(m.end);return{left:F,width:Math.max(P-F,0)}},K=m=>{const F=j(m),P=D.findIndex(te=>te.id===m.id),C=r.rowHeight||44,ie=r.taskHeight||28,ae=(C-ie)/2;return{left:F.left,width:F.width,top:P*C+ae,height:ie}},J=y.useRef(null),Z=y.useCallback(m=>{M.taskId&&M.type&&(J.current&&cancelAnimationFrame(J.current),J.current=requestAnimationFrame(()=>{const F=G(m.clientX,m.clientY);F&&A(P=>P.map(C=>C.id===F.id?F:C))}))},[M,G]),fe=y.useCallback(()=>{if(M.taskId){const m=D.find(F=>F.id===M.taskId);T(m||null),s()}},[M,D,T,s]),xe=i[1],I=y.useMemo(()=>V(xe),[V,xe]),pe=L&&D.length===0&&k,he=y.useCallback(()=>{const m=[];let F=-1,P=-1,C=0,ie="";return I.forEach(ae=>{const te=ae.date.getMonth(),ee=ae.date.getFullYear(),ve=ge(ae.date,"MMM YYYY");te!==F||ee!==P?(F!==-1&&m.push({label:ie,width:C}),F=te,P=ee,C=S,ie=ve):C+=S}),F!==-1&&m.push({label:ie,width:C}),m},[I,S]),ye=y.useCallback(()=>{const m=[];let F=-1,P=0,C=-1,ie=-1,ae="";return I.forEach(te=>{const ve=te.date.getDate()<=15?0:1,Fe=te.date.getMonth(),Me=te.date.getFullYear(),Oe=ge(te.date,"MMM"),Be=new Date(Me,Fe+1,0).getDate(),Ie=ve===0?`${Oe} 1 - 15`:`${Oe} 16 - ${Be}`;ve!==F||Fe!==C||Me!==ie?(F!==-1&&m.push({label:ae,width:P}),F=ve,C=Fe,ie=Me,P=S,ae=Ie):P+=S}),F!==-1&&m.push({label:ae,width:P}),m},[I,S]),ne=y.useMemo(()=>he(),[he]),se=y.useMemo(()=>ye(),[ye]),oe=y.useMemo(()=>I.length*S,[I.length,S]),Se=y.useMemo(()=>{const m=new Date;return m.setHours(0,0,0,0),m},[]),ce=y.useMemo(()=>{if(!r.showTodayLine)return null;const m=U(Se);return m>=-S&&m<=oe+S?Math.max(0,Math.min(m,oe)):null},[r.showTodayLine,Se,oe,S,U]),De=y.useMemo(()=>{if(r.projectStartDate)return Re(r.projectStartDate);if(e.length>0){const m=e.map(F=>F.start.getTime());return Re(new Date(Math.min(...m)))}return null},[r.projectStartDate,e]),we=y.useMemo(()=>{if(!r.showProjectStartLine||!De)return null;const m=U(De);return m>=-S&&m<=oe+S?Math.max(0,Math.min(m,oe)):null},[r.showProjectStartLine,De,oe,S,U]);return t.jsxs("div",{className:"gantt-timeline-container",ref:E,onMouseMove:Z,onMouseUp:fe,style:{width:oe,position:"relative"},children:[t.jsxs("div",{className:"gantt-timeline-header",style:{width:oe,minWidth:oe,position:"relative"},children:[ce!==null&&r.showTodayLine&&r.todayLineLabel&&r.todayLineLabel!==""&&t.jsx("div",{className:"gantt-today-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${ce}px`,transform:"translateX(-50%)",backgroundColor:r.todayLineColor||"#ff4d4f",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.todayLineLabelStyle},children:r.todayLineLabel}),we!==null&&r.showProjectStartLine&&r.projectStartLineLabel&&r.projectStartLineLabel!==""&&t.jsx("div",{className:"gantt-project-start-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${we}px`,transform:"translateX(-50%)",backgroundColor:r.projectStartLineColor||"#40a9ff",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.projectStartLineLabelStyle},children:r.projectStartLineLabel}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:oe},children:ne.map((m,F)=>t.jsx("div",{className:"gantt-timeline-cell",style:{width:m.width,minWidth:m.width,maxWidth:m.width,borderRight:F===ne.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`top-${F}`))}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:oe},children:se.map((m,F)=>t.jsx("div",{className:"gantt-timeline-cell",style:{width:m.width,minWidth:m.width,maxWidth:m.width,borderRight:F===se.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`mid-${F}`))}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:oe},children:I.map((m,F)=>{const P=r.weekends&&xt(m.date),C=r.holidays&>(m.date,r.holidays);return t.jsx("div",{className:`gantt-timeline-cell ${P?"weekend":""} ${C?"holiday":""}`,style:{width:S,minWidth:S,maxWidth:S,borderRight:F===I.length-1?"none":"var(--wx-gantt-border)"},children:m.label},`day-${F}`)})})]}),t.jsxs("div",{className:"gantt-timeline-body",style:{width:oe,position:"relative"},children:[ce!==null&&t.jsxs(t.Fragment,{children:[r.showTodayLineMarker!==!1&&(()=>{const m=r.todayLineMarkerSize||8,F=r.todayLineColor||"#ff4d4f",P=r.todayLineMarkerStyle||"triangle",C=r.todayLineOpacity!==void 0?r.todayLineOpacity:1;return P==="triangle"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ce}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m}px solid ${F}`,zIndex:7,pointerEvents:"none",opacity:C}}):P==="arrow"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ce}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m*.7}px solid ${F}`,zIndex:7,pointerEvents:"none",opacity:C}}):P==="dot"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ce}px`,top:`-${m/2}px`,transform:"translateX(-50%)",width:`${m}px`,height:`${m}px`,borderRadius:"50%",backgroundColor:F,zIndex:7,pointerEvents:"none",opacity:C}}):null})(),t.jsx("div",{className:"gantt-today-line",style:{position:"absolute",left:`${ce}px`,top:0,bottom:0,width:`${r.todayLineWidth||1}px`,backgroundColor:r.todayLineColor||"#ff4d4f",opacity:r.todayLineOpacity!==void 0?r.todayLineOpacity:1,borderLeft:r.todayLineStyle==="dashed"?`${r.todayLineWidth||1}px dashed ${r.todayLineColor||"#ff4d4f"}`:r.todayLineStyle==="dotted"?`${r.todayLineWidth||1}px dotted ${r.todayLineColor||"#ff4d4f"}`:"none",zIndex:6,pointerEvents:"none"}})]}),we!==null&&t.jsxs(t.Fragment,{children:[r.showProjectStartLineMarker!==!1&&(()=>{const m=r.projectStartLineMarkerSize||8,F=r.projectStartLineColor||"#40a9ff",P=r.projectStartLineMarkerStyle||"triangle",C=r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1;return P==="triangle"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${we}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m}px solid ${F}`,zIndex:7,pointerEvents:"none",opacity:C}}):P==="arrow"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${we}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${m}px solid transparent`,borderRight:`${m}px solid transparent`,borderBottom:`${m*.7}px solid ${F}`,zIndex:7,pointerEvents:"none",opacity:C}}):P==="dot"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${we}px`,top:`-${m/2}px`,transform:"translateX(-50%)",width:`${m}px`,height:`${m}px`,borderRadius:"50%",backgroundColor:F,zIndex:7,pointerEvents:"none",opacity:C}}):null})(),t.jsx("div",{className:"gantt-project-start-line",style:{position:"absolute",left:`${we}px`,top:0,bottom:0,width:`${r.projectStartLineWidth||1}px`,backgroundColor:r.projectStartLineColor||"#40a9ff",opacity:r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1,borderLeft:r.projectStartLineStyle==="dashed"?`${r.projectStartLineWidth||1}px dashed ${r.projectStartLineColor||"#40a9ff"}`:r.projectStartLineStyle==="dotted"?`${r.projectStartLineWidth||1}px dotted ${r.projectStartLineColor||"#40a9ff"}`:"none",zIndex:6,pointerEvents:"none"}})]}),t.jsx("div",{className:"gantt-timeline-grid",children:I.map((m,F)=>{const P=r.weekends&&xt(m.date),C=r.holidays&>(m.date,r.holidays);return t.jsx("div",{className:`gantt-timeline-grid-column ${P?"weekend":""} ${C?"holiday":""}`,style:{width:S,minWidth:S}},F)})}),a.length>0&&t.jsx(lr,{links:a,tasks:D,getTaskPosition:K}),t.jsx("div",{className:"gantt-timeline-tasks",style:{width:oe},children:pe?Array.from(p?.values()||[]).map(m=>{const F=H(m);return t.jsx("div",{className:"gantt-timeline-row baseline-only",children:t.jsx("div",{className:"gantt-baseline-bar baseline-only",style:{left:`${F.left}px`,width:`${F.width}px`},title:`Baseline: ${m.start.toLocaleDateString()} - ${m.end.toLocaleDateString()}`})},`baseline-only-${m.taskId}`)}):D.map(m=>{const F=j(m),P=k?p?.get(m.id):void 0,C=P?H(P):void 0;return t.jsxs("div",{className:"gantt-timeline-row",children:[P&&C&&t.jsx("div",{className:`gantt-baseline-bar ${m.type==="milestone"?"milestone":""}`,style:{left:`${C.left}px`,width:`${C.width}px`},title:`Baseline: ${P.start.toLocaleDateString()} - ${P.end.toLocaleDateString()}`}),t.jsx(_t,{task:m,baseline:P,dependencyRuleDescriptions:O.get(m.id)||[],tooltipConfig:h,position:F,selected:f===m.id,dragging:M.taskId===m.id,dragDeltaX:M.dragDeltaX,dragType:M.type,onClick:()=>g(m.id),onDragStart:(ie,ae,te)=>{W(m.id,ie,ae,te),l(m.id,ie,ae)},readonly:r.readonly})]},m.id)})})]})]})});bt.displayName="Timeline";const St=y.forwardRef((e,a)=>t.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:t.jsx(bt,{...e,ref:a})}));St.displayName="Chart";const{Search:cr}=x.Input,Bt=({onFilterChange:e,owners:a=[],uiConfig:o={}})=>{const[i,r]=y.useState({searchText:"",status:"all",priority:"all",owner:""}),f=s=>{const w={...i,...s};r(w),e(w)},g=()=>{const s={searchText:"",status:"all",priority:"all",owner:""};r(s),e(s)},l=i.searchText!==""||i.status!=="all"||i.priority!=="all"||i.owner!=="";return t.jsx("div",{className:"gantt-filter-container",children:t.jsxs("div",{className:"gantt-filter-bar",children:[t.jsx("div",{className:"gantt-filter-left",children:t.jsx(cr,{placeholder:o.searchPlaceholder||"Search stages...",value:i.searchText,onChange:s=>f({searchText:s.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),t.jsxs("div",{className:"gantt-filter-right",children:[t.jsx(x.Select,{value:i.status,onChange:s=>f({status:s}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:o.statusOptions?.all||"All Status"},{value:"not-started",label:o.statusOptions?.notStarted||"Not Started"},{value:"in-progress",label:o.statusOptions?.inProgress||"In Progress"},{value:"completed",label:o.statusOptions?.completed||"Completed"}]}),t.jsx(x.Select,{value:i.priority,onChange:s=>f({priority:s}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:o.priorityFilterOptions?.all||"All Priority"},{value:"low",label:o.priorityFilterOptions?.low||"Low"},{value:"medium",label:o.priorityFilterOptions?.medium||"Medium"},{value:"high",label:o.priorityFilterOptions?.high||"High"}]}),t.jsx(x.Select,{value:i.owner||void 0,onChange:s=>f({owner:s||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:o.allOwnersText||"All Owners",allowClear:!0,options:[{value:"",label:o.allOwnersText||"All Owners"},...(a||[]).map(s=>({value:s,label:s}))]}),l&&t.jsx(x.Button,{type:"default",danger:!0,icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faTimesCircle}),onClick:g,className:"gantt-filter-clear-antd",children:o.clearFiltersText||"Clear"})]})]})})},_e=(e,a)=>e?typeof e=="string"?t.jsx(ue.FontAwesomeIcon,{icon:a}):e:t.jsx(ue.FontAwesomeIcon,{icon:a}),It=({zoomLevel:e,setZoomLevel:a,onExport:o,onFilterChange:i,owners:r,onAddTask:f,uiConfig:g,iconConfig:l={},styleConfig:s})=>{const w=Ue(s),u=g.showZoomButtons!==!1,p=g.showExportButtons!==!1,L=u&&p;return t.jsxs("div",{className:"gantt-toolbar-wrapper",children:[t.jsxs("div",{className:"gantt-toolbar",children:[t.jsx("div",{className:"gantt-toolbar-left",children:t.jsx(x.Space,{size:8,children:g.showAddTaskButton!==!1&&t.jsx(x.Button,{type:"primary",icon:_e(l.addTask,Q.faPlus),onClick:()=>f?.(),style:w.buttonPrimary,children:g.addTaskButtonText||"New Stage"})})}),t.jsx("div",{className:"gantt-toolbar-right",children:t.jsxs(x.Space,{size:4,children:[u&&t.jsxs(t.Fragment,{children:[t.jsx(x.Tooltip,{title:g.zoomOutTooltip||"Zoom Out",children:t.jsx(x.Button,{icon:_e(l.zoomOut,Q.faSearchMinus),onClick:()=>a(Math.max(.5,e-.25)),style:w.buttonSecondary})}),t.jsx(x.Tooltip,{title:g.zoomInTooltip||"Zoom In",children:t.jsx(x.Button,{icon:_e(l.zoomIn,Q.faSearchPlus),onClick:()=>a(Math.min(2,e+.25)),style:w.buttonSecondary})}),t.jsx(x.Tooltip,{title:g.resetZoomTooltip||"Reset Zoom",children:t.jsx(x.Button,{icon:_e(l.resetZoom,Q.faRotateLeft),onClick:()=>a(1),style:w.buttonSecondary})})]}),L&&t.jsx(x.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),p&&t.jsxs(t.Fragment,{children:[t.jsx(x.Tooltip,{title:g.exportCSVTooltip||"Export to CSV",children:t.jsx(x.Button,{icon:_e(l.exportCSV,Q.faFileCsv),onClick:()=>o("csv"),style:w.buttonSecondary})}),t.jsx(x.Tooltip,{title:g.exportExcelTooltip||"Export to Excel",children:t.jsx(x.Button,{icon:_e(l.exportExcel,Q.faFileExcel),onClick:()=>o("excel"),style:w.buttonSecondary})}),t.jsx(x.Tooltip,{title:g.exportJSONTooltip||"Export to JSON",children:t.jsx(x.Button,{icon:_e(l.exportJSON,Q.faFileCode),onClick:()=>o("json"),style:w.buttonSecondary})}),t.jsx(x.Tooltip,{title:g.exportPDFTooltip||"Export to PDF",children:t.jsx(x.Button,{icon:_e(l.exportPDF,Q.faFilePdf),onClick:()=>o("pdf"),style:w.buttonSecondary})})]})]})})]}),g.showFilterSearch!==!1&&t.jsx(Bt,{onFilterChange:i,owners:r,uiConfig:g})]})},{Option:Xe}=x.Select,{TextArea:ur}=x.Input,Rt=({onCreateTask:e,onClose:a,uiConfig:o={},parentId:i,parentTaskName:r,styleConfig:f})=>{const[g]=x.Form.useForm(),l=Ue(f),s=w=>{const u=w.start.toDate(),p=new Date(u);p.setDate(p.getDate()+(w.duration||1)),e({text:w.text,start:u,end:p,duration:w.duration||1,progress:w.progress||0,type:w.type,color:typeof w.color=="string"?w.color:w.color?.toHexString?.()||"#4A90E2",owner:w.owner||"",priority:w.priority||"medium",details:w.details||"",parent:i},i),a()};return t.jsx(x.Modal,{title:i?(o.taskCreatorTitle||"Create Checklist")+(r?` for "${r}"`:""):o.taskCreatorTitle||"Create New Stage",open:!0,onCancel:a,onOk:()=>g.submit(),okText:o.taskCreatorOkText||"Create Stage",cancelText:o.taskCreatorCancelText||"Cancel",width:600,className:"gantt-modal-antd",styles:{content:l.modal,header:{borderBottom:`1px solid ${l.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},okButtonProps:{style:l.buttonPrimary},cancelButtonProps:{style:l.buttonSecondary},children:t.jsxs(x.Form,{form:g,layout:"vertical",onFinish:s,initialValues:{type:"task",priority:"medium",start:Ot(),duration:1,progress:0,color:"#4A90E2"},children:[t.jsx(x.Form.Item,{name:"text",label:o.taskNameLabel||"Stage Name",rules:[{required:!0,message:o.taskNameRequired||"Please enter stage name"}],children:t.jsx(x.Input,{placeholder:o.taskNamePlaceholder||"Enter stage name",autoFocus:!0,style:l.input})}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"type",label:o.typeLabel||"Type",style:{flex:1},children:t.jsxs(x.Select,{style:l.input,children:[t.jsx(Xe,{value:"task",children:o.taskTypeOptions?.task||"Stage"}),t.jsx(Xe,{value:"milestone",children:o.taskTypeOptions?.milestone||"Milestone"}),t.jsx(Xe,{value:"project",children:o.taskTypeOptions?.project||"Project"})]})}),t.jsx(x.Form.Item,{name:"priority",label:o.priorityLabel||"Priority",style:{flex:1},children:t.jsxs(x.Select,{style:l.input,children:[t.jsx(Xe,{value:"low",children:o.priorityOptions?.low||"Low"}),t.jsx(Xe,{value:"medium",children:o.priorityOptions?.medium||"Medium"}),t.jsx(Xe,{value:"high",children:o.priorityOptions?.high||"High"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"start",label:o.startDateLabel||"Start Date",style:{flex:1},children:t.jsx(x.DatePicker,{style:{width:"100%",...l.input}})}),t.jsx(x.Form.Item,{name:"duration",label:o.durationLabel||"Duration (days)",style:{flex:1},children:t.jsx(x.InputNumber,{min:0,style:{width:"100%",...l.input}})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"color",label:o.colorLabel||"Color",style:{flex:1},children:t.jsx(x.ColorPicker,{showText:!0})}),t.jsx(x.Form.Item,{name:"progress",label:o.progressLabel||"Progress (%)",style:{flex:1},children:t.jsx(x.InputNumber,{min:0,max:100,style:{width:"100%",...l.input}})})]}),t.jsx(x.Form.Item,{name:"owner",label:o.ownerLabel||"Owner",children:t.jsx(x.Input,{placeholder:o.ownerPlaceholder||"Assign to...",style:l.input})}),t.jsx(x.Form.Item,{name:"details",label:o.detailsLabel||"Details",children:t.jsx(ur,{placeholder:o.detailsPlaceholder||"Add stage description...",rows:3,style:l.input})})]})})},{Option:Ve}=x.Select,{TextArea:pr}=x.Input,{confirm:hr}=x.Modal,Yt=({task:e,onUpdate:a,onDelete:o,onClose:i,uiConfig:r={},styleConfig:f})=>{const[g]=x.Form.useForm(),l=Ue(f),s=u=>{const p=u.start.toDate(),L=new Date(p);L.setDate(L.getDate()+(u.duration||1)),a({...e,text:u.text,start:p,end:L,duration:u.duration||1,progress:u.progress||0,type:u.type,color:typeof u.color=="string"?u.color:u.color?.toHexString?.()||"#4A90E2",owner:u.owner||"",priority:u.priority||"medium",details:u.details||""}),i()},w=()=>{hr({title:r.deleteConfirmTitle?`${r.deleteConfirmTitle}: "${e.text}"?`:`Are you sure you want to delete "${e.text}"?`,icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:r.deleteConfirmContent||"This action cannot be undone.",okText:r.deleteConfirmOkText||"Yes, Delete",okType:"danger",cancelText:r.deleteConfirmCancelText||"No",onOk(){o(e.id),i()}})};return t.jsx(x.Modal,{title:r.taskEditorTitle||"Edit Stage",open:!0,onCancel:i,footer:[t.jsx(x.Button,{danger:!0,onClick:w,style:{float:"left",...l.buttonDanger},children:r.taskEditorDeleteText||"Delete"},"delete"),t.jsx(x.Button,{onClick:i,style:l.buttonSecondary,children:r.taskEditorCancelText||"Cancel"},"cancel"),t.jsx(x.Button,{type:"primary",onClick:()=>g.submit(),style:l.buttonPrimary,children:r.taskEditorSaveText||"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",styles:{content:l.modal,header:{borderBottom:`1px solid ${l.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},children:t.jsxs(x.Form,{form:g,layout:"vertical",onFinish:s,initialValues:{text:e.text,type:e.type||"task",priority:e.priority||"medium",start:Ot(e.start),duration:e.duration,progress:e.progress,color:e.color||"#4A90E2",owner:e.owner||"",details:e.details||""},children:[t.jsx(x.Form.Item,{name:"text",label:r.taskNameLabel||"Stage Name",rules:[{required:!0,message:r.taskNameRequired||"Please enter stage name"}],children:t.jsx(x.Input,{placeholder:r.taskNamePlaceholder||"Enter stage name",style:l.input})}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"type",label:r.typeLabel||"Type",style:{flex:1},children:t.jsxs(x.Select,{style:l.input,children:[t.jsx(Ve,{value:"task",children:r.taskTypeOptions?.task||"Stage"}),t.jsx(Ve,{value:"milestone",children:r.taskTypeOptions?.milestone||"Milestone"}),t.jsx(Ve,{value:"project",children:r.taskTypeOptions?.project||"Project"})]})}),t.jsx(x.Form.Item,{name:"priority",label:r.priorityLabel||"Priority",style:{flex:1},children:t.jsxs(x.Select,{style:l.input,children:[t.jsx(Ve,{value:"low",children:r.priorityOptions?.low||"Low"}),t.jsx(Ve,{value:"medium",children:r.priorityOptions?.medium||"Medium"}),t.jsx(Ve,{value:"high",children:r.priorityOptions?.high||"High"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"start",label:r.startDateLabel||"Start Date",style:{flex:1},children:t.jsx(x.DatePicker,{style:{width:"100%",...l.input}})}),t.jsx(x.Form.Item,{name:"duration",label:r.durationLabel||"Duration (days)",style:{flex:1},children:t.jsx(x.InputNumber,{min:0,style:{width:"100%",...l.input}})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(x.Form.Item,{name:"color",label:r.colorLabel||"Color",style:{flex:1},children:t.jsx(x.ColorPicker,{showText:!0})}),t.jsx(x.Form.Item,{name:"progress",label:r.progressLabel||"Progress (%)",style:{flex:1},children:t.jsx(x.InputNumber,{min:0,max:100,style:{width:"100%",...l.input}})})]}),t.jsx(x.Form.Item,{name:"owner",label:r.ownerLabel||"Owner",children:t.jsx(x.Input,{placeholder:r.ownerPlaceholder||"Assign to...",style:l.input})}),t.jsx(x.Form.Item,{name:"details",label:r.detailsLabel||"Details",children:t.jsx(pr,{placeholder:r.detailsPlaceholder||"Add stage description...",rows:3,style:l.input})})]})})},{Title:Qe,Text:Ye,Paragraph:mr}=x.Typography,{Option:Pe}=x.Select,zt=({task:e,allTasks:a,links:o,onAddDependency:i,onRemoveDependency:r,onTaskUpdate:f,onClose:g,styleConfig:l})=>{const s=Ue(l),[w,u]=y.useState(""),[p,L]=y.useState("e2s"),[h,E]=y.useState(0),[D,A]=y.useState("day"),[S,k]=y.useState(e.duration),[B,O]=y.useState(""),M=o.filter(j=>j.target===e.id),W=a.filter(j=>j.id!==e.id&&j.id!==e.parent),G=()=>{if(w){const j=yt(h,D);if(S!==e.duration&&f){const H=me(new Date(e.start),S,"day");f({...e,duration:S,end:H})}i(w,e.id,p,j),u(""),E(0),A("day")}},T=()=>{if(!B.trim())return;const j=nr(B.trim());if(!j){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
|
|
15
|
-
Example: 3FS+10d`);return}const H=j.taskNumber-1,K=a[H];if(!K){alert(`Task ${j.taskNumber} not found`);return}const J=ar(j.type),Z=yt(j.lag,j.lagUnit);i(K.id,e.id,J,Z),O("")},V=j=>{switch(j){case"e2s":return"Finish-to-Start (FS)";case"s2s":return"Start-to-Start (SS)";case"e2e":return"Finish-to-Finish (FF)";case"s2e":return"Start-to-Finish (SF)"}},U=j=>{switch(j){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}};return t.jsx(x.Modal,{title:t.jsx(Qe,{level:4,style:{margin:0,color:s.font?.color},children:"Dependency Editor"}),open:!0,onCancel:g,footer:null,width:700,styles:{content:s.modal,header:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`}},children:t.jsxs("div",{style:{padding:"8px 0"},children:[t.jsx(x.Alert,{message:"Managing dependencies helps in auto-scheduling and critical path calculation.",type:"info",showIcon:!0,style:{marginBottom:20,...s.font}}),t.jsxs("div",{style:{display:"flex",gap:20,marginBottom:24},children:[t.jsx(x.Card,{title:t.jsx(Qe,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Settings"}),size:"small",style:{flex:1,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:t.jsxs(x.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[t.jsxs("div",{children:[t.jsx(Ye,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Predecessor"}),t.jsx(x.Select,{showSearch:!0,placeholder:"Select a task",optionFilterProp:"children",style:{width:"100%",...s.input},value:w,onChange:u,children:W.map(j=>t.jsxs(Pe,{value:j.id,children:["[",a.indexOf(j)+1,"] ",j.text]},j.id))})]}),t.jsxs("div",{children:[t.jsx(Ye,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Type"}),t.jsxs(x.Select,{style:{width:"100%",...s.input},value:p,onChange:L,children:[t.jsx(Pe,{value:"e2s",children:"Finish-to-Start (FS)"}),t.jsx(Pe,{value:"s2s",children:"Start-to-Start (SS)"}),t.jsx(Pe,{value:"e2e",children:"Finish-to-Finish (FF)"}),t.jsx(Pe,{value:"s2e",children:"Start-to-Finish (SF)"})]})]}),t.jsxs("div",{style:{display:"flex",gap:12},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(Ye,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Lag/Lead"}),t.jsx(x.InputNumber,{style:{width:"100%",...s.input},value:h,onChange:j=>E(j||0)})]}),t.jsxs("div",{style:{flex:1},children:[t.jsx(Ye,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Units"}),t.jsxs(x.Select,{style:{width:"100%",...s.input},value:D,onChange:A,children:[t.jsx(Pe,{value:"day",children:"Days"}),t.jsx(Pe,{value:"hour",children:"Hours"}),t.jsx(Pe,{value:"week",children:"Weeks"}),t.jsx(Pe,{value:"month",children:"Months"})]})]})]}),t.jsxs("div",{children:[t.jsx(Ye,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Duration (days)"}),t.jsx(x.InputNumber,{style:{width:"100%",...s.input},min:1,value:S,onChange:j=>k(j||1)})]}),t.jsx(x.Button,{type:"primary",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faPlus,style:{marginRight:8}}),block:!0,onClick:G,disabled:!w,style:{height:40,marginTop:8,...s.buttonPrimary},children:"Add Dependency"})]})}),t.jsxs(x.Card,{title:t.jsx(Qe,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Quick Add"}),size:"small",style:{width:250,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:[t.jsxs(mr,{type:"secondary",style:{fontSize:12,marginBottom:16,color:s.font?.color,opacity:.7},children:["Format: [TaskNumber][Type][+/-][Lag][Unit]",t.jsx("br",{}),"Example: 3FS+10d"]}),t.jsx(x.Input,{placeholder:"e.g. 5FS+2d",value:B,onChange:j=>O(j.target.value),onPressEnter:T,style:{marginBottom:16,height:40,...s.input}}),t.jsx(x.Button,{block:!0,onClick:T,style:{height:40,...s.buttonSecondary},children:"Apply"})]})]}),t.jsx(x.Divider,{style:{margin:"0 0 24px 0",borderColor:s.modal?.borderColor}}),t.jsxs("div",{style:{maxHeight:300,overflowY:"auto"},children:[t.jsx(Qe,{level:5,style:{fontSize:14,marginBottom:16,color:s.font?.color},children:"Current Dependencies"}),t.jsx(x.List,{dataSource:M,locale:{emptyText:t.jsx(Ye,{type:"secondary",style:{color:s.font?.color,opacity:.5},children:"No dependencies added yet."})},renderItem:j=>{const H=a.find(K=>K.id===j.source);return t.jsx(x.List.Item,{style:{padding:"12px 16px",background:"#fafafa",borderRadius:8,marginBottom:12,border:`1px solid ${s.listItem?.borderColor||"#f0f0f0"}`},actions:[t.jsx(x.Button,{type:"text",danger:!0,icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faTrash}),onClick:()=>r(j.id)},"delete")],children:t.jsx(x.List.Item.Meta,{avatar:t.jsx("div",{style:{width:32,height:32,borderRadius:16,background:"#1890ff",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:12,fontWeight:"bold"},children:H?a.indexOf(H)+1:"?"}),title:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx("span",{style:{fontWeight:600,color:s.font?.color},children:H?.text||"Unknown Task"}),t.jsx(x.Tag,{color:U(j.type),style:{margin:0},children:V(j.type)})]}),description:t.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,marginTop:4},children:t.jsxs("span",{style:{fontSize:12,color:s.font?.color,opacity:.7},children:[t.jsx(ue.FontAwesomeIcon,{icon:Q.faLink,style:{marginRight:6}}),"Lag: ",j.lag||0," days"]})})})})}})]}),t.jsxs("div",{style:{marginTop:24,padding:"16px",background:"#fff7e6",borderRadius:8,border:"1px solid #ffe7ba"},children:[t.jsxs(Qe,{level:5,style:{fontSize:13,marginBottom:8,display:"flex",alignItems:"center"},children:[t.jsx(ue.FontAwesomeIcon,{icon:Q.faInfoCircle,style:{marginRight:8,color:"#fa8c16"}}),"Coming soon"]}),t.jsx(Ye,{style:{fontSize:12,color:"rgba(0,0,0,0.65)"},children:"Dependency visualization on the chart and automatic lag calculations based on working hours."})]})]})})},fr=({x:e,y:a,task:o,onEdit:i,onDelete:r,onCopy:f,onDependencies:g,onConvertToMilestone:l,onConvertToTask:s,onConvertToProject:w,onAutoSchedule:u,onClose:p,styleConfig:L})=>{const h=Ue(L);if(!o)return null;const E=[{key:"edit",label:"Edit",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faEdit}),onClick:()=>{i(),p()}},{key:"copy",label:"Copy",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faCopy}),onClick:()=>{f(),p()}},{key:"dependencies",label:"Dependencies",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faLink}),onClick:()=>{g(),p()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faFlag}),disabled:o.type==="milestone",onClick:()=>{l(),p()}},{key:"task",label:"Task",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faTasks}),disabled:o.type==="task",onClick:()=>{s(),p()}},{key:"project",label:"Project",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faFolder}),disabled:o.type==="project",onClick:()=>{w(),p()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faRotateLeft}),onClick:()=>{u?.(),p()}},{type:"divider"},{key:"delete",label:"Delete",icon:t.jsx(ue.FontAwesomeIcon,{icon:Q.faTrash}),danger:!0,onClick:()=>{r(),p()}}];return t.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${e}px`,top:`${a}px`,zIndex:1e4},onClick:D=>D.stopPropagation(),children:t.jsx(x.Menu,{items:E,style:{boxShadow:h.popover?.boxShadow||"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:h.popover?.borderRadius||"6px",border:`1px solid ${h.popover?.borderColor||"#e0e0e0"}`,backgroundColor:h.popover?.backgroundColor,color:h.font?.color,fontFamily:h.font?.fontFamily}})})},Wt=(e,a=[])=>{const[o,i]=y.useState([]),[r,f]=y.useState(-1),[g,l]=y.useState(e),[s,w]=y.useState(a);y.useEffect(()=>{l(e)},[e]),y.useEffect(()=>{w(a)},[a]);const u=y.useCallback((k,B,O)=>{const M={type:k,before:B,after:O,timestamp:Date.now()},W=o.slice(0,r+1);W.push(M),W.length>50?W.shift():f(r+1),i(W)},[o,r]),p=y.useCallback(()=>{if(r<0)return;const k=o[r];l(k.before.tasks),w(k.before.links),f(r-1)},[o,r]),L=y.useCallback(()=>{if(r>=o.length-1)return;const k=o[r+1];l(k.after.tasks),w(k.after.links),f(r+1)},[o,r]),h=r>=0,E=r<o.length-1,D=y.useCallback(k=>{const B={tasks:g,links:s},O=g.map(W=>W.id===k.id?k:W);u("task_update",B,{tasks:O,links:s}),l(O)},[g,s,u]),A=y.useCallback(k=>{const B={tasks:g,links:s},O=[...g,k];u("task_create",B,{tasks:O,links:s}),l(O)},[g,s,u]),S=y.useCallback(k=>{const B={tasks:g,links:s},O=g.filter(G=>G.id!==k),M=s.filter(G=>G.source!==k&&G.target!==k);u("task_delete",B,{tasks:O,links:M}),l(O),w(M)},[g,s,u]);return{tasks:g,links:s,setTasks:l,setLinks:w,undo:p,redo:L,canUndo:h,canRedo:E,updateTask:D,createTask:A,deleteTask:S,saveState:u,history:o}},Ht=(e,a,o={mode:"forward"})=>{const i=new Map,r=new Map;return e.forEach(f=>{i.set(f.id,[]),r.set(f.id,[])}),a.forEach(f=>{f.type==="e2s"&&(i.get(f.target)?.push(f.source),r.get(f.source)?.push(f.target))}),o.mode==="forward"?xr(e,i,o):gr(e,r,o)},xr=(e,a,o)=>{const i=new Map,r=new Set,f=o.projectStart||new Date,g=l=>{if(r.has(l))return;const s=e.find(E=>E.id===l);if(!s)return;const w=a.get(l)||[];w.forEach(E=>g(E));let u=f;w.forEach(E=>{const D=i.get(E);D&&D.end>u&&(u=new Date(D.end))});const p=new Date(u),L=me(p,s.duration,"day"),h={...s,start:p,end:L};i.set(l,h),r.add(l)};return e.forEach(l=>g(l.id)),e.map(l=>i.get(l.id)||l)},gr=(e,a,o)=>{const i=new Map,r=new Set,f=o.projectEnd||new Date(Math.max(...e.map(l=>l.end.getTime()))),g=l=>{if(r.has(l))return;const s=e.find(E=>E.id===l);if(!s)return;const w=a.get(l)||[];w.forEach(E=>g(E));let u=f;w.forEach(E=>{const D=i.get(E);D&&D.start<u&&(u=new Date(D.start))});const p=new Date(u),L=me(p,-s.duration,"day"),h={...s,start:L,end:p};i.set(l,h),r.add(l)};return e.forEach(l=>g(l.id)),e.map(l=>i.get(l.id)||l)},yr=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:Ht,levelResources:e=>{const a=new Map;e.forEach(i=>{i.owner&&(a.has(i.owner)||a.set(i.owner,[]),a.get(i.owner).push(i))});const o=[...e];return a.forEach(i=>{const r=i.sort((f,g)=>f.start.getTime()-g.start.getTime());for(let f=1;f<r.length;f++){const g=r[f],l=r[f-1];if(g.start<l.end){const s=o.findIndex(w=>w.id===g.id);if(s>=0){const w=new Date(l.end),u=me(w,g.duration,"day");o[s]={...g,start:w,end:u}}}}}),o}},Symbol.toStringTag,{value:"Module"})),Ut=e=>{const a=new Map;return e.forEach(o=>{a.set(o.id,{taskId:o.id,start:new Date(o.start),end:new Date(o.end)})}),a},Xt=e=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],o=e.map(r=>[r.id,r.text,ge(r.start,"YYYY-MM-DD"),ge(r.end,"YYYY-MM-DD"),r.duration.toString(),`${r.progress}%`,r.type||"task",r.owner||"",r.priority||"medium"]),i=[a.join(","),...o.map(r=>r.map(f=>`"${f}"`).join(","))].join(`
|
|
16
|
-
`);
|
|
17
|
-
`);
|
|
14
|
+
<%s key={someKey} {...props} />`,Ie,Pe,kt,Pe),ot[Pe+Ie]=!0}}return n===i?gt(ce):ft(ce),ce}}function Pt(n,d,b){return xt(n,d,b,!0)}function Nt(n,d,b){return xt(n,d,b,!1)}var u=Nt,D=Pt;Je.Fragment=i,Je.jsx=u,Je.jsxs=D})()),Je}var At;function tr(){return At||(At=1,process.env.NODE_ENV==="production"?at.exports=Qt():at.exports=er()),at.exports}var t=tr();const xe=(e,a,o)=>{const i=new Date(e);switch(o){case"hour":i.setHours(i.getHours()+a);break;case"day":i.setDate(i.getDate()+a);break;case"week":i.setDate(i.getDate()+a*7);break;case"month":i.setMonth(i.getMonth()+a);break;case"quarter":i.setMonth(i.getMonth()+a*3);break;case"year":i.setFullYear(i.getFullYear()+a);break}return i},ze=(e,a)=>{const o=a.getTime()-e.getTime();return Math.ceil(o/(1e3*60*60*24))},_t=(e,a)=>{const o=a.getTime()-e.getTime();return Math.ceil(o/(1e3*60*60))},we=(e,a)=>{const o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h={YYYY:e.getFullYear().toString(),YY:e.getFullYear().toString().slice(-2),MMMM:i[e.getMonth()],MMM:o[e.getMonth()],MM:String(e.getMonth()+1).padStart(2,"0"),M:String(e.getMonth()+1),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),dddd:r[e.getDay()],HH:String(e.getHours()).padStart(2,"0"),H:String(e.getHours()),mm:String(e.getMinutes()).padStart(2,"0"),m:String(e.getMinutes())};return a.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|HH|H|mm|m/g,x=>h[x])},yt=e=>{const a=e.getDay();return a===0||a===6},wt=(e,a)=>a.some(o=>o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()),_e=e=>{const a=new Date(e);return a.setHours(0,0,0,0),a},rr=e=>{const a=new Date(e);return a.setHours(23,59,59,999),a},nr=(e,a,o="day")=>{switch(o){case"hour":return _t(e,a);case"day":return ze(e,a);case"week":return Math.ceil(ze(e,a)/7);case"month":return(a.getFullYear()-e.getFullYear())*12+(a.getMonth()-e.getMonth());default:return ze(e,a)}};function or(e){if(!e||typeof e!="string")return null;const a=e.trim(),o=/^(\d+)(FS|SS|FF|SF)(([+-])(\d+)([dhwm]))?$/i,i=a.match(o);if(!i)return null;const r=parseInt(i[1],10),h=i[2].toUpperCase();let x=0,l="day";if(i[3]){const s=i[4]==="-"?-1:1;switch(x=parseInt(i[5],10)*s,i[6].toLowerCase()){case"d":l="day";break;case"h":l="hour";break;case"w":l="week";break;case"m":l="month";break}}return{taskNumber:r,type:h,lag:x,lagUnit:l}}function bt(e,a){switch(a){case"hour":return e/24;case"day":return e;case"week":return e*7;case"month":return e*30;default:return e}}function ar(e,a){const i={e2s:"FS",s2s:"SS",e2e:"FF",s2e:"SF"}[e.type];let r=`${a}${i}`;if(e.lag&&e.lag!==0){const h=e.lag>0?"+":"",l=(e.lagUnit||"day").charAt(0);let s=e.lag;if(e.lagUnit&&e.lagUnit!=="day")switch(e.lagUnit){case"hour":s=e.lag*24;break;case"week":s=e.lag/7;break;case"month":s=e.lag/30;break}r+=`${h}${Math.round(s)}${l}`}return r}function sr(e){return{FS:"e2s",SS:"s2s",FF:"e2e",SF:"s2e"}[e]}const Ye=e=>e?{popover:{backgroundColor:e.popoverBackground||"#fff",borderColor:e.popoverBorderColor||"#f0f0f0",borderRadius:e.popoverBorderRadius||"8px",boxShadow:e.popoverShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)",padding:e.popoverPadding||"0",fontFamily:e.popoverFontFamily||e.fontFamily||"inherit",fontSize:e.popoverFontSize||e.fontSize||"14px"},modal:{backgroundColor:e.modalBackground||"#fff",borderRadius:e.modalBorderRadius||"8px",borderColor:e.modalBorderColor||"#f0f0f0",boxShadow:e.modalShadow||"0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)"},buttonPrimary:{backgroundColor:e.buttonPrimaryBackground||"#1677ff",color:e.buttonPrimaryColor||"#fff",borderRadius:e.buttonPrimaryBorderRadius||"6px",fontWeight:e.buttonPrimaryFontWeight||400,fontFamily:e.buttonPrimaryFontFamily||e.fontFamily||"inherit",boxShadow:"0 2px 0 rgba(5, 145, 255, 0.1)"},buttonDanger:{backgroundColor:e.buttonDangerBackground||"#ff4d4f",color:e.buttonDangerColor||"#fff",borderRadius:e.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(255, 38, 5, 0.06)"},buttonSecondary:{backgroundColor:e.buttonSecondaryBackground||"transparent",color:e.buttonSecondaryColor||"rgba(0, 0, 0, 0.88)",borderColor:e.buttonSecondaryBorderColor||"#d9d9d9",borderRadius:e.buttonPrimaryBorderRadius||"6px",boxShadow:"0 2px 0 rgba(0, 0, 0, 0.02)"},input:{backgroundColor:e.inputBackground,borderColor:e.inputBorderColor,borderRadius:e.inputBorderRadius||"6px",fontFamily:e.inputFontFamily||e.fontFamily||"inherit",fontSize:e.inputFontSize||e.fontSize||"14px"},listItem:{hoverBackground:e.listItemHoverBackground||"#f5f5f5",selectedBackground:e.listItemSelectedBackground||"#e6f4ff",borderColor:e.listItemBorderColor||"#f0f0f0"},badge:{backgroundColor:e.badgeBackground||"#e6f4ff",borderColor:e.badgeBorderColor||"transparent",color:e.badgeColor||"#1677ff",fontSize:e.badgeFontSize||"12px",padding:e.badgePadding||"0 7px",borderRadius:e.badgeBorderRadius||"10px"},link:{color:e.linkColor||"#1677ff",hoverColor:e.linkHoverColor||"#69b1ff",fontWeight:e.linkFontWeight||400},font:{fontFamily:e.fontFamily||"inherit",fontSize:e.fontSize||"14px",fontWeight:e.fontWeight||400,lineHeight:e.lineHeight||1.5714285714285714,color:e.fontColor||"rgba(0, 0, 0, 0.88)"}}:{},{Text:Te,Paragraph:ir}=g.Typography,{Option:$e}=g.Select,lr=({task:e,allTasks:a,links:o,onAddDependency:i,onRemoveDependency:r,onTaskUpdate:h,children:x,styleConfig:l})=>{const s=Ye(l),[w,p]=y.useState(!1),[S,P]=y.useState(null),[m,T]=y.useState("e2s"),[M,C]=y.useState("lag"),[j,f]=y.useState(0),[A,K]=y.useState(e.duration),[k,U]=y.useState(!0),ee="day",F=o.find(B=>B.target===e.id),J=!!F,X=y.useMemo(()=>a.length===0?new Date:new Date(Math.min(...a.map(B=>B.start.getTime()))),[a]),E=()=>{if(S){const B=M==="lag"?j:-j,ue=bt(B,ee);if(A!==e.duration&&h){const me=xe(new Date(e.start),A,"day");h({...e,duration:A,end:me})}i(S,e.id,m,ue),p(!1),W()}},W=()=>{P(null),T("e2s"),C("lag"),f(0),K(e.duration)},Q=()=>{F&&r&&(r(F.id),p(!1),W())},oe=B=>{if(p(B),B){if(U(!0),F){P(F.source),T(F.type);const ue=F.lag||0;ue>=0?(C("lag"),f(ue)):(C("lead"),f(Math.abs(ue)))}else W();K(e.duration)}},H=()=>{if(!k)return null;const B=m==="e2s",ue=m==="s2s",me=m==="e2e",ye=m==="s2e";let re=0,pe=0,Z="",be=0,ae=-1;B?(re=50,pe=350,be=250,ae=350,Z="M 250 60 L 300 60 L 300 140 L 348 140"):me?(re=100,pe=100,be=300,ae=-1,Z="M 300 60 L 350 60 L 350 140 L 302 140"):ue?(re=250,pe=250,be=250,ae=-1,Z="M 250 60 L 200 60 L 200 140 L 248 140"):ye&&(re=350,pe=50,be=350,ae=250,Z="M 350 60 L 300 60 L 300 140 L 252 140");const ve=S==="gantt-start-date",O=a.find(c=>c.id===S);return t.jsx("div",{style:{width:"100%",height:90,backgroundColor:"#fbfbfb",borderRadius:4,marginBottom:12,border:"1px solid #f0f0f0",position:"relative",overflow:"hidden",flexShrink:0},children:t.jsxs("svg",{viewBox:"0 0 600 200",style:{width:"100%",height:"100%"},preserveAspectRatio:"xMidYMid meet",children:[t.jsx("defs",{children:t.jsx("marker",{id:"arrowhead",markerWidth:"12",markerHeight:"9",refX:"12",refY:"4.5",orient:"auto",children:t.jsx("polygon",{points:"0 0, 12 4.5, 0 9",fill:"#8c8c8c"})})}),t.jsx("line",{x1:be,x2:be,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),ae!==-1&&t.jsx("line",{x1:ae,x2:ae,y1:"0",y2:"200",stroke:"#f0f0f0",strokeDasharray:"3,3"}),t.jsx("rect",{x:re,y:"35",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),t.jsx("text",{x:re+100,y:"66",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:ve?"Start Date":O?`Stage ${a.indexOf(O)+1}`:"Predecessor"}),t.jsx("rect",{x:pe,y:"115",width:"200",height:"50",rx:"4",fill:"#e6f4ff",stroke:"#91caff",strokeWidth:"2"}),t.jsxs("text",{x:pe+100,y:"146",fontSize:"15",textAnchor:"middle",fill:"#003a8c",fontWeight:"600",children:["Stage ",a.indexOf(e)+1]}),t.jsx("path",{d:Z,fill:"none",stroke:"#8c8c8c",strokeWidth:"2.5",markerEnd:"url(#arrowhead)"})]})})},he=()=>{const B=S==="gantt-start-date",ue=a.find(pe=>pe.id===S);if(!S)return"Select a checklist from the list to see how it will relate to the current stage.";const me=a.indexOf(e)+1,ye=B?"Start Date":`Stage ${a.indexOf(ue)+1}`;let re="";switch(m){case"e2s":re=`Stage ${me} starts after ${ye} finishes`;break;case"s2s":re=`Stage ${me} starts when ${ye} starts`;break;case"e2e":re=`Stage ${me} finishes when ${ye} finishes`;break;case"s2e":re=`Stage ${me} finishes when ${ye} starts`;break}if(j>0){const pe=`${j} ${ee}${j>1?"s":""}`;M==="lag"?re+=` + ${pe} delay`:re+=` - ${pe} overlap`}return re+"."},le=t.jsxs("div",{style:{width:550,backgroundColor:s.popover?.backgroundColor||"#fff",borderRadius:s.popover?.borderRadius||"8px",padding:"16px 20px",boxShadow:s.popover?.boxShadow,fontFamily:s.popover?.fontFamily},children:[t.jsx(Te,{strong:!0,style:{fontSize:"16px",display:"block",marginBottom:16,color:s.font?.color},children:"Add Dependency"}),t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[t.jsx("div",{style:{flex:1},children:t.jsxs(g.Select,{showSearch:!0,placeholder:"Select checklist",value:S,onChange:P,style:{width:"100%"},filterOption:(B,ue)=>{if(ue?.value==="gantt-start-date")return"start date".includes(B.toLowerCase());const me=a.find(re=>re.id===ue?.value);if(!me)return!1;const ye=a.indexOf(me)+1;return me.text.toLowerCase().includes(B.toLowerCase())||ye.toString().includes(B)},optionLabelProp:"label",children:[a.filter(B=>B.id!==e.id).map(B=>t.jsx($e,{value:B.id,label:B.text,children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0"},children:[t.jsxs(Te,{style:{fontSize:"13px"},children:[a.indexOf(B)+1,". ",B.text]}),t.jsxs(Te,{type:"secondary",style:{fontSize:"11px"},children:["Start: ",we(B.start,"MMM D, YYYY")]})]})},B.id)),t.jsx($e,{value:"gantt-start-date",label:"Start Date",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",borderTop:"1px solid #f0f0f0",marginTop:"4px",paddingTop:"8px"},children:[t.jsx(Te,{style:{fontSize:"13px",fontWeight:600},children:"Start Date"}),t.jsx(Te,{type:"secondary",style:{fontSize:"11px"},children:we(X,"MMM D, YYYY")})]})},"gantt-start-date")]})}),t.jsx("div",{style:{width:100},children:t.jsxs(g.Select,{value:m,onChange:T,style:{width:"100%"},children:[t.jsx($e,{value:"e2s",children:"FS"}),t.jsx($e,{value:"e2e",children:"FF"}),t.jsx($e,{value:"s2s",children:"SS"}),t.jsx($e,{value:"s2e",children:"SF"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginBottom:14},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Delay type"}),t.jsxs(g.Select,{value:M,onChange:C,style:{width:"100%"},children:[t.jsx($e,{value:"lag",children:"Lag by"}),t.jsx($e,{value:"lead",children:"Lead by"})]})]}),t.jsxs("div",{style:{flex:1},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Days"}),t.jsx(g.InputNumber,{min:0,value:j,onChange:B=>f(B||0),style:{width:"100%"},placeholder:"0"})]})]}),t.jsxs("div",{style:{marginBottom:14},children:[t.jsx(Te,{style:{fontSize:"12px",display:"block",marginBottom:6,color:s.font?.color},children:"Duration (days)"}),t.jsx(g.InputNumber,{min:1,value:A,onChange:B=>K(B||1),style:{width:"100%"},placeholder:"Duration"})]}),t.jsx("div",{style:{backgroundColor:"#f5f5f5",padding:"10px 12px",borderRadius:"4px",marginBottom:14},children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"FS: Finish to Start"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"SS: Start to Start"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"FF: Finish to Finish"}),t.jsx(Te,{style:{fontSize:"11px",color:s.font?.color},children:"SF: Start to Finish"})]})}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[t.jsx(Te,{strong:!0,style:{fontSize:"13px",color:s.font?.color},children:"Dependency preview"}),t.jsx("a",{onClick:()=>U(!k),style:{fontSize:"12px",color:"#1890ff",cursor:"pointer",textDecoration:"none"},children:k?"Hide preview":"Show preview"})]}),k&&t.jsxs(t.Fragment,{children:[H(),t.jsx(ir,{style:{fontSize:"12px",color:s.font?.color||"#262626",marginBottom:14,lineHeight:"1.5"},children:he()})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[J&&t.jsx(g.Button,{danger:!0,onClick:Q,style:{...s.buttonDanger},children:"Remove Dependency"}),t.jsx(g.Button,{type:"primary",onClick:E,disabled:!S,style:{...s.buttonPrimary,minWidth:100},children:J?"Update":"Add"})]})]});return t.jsx(g.Popover,{content:le,trigger:"click",open:w,onOpenChange:oe,placement:"bottomLeft",overlayClassName:"dependency-popover",overlayInnerStyle:{padding:0},children:x})},St=y.memo(y.forwardRef(({tasks:e,allTasks:a=[],columns:o,selectedTask:i,onTaskClick:r,onTaskContextMenu:h,onTaskUpdate:x,onTaskDragStart:l,onAddTask:s,onAddDependency:w,onRemoveDependency:p,links:S=[],dropIndicator:P,reorderTask:m,styleConfig:T},M)=>{const C=y.useRef(null);y.useImperativeHandle(M,()=>C.current);const[j,f]=y.useState(null),[A,K]=y.useState(0),k=(F,J=0)=>{if(!F.parent)return J;const X=e.find(E=>E.id===F.parent);return X?k(X,J+1):J},U=(F,J)=>{if(J===F.duration)return;const X=xe(new Date(F.start),J,"day");x?.({...F,duration:J,end:X})},ee=(F,J)=>{if(J.template)return J.template(F);switch(J.name){case"text":{const X=k(F);return t.jsxs("div",{className:"gantt-grid-cell-text",style:{paddingLeft:X*14},children:[t.jsx("div",{className:"gantt-row-drag-handle",onMouseDown:E=>{E.preventDefault(),l?.(F.id,E.clientX,E.clientY,"reorder")},children:t.jsx(fe.FontAwesomeIcon,{icon:ne.faGripVertical})}),F.type==="project"?t.jsx("span",{className:"gantt-tree-icon",onClick:E=>{E.stopPropagation(),x?.({...F,open:!F.open})},children:t.jsx(fe.FontAwesomeIcon,{icon:F.open?ne.faChevronDown:ne.faChevronRight})}):t.jsx("span",{style:{width:16,display:"inline-block"}}),t.jsx("span",{className:"gantt-task-name-text",children:F.text})]})}case"start":return we(F.start,"DD-MM-YYYY");case"end":return we(F.end,"DD-MM-YYYY");case"duration":return j===F.id?t.jsx(g.InputNumber,{size:"small",min:1,value:A,onChange:E=>K(E||1),onBlur:()=>{U(F,A),f(null)},onPressEnter:()=>{U(F,A),f(null)},autoFocus:!0,style:{width:"100%",fontSize:"12px"}}):t.jsxs("div",{onClick:E=>{E.stopPropagation(),f(F.id),K(F.duration)},style:{backgroundColor:"#fff7e6",padding:"2px 8px",borderRadius:"4px",border:"1px solid #ffd591",fontWeight:400,color:"#d46b08",display:"inline-block",fontSize:"12px",cursor:"text"},children:[F.duration," day",F.duration!==1?"s":""]});case"predecessors":{const E=S.filter(W=>W.target===F.id)[0];return t.jsx(lr,{task:F,allTasks:a,links:S,onAddDependency:(W,Q,oe,H)=>w?.(W,Q,oe,H),onRemoveDependency:W=>p?.(W),onTaskUpdate:x,styleConfig:T,children:t.jsx("div",{style:{cursor:"pointer",minHeight:"24px",width:"100%",display:"flex",alignItems:"center",gap:"4px"},children:E?(()=>{const W=a.find(oe=>oe.id===E.source),Q=W?a.indexOf(W)+1:0;return t.jsx("span",{style:{fontSize:"12px",backgroundColor:"#e6f4ff",border:"1px solid #91caff",color:"#1677ff",padding:"0 7px",borderRadius:"4px",whiteSpace:"nowrap"},children:ar(E,Q)})})():t.jsx("span",{style:{fontSize:"12px",color:"#1890ff",textDecoration:"none",fontWeight:500},onMouseEnter:W=>W.currentTarget.style.textDecoration="underline",onMouseLeave:W=>W.currentTarget.style.textDecoration="none",children:"Add"})})})}case"add":return t.jsx(g.Button,{type:"primary",size:"small",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faPlus,style:{fontSize:12}}),onClick:X=>{X.stopPropagation(),s?.(F.id)},title:"Add Subtask",style:{minWidth:"28px",width:"28px",height:"28px",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px"}});case"progress":return t.jsxs("div",{className:"gantt-progress-cell",children:[t.jsx("div",{className:"gantt-progress-bar-bg",children:t.jsx("div",{className:"gantt-progress-bar-fill",style:{width:`${F.progress}%`}})}),t.jsxs("span",{className:"gantt-progress-text",children:[F.progress,"%"]})]});case"index":return t.jsx("span",{style:{color:"#8c8c8c"},children:a.indexOf(F)+1});default:return F[J.name]||""}};return t.jsxs("div",{className:"gantt-grid",ref:C,children:[t.jsx("div",{className:"gantt-grid-header",style:{display:"flex",minWidth:"100%"},children:o.map(F=>t.jsx("div",{className:"gantt-grid-header-cell",style:{width:F.width,minWidth:F.width,justifyContent:F.align==="center"?"center":"flex-start"},children:F.name==="add"?t.jsx("span",{style:{fontSize:11,color:"#64748b",fontWeight:600,whiteSpace:"nowrap"},children:"Add"}):t.jsxs(t.Fragment,{children:[F.label,F.name==="start"&&t.jsx(fe.FontAwesomeIcon,{icon:ne.faChevronDown,style:{marginLeft:8,fontSize:10,color:"#64748b"}})]})},F.name))}),t.jsx("div",{className:"gantt-grid-body",children:e.map(F=>{const J=m?.id===F.id,X=m?.descendantIds.includes(F.id);return t.jsxs("div",{className:`gantt-grid-row ${i===F.id?"selected":""} ${J?"dragging-row":""} ${X?"descendant-dragging-row":""} ${P?.taskId===F.id?`drop-target-${P.position}`:""}`,onClick:()=>r(F.id),onContextMenu:E=>h?.(E,F.id),style:{display:"flex",minWidth:"100%"},children:[o.map(E=>{const W=E.name==="add";return t.jsx("div",{className:"gantt-grid-cell",style:{width:E.width,minWidth:E.width,textAlign:E.align||"left",display:"flex",alignItems:"center",justifyContent:W?"center":E.name==="text"?"flex-start":E.align==="center"?"center":E.align==="right"?"flex-end":"flex-start",visibility:"visible",opacity:1},children:ee(F,E)},`${F.id}-${E.name}`)}),P?.taskId===F.id&&t.jsx("div",{className:`gantt-drop-indicator ${P.position}`})]},F.id)})})]})}));St.displayName="Grid";const Rt=({task:e,position:a,selected:o,dragging:i,onClick:r,onDragStart:h,dragDeltaX:x=0,dragType:l=null,readonly:s=!1,baseline:w,dependencyRuleDescriptions:p=[],tooltipConfig:S})=>{const P=(O,c)=>{s||(O.preventDefault(),O.stopPropagation(),h(O.clientX,O.clientY,c))},m=()=>{const O=["gantt-task-bar"];if(e.type==="milestone"&&O.push("milestone"),e.type==="project"&&O.push("project"),o&&O.push("selected"),i&&O.push("dragging"),e.status){const c=String(e.status).trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");c&&O.push(`status-${c}`)}return O.join(" ")},T=()=>{let O=a.left,c=a.width;return i&&l&&(l==="move"?O+=x:l==="resize-left"?(O+=x,c-=x):l==="resize-right"&&(c+=x)),{left:`${O}px`,width:`${Math.max(c,0)}px`,backgroundColor:e.color||void 0}},M=(O=!1)=>t.jsxs(t.Fragment,{children:[!s&&!O&&t.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-left",onMouseDown:c=>P(c,"resize-left")}),!O&&e.type!=="milestone"&&t.jsx("div",{className:"gantt-task-progress",style:{width:`${e.progress}%`},children:e.progress>5&&e.progress<100&&t.jsxs("span",{className:"gantt-task-progress-text",children:[e.progress,"%"]})}),t.jsx("div",{className:"gantt-task-content",children:!O&&t.jsx("span",{className:"gantt-task-text",children:e.text})}),!s&&!O&&t.jsx("div",{className:"gantt-task-resize-handle gantt-task-resize-right",onMouseDown:c=>P(c,"resize-right")})]}),C=(O,c)=>{if(O instanceof Date)return Number.isNaN(O.getTime())?c:O;if(typeof O=="string"||typeof O=="number"){const v=new Date(O);return Number.isNaN(v.getTime())?c:v}return c},j=O=>{if(Array.isArray(O)){const c=O.map(v=>String(v).trim()).filter(Boolean);return c.length>0?c:void 0}if(typeof O=="string"){const c=O.split(/\r?\n|\|/).map(v=>v.trim()).filter(Boolean);return c.length>0?c:void 0}},f=e.tooltipConfig?{...S,...e.tooltipConfig}:S,A=f?.dateFormat||"MMM D, YYYY",K=f?.taskNameAccessor?.(e)??e.text,k=String(K??"").trim()||`Task ${e.id}`,U=f?.taskNameFormatter?f.taskNameFormatter(k,e):k,ee=C(f?.plannedStartAccessor?.(e)??e.plannedStart??w?.start??e.start,e.start),F=C(f?.plannedEndAccessor?.(e)??e.plannedEnd??w?.end??e.end,e.end),J=f?.plannedDatesFormatter?f.plannedDatesFormatter(ee,F,e):`${we(ee,A)} - ${we(F,A)}`,X=C(f?.actualStartAccessor?.(e)??e.actualStart??e.start,e.start),E=C(f?.actualEndAccessor?.(e)??e.actualEnd??e.end,e.end),W=f?.actualDatesFormatter?f.actualDatesFormatter(X,E,e):`${we(X,A)} - ${we(E,A)}`,Q=f?.statusAccessor?.(e)??e.status,oe=Q!=null?String(Q):"",H=f?.statusFormatter?f.statusFormatter(oe,e):oe?oe.replace(/-/g," "):f?.emptyStatusText||"Not set",he=f?.ownerAccessor?.(e)??e.owner,le=he!=null?String(he).trim():"",B=le?f?.ownerFormatter?f.ownerFormatter(le,e):le:f?.emptyOwnerText||"",ue=p.length>0?p:e.dependencyRule||[],ye=j(f?.dependencyRuleAccessor?.(e,ue))||ue,re=ye.length>0?ye.map(O=>f?.dependencyRuleFormatter?f.dependencyRuleFormatter(O,e):O).join(f?.dependencySeparator||" | "):f?.emptyDependencyRuleText||"No dependency rule",pe=f?.progressAccessor?.(e)??e.progress,Z=typeof pe=="number"?pe:Number(pe),be=Number.isFinite(Z)?Z:e.progress,ae=f?.progressFormatter?f.progressFormatter(be,e):`${be}%`,ve=t.jsxs("div",{className:"gantt-tooltip",children:[f?.showTaskName!==!1&&t.jsx("div",{className:"gantt-tooltip-title",children:U}),f?.showPlannedDates!==!1&&t.jsxs("div",{className:"gantt-tooltip-dates",children:[f?.plannedLabel||"Planned",": ",J]}),f?.showActualDates!==!1&&t.jsxs("div",{className:"gantt-tooltip-dates",children:[f?.actualLabel||"Actual",": ",W]}),f?.showStatus!==!1&&t.jsxs("div",{className:"gantt-tooltip-progress",children:[f?.statusLabel||"Status",": ",H]}),f?.showOwner!==!1&&B&&t.jsxs("div",{className:"gantt-tooltip-owner",children:[f?.ownerLabel||"Owner",": ",B]}),f?.showDependencyRule!==!1&&t.jsxs("div",{className:"gantt-tooltip-owner",children:[f?.dependencyRuleLabel||"Dependency Rule",": ",re]}),f?.showProgress!==!1&&t.jsxs("div",{className:"gantt-tooltip-progress",children:[f?.progressLabel||"Progress",": ",ae]})]});if(e.segments&&e.segments.length>0||e.onHoldPeriods&&e.onHoldPeriods.length>0){const O=e.end.getTime()-e.start.getTime(),c=e.segments&&e.segments.length>0?e.segments:[{start:e.start,end:e.end,duration:e.duration||0}];return t.jsxs("div",{className:"gantt-task-group",children:[O>0&&e.onHoldPeriods?.map((v,$)=>{const N=Math.max(v.start.getTime(),e.start.getTime()),se=Math.min(v.end.getTime(),e.end.getTime())-N;if(se<=0)return null;const G=a.left+(N-e.start.getTime())/O*a.width,de=se/O*a.width;return t.jsx("div",{className:"gantt-on-hold-period",style:{left:`${G}px`,width:`${de}px`}},`hold-${$}`)}),c.map((v,$)=>t.jsx(g.Tooltip,{title:ve,mouseEnterDelay:.5,children:t.jsx("div",{className:m()+" segment",style:{left:`${O>0?a.left+(v.start.getTime()-e.start.getTime())/O*a.width:a.left}px`,width:`${O>0?(v.end.getTime()-v.start.getTime())/O*a.width:a.width}px`,backgroundColor:e.color||void 0},onClick:r,onMouseDown:N=>P(N,"move"),children:M($>0)})},`seg-${$}`))]})}return t.jsx(g.Tooltip,{title:ve,mouseEnterDelay:.5,children:t.jsx("div",{className:m(),style:T(),onClick:r,onMouseDown:O=>P(O,"move"),children:M()})})},dr=({links:e,tasks:a,getTaskPosition:o})=>{const i=y.useMemo(()=>{const l=new Map;return a.forEach(s=>l.set(s.id,s)),l},[a]),r=l=>i.get(l),h=y.useMemo(()=>{let l=0,s=0;return a.forEach(w=>{try{const p=o(w);p&&typeof p.left=="number"&&typeof p.width=="number"&&(l=Math.max(l,p.left+p.width)),p&&typeof p.top=="number"&&typeof p.height=="number"&&(s=Math.max(s,p.top+p.height))}catch(p){console.warn("Failed to position task for link rendering:",w.id,p)}}),{width:Math.max(l,1e3),height:Math.max(s,100)}},[a,o]),x=l=>{const s=r(l.source),w=r(l.target);if(!s||!w)return{path:"",arrow:""};const p=o(s),S=o(w),P=p.top+p.height/2,m=S.top+S.height/2,T={sourceStub:14,targetStub:8,detourPadding:24,minHorizontalSpan:18,arrowGap:2,arrowLength:14,arrowWidth:14,arrowStemOverlap:1,chevronNotchDepth:5};let M=0,C=0,j=1,f=1;switch(l.type){case"e2s":M=p.left+p.width,C=S.left,j=1,f=1;break;case"s2s":M=p.left,C=S.left,j=-1,f=1;break;case"e2e":M=p.left+p.width,C=S.left+S.width,j=1,f=-1;break;case"s2e":M=p.left,C=S.left+S.width,j=-1,f=-1;break}const A=M+j*T.sourceStub,K=C-f*T.arrowGap,k=K-f*T.arrowLength,U=k+f*T.chevronNotchDepth,ee=U-f*T.targetStub,F=U+f*T.arrowStemOverlap,J=Math.abs(m-P)>1;let X;if(J){const he=m>P;let le=he?Math.min(p.top+p.height+6,S.top-6):Math.max(p.top-6,S.top+S.height+6);Math.abs(le-P)<2&&(le=P+(he?2:-2)),Math.abs(le-m)<2&&(le=m+(he?-2:2)),X=[{x:M,y:P},{x:A,y:P},{x:A,y:le},{x:ee,y:le},{x:ee,y:m},{x:F,y:m}]}else{let H;j===f&&(j===1?ee-A>=T.minHorizontalSpan:A-ee>=T.minHorizontalSpan)?H=(A+ee)/2:H=j===1?Math.max(M,C)+T.detourPadding:Math.min(M,C)-T.detourPadding,X=[{x:M,y:P},{x:A,y:P},{x:H,y:P},{x:H,y:m},{x:ee,y:m},{x:F,y:m}]}const E=X.filter((H,he)=>{if(he===0)return!0;const le=X[he-1];return Math.abs(H.x-le.x)>.5||Math.abs(H.y-le.y)>.5}),W=E.length>0?E.map((H,he)=>`${he===0?"M":"L"} ${H.x},${H.y}`).join(" "):"",Q=T.arrowWidth/2,oe=`M ${k},${m-Q} L ${K},${m} L ${k},${m+Q} L ${U},${m} Z`;return{path:W,arrow:oe}};return e.length===0?null:t.jsx("svg",{className:"gantt-links-layer",style:{overflow:"visible",width:h.width,height:h.height,position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.map(l=>{const s=r(l.source),w=r(l.target);if(!s||!w)return null;const p=x(l),S=p.path,P=p.arrow;return!S||!P?null:t.jsxs("g",{className:"gantt-link",children:[t.jsx("path",{d:S,fill:"none",strokeWidth:"1.5",className:"gantt-link-line"}),t.jsx("path",{d:P,className:"gantt-link-arrow"})]},l.id)})})},cr=(e,a,o=60,i="day",r=1)=>{const[h,x]=y.useState({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0}),l=y.useCallback((p,S,P,m)=>{const T=e.find(M=>M.id===p);T&&x({taskId:p,initialX:S,initialY:P,initialStart:new Date(T.start),initialEnd:new Date(T.end),type:m,dragDeltaX:0,dragDeltaY:0})},[e]),s=y.useCallback((p,S)=>{if(!h.taskId||!h.type)return null;const P=p-h.initialX,m=S-h.initialY;if(x(A=>({...A,dragDeltaX:P,dragDeltaY:m})),h.type==="reorder")return null;const T=e.find(A=>A.id===h.taskId);if(!T)return null;const M=Math.round(P/o);let C=new Date(h.initialStart),j=new Date(h.initialEnd);switch(h.type){case"move":C=xe(h.initialStart,M*r,i),j=xe(h.initialEnd,M*r,i);break;case"resize-left":C=xe(h.initialStart,M*r,i),C>=j&&(C=xe(j,-r,i));break;case"resize-right":j=xe(h.initialEnd,M*r,i),j<=C&&(j=xe(C,r,i));break}const f=ze(C,j);return{...T,start:C,end:j,duration:f}},[h,e,o,r,i]),w=y.useCallback(p=>{if(p&&a){const{id:S,...P}=p,m=h.type;if(m&&m!=="reorder"){const T={dragType:m,previousStart:new Date(h.initialStart),previousEnd:new Date(h.initialEnd),previousDuration:ze(h.initialStart,h.initialEnd)};a(S,P,T)}else a(S,P)}x({taskId:null,initialX:0,initialY:0,initialStart:new Date,initialEnd:new Date,type:null,dragDeltaX:0,dragDeltaY:0})},[a,h]);return{dragState:h,handleDragStart:l,handleDrag:s,handleDragEnd:w}},vt=y.forwardRef(({tasks:e,links:a,range:o,scales:i,config:r,selectedTask:h,onTaskClick:x,onTaskDragStart:l,onTaskDragEnd:s,onTaskUpdate:w,zoomLevel:p,baselines:S,allowBaselineOnlyMode:P=!1,taskTooltipConfig:m},T)=>{const[M,C]=y.useState(e),j=(r.columnWidth||60)*p,f=r.baselines&&S&&S.size>0,A=y.useMemo(()=>{const c=new Map;return M.forEach(v=>c.set(v.id,v)),c},[M]),K=y.useMemo(()=>{const c=new Map,v={e2s:"Finish-to-Start",s2s:"Start-to-Start",e2e:"Finish-to-Finish",s2e:"Start-to-Finish"},$=(N,V)=>{const G=[...c.get(N)||[],...V.map(de=>de.trim()).filter(Boolean)];G.length>0&&c.set(N,Array.from(new Set(G)))};return M.forEach(N=>{N.dependencyRule&&N.dependencyRule.length>0&&$(N.id,N.dependencyRule)}),a.forEach(N=>{const V=A.get(N.source),se=A.get(N.target),G=V?.text||`Task ${N.source}`,de=se?.text||`Task ${N.target}`,ie=v[N.type],je=typeof N.lag=="number"&&N.lag!==0?` (${N.lag>0?"+":""}${N.lag} ${N.lagUnit||"day"})`:"",De=`${de} depends on ${G} [${ie}]${je}`;$(N.target,[De])}),c},[a,M,A]),{dragState:k,handleDragStart:U,handleDrag:ee,handleDragEnd:F}=cr(M,w,j,i[1].unit,i[1].step);y.useEffect(()=>{(e.length!==M.length||e.some((v,$)=>{const N=M[$];return!N||v.id!==N.id||v.start.getTime()!==N.start.getTime()||v.end.getTime()!==N.end.getTime()}))&&C(e)},[e]);const J=y.useCallback(c=>{const v=[];let $=new Date(o.start);for(;$<=o.end;)v.push({date:new Date($),label:we($,c.format||"D")}),$=xe($,c.step,c.unit);return v},[o.start,o.end]),X=y.useCallback(c=>{const v=i[1],$=o.start.getTime(),V=c.getTime()-$,G={hour:36e5,day:864e5,week:6048e5,month:2592e6,quarter:7776e6,year:31536e6}[v.unit]||864e5;return V/(G*v.step)*j},[i,o.start,j]),E=c=>{const v=X(c.start),$=X(c.end);return{left:v,width:Math.max($-v,0)}},W=c=>{const v=X(c.start),$=X(c.end);return{left:v,width:Math.max($-v,0)}},Q=y.useCallback(c=>{const v=E(c),$=M.findIndex(G=>G.id===c.id);let N=r.rowHeight||48;if(T&&typeof T=="object"&&T.current){const G=getComputedStyle(T.current).getPropertyValue("--gantt-row-height");if(G){const de=parseFloat(G);!isNaN(de)&&de>0&&(N=de)}}const V=r.taskHeight||28,se=(N-V)/2;return{left:v.left,width:v.width,top:$*N+se,height:V}},[E,M,r.rowHeight,r.taskHeight,T]),oe=y.useRef(null),H=y.useCallback(c=>{k.taskId&&k.type&&(oe.current&&cancelAnimationFrame(oe.current),oe.current=requestAnimationFrame(()=>{const v=ee(c.clientX,c.clientY);v&&C($=>$.map(N=>N.id===v.id?v:N))}))},[k,ee]),he=y.useCallback(()=>{if(k.taskId){const c=M.find(v=>v.id===k.taskId);F(c||null),s()}},[k,M,F,s]),le=i[1],B=y.useMemo(()=>J(le),[J,le]),ue=P&&M.length===0&&f,me=y.useCallback(()=>{const c=[];let v=-1,$=-1,N=0,V="";return B.forEach(se=>{const G=se.date.getMonth(),de=se.date.getFullYear(),ie=we(se.date,"MMM YYYY");G!==v||de!==$?(v!==-1&&c.push({label:V,width:N}),v=G,$=de,N=j,V=ie):N+=j}),v!==-1&&c.push({label:V,width:N}),c},[B,j]),ye=y.useCallback(()=>{const c=[];let v=-1,$=0,N=-1,V=-1,se="";return B.forEach(G=>{const ie=G.date.getDate()<=15?0:1,je=G.date.getMonth(),De=G.date.getFullYear(),Ve=we(G.date,"MMM"),Ae=new Date(De,je+1,0).getDate(),Fe=ie===0?`${Ve} 1 - 15`:`${Ve} 16 - ${Ae}`;ie!==v||je!==N||De!==V?(v!==-1&&c.push({label:se,width:$}),v=ie,N=je,V=De,$=j,se=Fe):$+=j}),v!==-1&&c.push({label:se,width:$}),c},[B,j]),re=y.useMemo(()=>me(),[me]),pe=y.useMemo(()=>ye(),[ye]),Z=y.useMemo(()=>B.length*j,[B.length,j]),be=y.useMemo(()=>{const c=new Date;return c.setHours(0,0,0,0),c},[]),ae=y.useMemo(()=>{if(!r.showTodayLine)return null;const c=X(be);return c>=-j&&c<=Z+j?Math.max(0,Math.min(c,Z)):null},[r.showTodayLine,be,Z,j,X]),ve=y.useMemo(()=>{if(r.projectStartDate)return _e(r.projectStartDate);if(e.length>0){const c=e.map(v=>v.start.getTime());return _e(new Date(Math.min(...c)))}return null},[r.projectStartDate,e]),O=y.useMemo(()=>{if(!r.showProjectStartLine||!ve)return null;const c=X(ve);return c>=-j&&c<=Z+j?Math.max(0,Math.min(c,Z)):null},[r.showProjectStartLine,ve,Z,j,X]);return t.jsxs("div",{className:"gantt-timeline-container",ref:T,onMouseMove:H,onMouseUp:he,style:{width:Z,position:"relative"},children:[t.jsxs("div",{className:"gantt-timeline-header",style:{width:Z,minWidth:Z,position:"relative"},children:[ae!==null&&r.showTodayLine&&r.todayLineLabel&&r.todayLineLabel!==""&&t.jsx("div",{className:"gantt-today-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${ae}px`,transform:"translateX(-50%)",backgroundColor:r.todayLineColor||"#ff4d4f",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.todayLineLabelStyle},children:r.todayLineLabel}),O!==null&&r.showProjectStartLine&&r.projectStartLineLabel&&r.projectStartLineLabel!==""&&t.jsx("div",{className:"gantt-project-start-line-label",style:{position:"absolute",top:"calc(var(--gantt-scale-height, 24px) * 2)",left:`${O}px`,transform:"translateX(-50%)",backgroundColor:r.projectStartLineColor||"#40a9ff",color:"#ffffff",padding:"4px 10px",borderRadius:"4px",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 2px 6px rgba(0, 0, 0, 0.2)",lineHeight:"1.2",zIndex:101,pointerEvents:"none",...r.projectStartLineLabelStyle},children:r.projectStartLineLabel}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-month",style:{width:Z},children:re.map((c,v)=>t.jsx("div",{className:"gantt-timeline-cell",style:{width:c.width,minWidth:c.width,maxWidth:c.width,borderRight:v===re.length-1?"none":"var(--wx-gantt-border)"},children:c.label},`top-${v}`))}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-range",style:{width:Z},children:pe.map((c,v)=>t.jsx("div",{className:"gantt-timeline-cell",style:{width:c.width,minWidth:c.width,maxWidth:c.width,borderRight:v===pe.length-1?"none":"var(--wx-gantt-border)"},children:c.label},`mid-${v}`))}),t.jsx("div",{className:"gantt-timeline-scale gantt-timeline-scale-day",style:{width:Z},children:B.map((c,v)=>{const $=r.weekends&&yt(c.date),N=r.holidays&&wt(c.date,r.holidays);return t.jsx("div",{className:`gantt-timeline-cell ${$?"weekend":""} ${N?"holiday":""}`,style:{width:j,minWidth:j,maxWidth:j,borderRight:v===B.length-1?"none":"var(--wx-gantt-border)"},children:c.label},`day-${v}`)})})]}),t.jsxs("div",{className:"gantt-timeline-body",style:{width:Z,position:"relative"},children:[ae!==null&&t.jsxs(t.Fragment,{children:[r.showTodayLineMarker!==!1&&(()=>{const c=r.todayLineMarkerSize||8,v=r.todayLineColor||"#ff4d4f",$=r.todayLineMarkerStyle||"triangle",N=r.todayLineOpacity!==void 0?r.todayLineOpacity:1;return $==="triangle"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ae}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${c}px solid transparent`,borderRight:`${c}px solid transparent`,borderBottom:`${c}px solid ${v}`,zIndex:7,pointerEvents:"none",opacity:N}}):$==="arrow"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ae}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${c}px solid transparent`,borderRight:`${c}px solid transparent`,borderBottom:`${c*.7}px solid ${v}`,zIndex:7,pointerEvents:"none",opacity:N}}):$==="dot"?t.jsx("div",{className:"gantt-today-line-marker",style:{position:"absolute",left:`${ae}px`,top:`-${c/2}px`,transform:"translateX(-50%)",width:`${c}px`,height:`${c}px`,borderRadius:"50%",backgroundColor:v,zIndex:7,pointerEvents:"none",opacity:N}}):null})(),t.jsx("div",{className:"gantt-today-line",style:{position:"absolute",left:`${ae}px`,top:0,bottom:0,width:`${r.todayLineWidth||1}px`,backgroundColor:r.todayLineColor||"#ff4d4f",opacity:r.todayLineOpacity!==void 0?r.todayLineOpacity:1,borderLeft:r.todayLineStyle==="dashed"?`${r.todayLineWidth||1}px dashed ${r.todayLineColor||"#ff4d4f"}`:r.todayLineStyle==="dotted"?`${r.todayLineWidth||1}px dotted ${r.todayLineColor||"#ff4d4f"}`:"none",zIndex:6,pointerEvents:"none"}})]}),O!==null&&t.jsxs(t.Fragment,{children:[r.showProjectStartLineMarker!==!1&&(()=>{const c=r.projectStartLineMarkerSize||8,v=r.projectStartLineColor||"#40a9ff",$=r.projectStartLineMarkerStyle||"triangle",N=r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1;return $==="triangle"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${O}px`,top:"-4px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${c}px solid transparent`,borderRight:`${c}px solid transparent`,borderBottom:`${c}px solid ${v}`,zIndex:7,pointerEvents:"none",opacity:N}}):$==="arrow"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${O}px`,top:"-6px",transform:"translateX(-50%)",width:0,height:0,borderLeft:`${c}px solid transparent`,borderRight:`${c}px solid transparent`,borderBottom:`${c*.7}px solid ${v}`,zIndex:7,pointerEvents:"none",opacity:N}}):$==="dot"?t.jsx("div",{className:"gantt-project-start-line-marker",style:{position:"absolute",left:`${O}px`,top:`-${c/2}px`,transform:"translateX(-50%)",width:`${c}px`,height:`${c}px`,borderRadius:"50%",backgroundColor:v,zIndex:7,pointerEvents:"none",opacity:N}}):null})(),t.jsx("div",{className:"gantt-project-start-line",style:{position:"absolute",left:`${O}px`,top:0,bottom:0,width:`${r.projectStartLineWidth||1}px`,backgroundColor:r.projectStartLineColor||"#40a9ff",opacity:r.projectStartLineOpacity!==void 0?r.projectStartLineOpacity:1,borderLeft:r.projectStartLineStyle==="dashed"?`${r.projectStartLineWidth||1}px dashed ${r.projectStartLineColor||"#40a9ff"}`:r.projectStartLineStyle==="dotted"?`${r.projectStartLineWidth||1}px dotted ${r.projectStartLineColor||"#40a9ff"}`:"none",zIndex:6,pointerEvents:"none"}})]}),t.jsx("div",{className:"gantt-timeline-grid",children:B.map((c,v)=>{const $=r.weekends&&yt(c.date),N=r.holidays&&wt(c.date,r.holidays);return t.jsx("div",{className:`gantt-timeline-grid-column ${$?"weekend":""} ${N?"holiday":""}`,style:{width:j,minWidth:j}},v)})}),a.length>0&&t.jsx(dr,{links:a,tasks:M,getTaskPosition:Q}),t.jsx("div",{className:"gantt-timeline-tasks",style:{width:Z},children:ue?Array.from(S?.values()||[]).map(c=>{const v=W(c);return t.jsx("div",{className:"gantt-timeline-row baseline-only",children:t.jsx("div",{className:"gantt-baseline-bar baseline-only",style:{left:`${v.left}px`,width:`${v.width}px`},title:`Baseline: ${c.start.toLocaleDateString()} - ${c.end.toLocaleDateString()}`})},`baseline-only-${c.taskId}`)}):M.map(c=>{const v=E(c),$=f?S?.get(c.id):void 0,N=$?W($):void 0;return t.jsxs("div",{className:"gantt-timeline-row",children:[$&&N&&t.jsx("div",{className:`gantt-baseline-bar ${c.type==="milestone"?"milestone":""}`,style:{left:`${N.left}px`,width:`${N.width}px`},title:`Baseline: ${$.start.toLocaleDateString()} - ${$.end.toLocaleDateString()}`}),t.jsx(Rt,{task:c,baseline:$,dependencyRuleDescriptions:K.get(c.id)||[],tooltipConfig:m,position:v,selected:h===c.id,dragging:k.taskId===c.id,dragDeltaX:k.dragDeltaX,dragType:k.type,onClick:()=>x(c.id),onDragStart:(V,se,G)=>{U(c.id,V,se,G),l(c.id,V,se)},readonly:r.readonly})]},c.id)})})]})]})});vt.displayName="Timeline";const jt=y.forwardRef((e,a)=>t.jsx("div",{className:"gantt-chart-wrapper",style:{flex:1,minWidth:0},children:t.jsx(vt,{...e,ref:a})}));jt.displayName="Chart";const{Search:ur}=g.Input,Bt=({onFilterChange:e,owners:a=[],uiConfig:o={}})=>{const[i,r]=y.useState({searchText:"",status:"all",priority:"all",owner:""}),h=s=>{const w={...i,...s};r(w),e(w)},x=()=>{const s={searchText:"",status:"all",priority:"all",owner:""};r(s),e(s)},l=i.searchText!==""||i.status!=="all"||i.priority!=="all"||i.owner!=="";return t.jsx("div",{className:"gantt-filter-container",children:t.jsxs("div",{className:"gantt-filter-bar",children:[t.jsx("div",{className:"gantt-filter-left",children:t.jsx(ur,{placeholder:o.searchPlaceholder||"Search stages...",value:i.searchText,onChange:s=>h({searchText:s.target.value}),allowClear:!0,className:"gantt-search-antd",style:{width:250}})}),t.jsxs("div",{className:"gantt-filter-right",children:[t.jsx(g.Select,{value:i.status,onChange:s=>h({status:s}),className:"gantt-filter-select-antd",style:{width:140},options:[{value:"all",label:o.statusOptions?.all||"All Status"},{value:"not-started",label:o.statusOptions?.notStarted||"Not Started"},{value:"in-progress",label:o.statusOptions?.inProgress||"In Progress"},{value:"completed",label:o.statusOptions?.completed||"Completed"}]}),t.jsx(g.Select,{value:i.priority,onChange:s=>h({priority:s}),className:"gantt-filter-select-antd",style:{width:130},options:[{value:"all",label:o.priorityFilterOptions?.all||"All Priority"},{value:"low",label:o.priorityFilterOptions?.low||"Low"},{value:"medium",label:o.priorityFilterOptions?.medium||"Medium"},{value:"high",label:o.priorityFilterOptions?.high||"High"}]}),t.jsx(g.Select,{value:i.owner||void 0,onChange:s=>h({owner:s||""}),className:"gantt-filter-select-antd",style:{width:130},placeholder:o.allOwnersText||"All Owners",allowClear:!0,options:[{value:"",label:o.allOwnersText||"All Owners"},...(a||[]).map(s=>({value:s,label:s}))]}),l&&t.jsx(g.Button,{type:"default",danger:!0,icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faTimesCircle}),onClick:x,className:"gantt-filter-clear-antd",children:o.clearFiltersText||"Clear"})]})]})})},Ce=(e,a)=>e?typeof e=="string"?t.jsx(fe.FontAwesomeIcon,{icon:a}):e:t.jsx(fe.FontAwesomeIcon,{icon:a}),It=({zoomLevel:e,setZoomLevel:a,onExport:o,onFilterChange:i,owners:r,onAddTask:h,uiConfig:x,iconConfig:l={},styleConfig:s})=>{const w=Ye(s),p=x.showZoomButtons!==!1,S=x.showExportButtons!==!1,P=p&&S;return t.jsxs("div",{className:"gantt-toolbar-wrapper",children:[t.jsxs("div",{className:"gantt-toolbar",children:[t.jsx("div",{className:"gantt-toolbar-left",children:t.jsx(g.Space,{size:8,children:x.showAddTaskButton!==!1&&t.jsx(g.Button,{type:"primary",icon:Ce(l.addTask,ne.faPlus),onClick:()=>h?.(),style:w.buttonPrimary,children:x.addTaskButtonText||"New Stage"})})}),t.jsx("div",{className:"gantt-toolbar-right",children:t.jsxs(g.Space,{size:4,children:[p&&t.jsxs(t.Fragment,{children:[t.jsx(g.Tooltip,{title:x.zoomOutTooltip||"Zoom Out",children:t.jsx(g.Button,{icon:Ce(l.zoomOut,ne.faSearchMinus),onClick:()=>a(Math.max(.5,e-.25)),style:w.buttonSecondary})}),t.jsx(g.Tooltip,{title:x.zoomInTooltip||"Zoom In",children:t.jsx(g.Button,{icon:Ce(l.zoomIn,ne.faSearchPlus),onClick:()=>a(Math.min(2,e+.25)),style:w.buttonSecondary})}),t.jsx(g.Tooltip,{title:x.resetZoomTooltip||"Reset Zoom",children:t.jsx(g.Button,{icon:Ce(l.resetZoom,ne.faRotateLeft),onClick:()=>a(1),style:w.buttonSecondary})})]}),P&&t.jsx(g.Divider,{type:"vertical",style:{height:24,margin:"0 4px"}}),S&&t.jsxs(t.Fragment,{children:[t.jsx(g.Tooltip,{title:x.exportCSVTooltip||"Export to CSV",children:t.jsx(g.Button,{icon:Ce(l.exportCSV,ne.faFileCsv),onClick:()=>o("csv"),style:w.buttonSecondary})}),t.jsx(g.Tooltip,{title:x.exportExcelTooltip||"Export to Excel",children:t.jsx(g.Button,{icon:Ce(l.exportExcel,ne.faFileExcel),onClick:()=>o("excel"),style:w.buttonSecondary})}),t.jsx(g.Tooltip,{title:x.exportJSONTooltip||"Export to JSON",children:t.jsx(g.Button,{icon:Ce(l.exportJSON,ne.faFileCode),onClick:()=>o("json"),style:w.buttonSecondary})}),t.jsx(g.Tooltip,{title:x.exportPDFTooltip||"Export to PDF",children:t.jsx(g.Button,{icon:Ce(l.exportPDF,ne.faFilePdf),onClick:()=>o("pdf"),style:w.buttonSecondary})})]})]})})]}),x.showFilterSearch!==!1&&t.jsx(Bt,{onFilterChange:i,owners:r,uiConfig:x})]})},{Option:We}=g.Select,{TextArea:pr}=g.Input,zt=({onCreateTask:e,onClose:a,uiConfig:o={},parentId:i,parentTaskName:r,styleConfig:h})=>{const[x]=g.Form.useForm(),l=Ye(h),s=w=>{const p=w.start.toDate(),S=new Date(p);S.setDate(S.getDate()+(w.duration||1)),e({text:w.text,start:p,end:S,duration:w.duration||1,progress:w.progress||0,type:w.type,color:typeof w.color=="string"?w.color:w.color?.toHexString?.()||"#4A90E2",owner:w.owner||"",priority:w.priority||"medium",details:w.details||"",parent:i},i),a()};return t.jsx(g.Modal,{title:i?(o.taskCreatorTitle||"Create Checklist")+(r?` for "${r}"`:""):o.taskCreatorTitle||"Create New Stage",open:!0,onCancel:a,onOk:()=>x.submit(),okText:o.taskCreatorOkText||"Create Stage",cancelText:o.taskCreatorCancelText||"Cancel",width:600,className:"gantt-modal-antd",styles:{content:l.modal,header:{borderBottom:`1px solid ${l.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},okButtonProps:{style:l.buttonPrimary},cancelButtonProps:{style:l.buttonSecondary},children:t.jsxs(g.Form,{form:x,layout:"vertical",onFinish:s,initialValues:{type:"task",priority:"medium",start:Ot(),duration:1,progress:0,color:"#4A90E2"},children:[t.jsx(g.Form.Item,{name:"text",label:o.taskNameLabel||"Stage Name",rules:[{required:!0,message:o.taskNameRequired||"Please enter stage name"}],children:t.jsx(g.Input,{placeholder:o.taskNamePlaceholder||"Enter stage name",autoFocus:!0,style:l.input})}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"type",label:o.typeLabel||"Type",style:{flex:1},children:t.jsxs(g.Select,{style:l.input,children:[t.jsx(We,{value:"task",children:o.taskTypeOptions?.task||"Stage"}),t.jsx(We,{value:"milestone",children:o.taskTypeOptions?.milestone||"Milestone"}),t.jsx(We,{value:"project",children:o.taskTypeOptions?.project||"Project"})]})}),t.jsx(g.Form.Item,{name:"priority",label:o.priorityLabel||"Priority",style:{flex:1},children:t.jsxs(g.Select,{style:l.input,children:[t.jsx(We,{value:"low",children:o.priorityOptions?.low||"Low"}),t.jsx(We,{value:"medium",children:o.priorityOptions?.medium||"Medium"}),t.jsx(We,{value:"high",children:o.priorityOptions?.high||"High"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"start",label:o.startDateLabel||"Start Date",style:{flex:1},children:t.jsx(g.DatePicker,{style:{width:"100%",...l.input}})}),t.jsx(g.Form.Item,{name:"duration",label:o.durationLabel||"Duration (days)",style:{flex:1},children:t.jsx(g.InputNumber,{min:0,style:{width:"100%",...l.input}})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"color",label:o.colorLabel||"Color",style:{flex:1},children:t.jsx(g.ColorPicker,{showText:!0})}),t.jsx(g.Form.Item,{name:"progress",label:o.progressLabel||"Progress (%)",style:{flex:1},children:t.jsx(g.InputNumber,{min:0,max:100,style:{width:"100%",...l.input}})})]}),t.jsx(g.Form.Item,{name:"owner",label:o.ownerLabel||"Owner",children:t.jsx(g.Input,{placeholder:o.ownerPlaceholder||"Assign to...",style:l.input})}),t.jsx(g.Form.Item,{name:"details",label:o.detailsLabel||"Details",children:t.jsx(pr,{placeholder:o.detailsPlaceholder||"Add stage description...",rows:3,style:l.input})})]})})},{Option:He}=g.Select,{TextArea:hr}=g.Input,{confirm:mr}=g.Modal,Yt=({task:e,onUpdate:a,onDelete:o,onClose:i,uiConfig:r={},styleConfig:h})=>{const[x]=g.Form.useForm(),l=Ye(h),s=p=>{const S=p.start.toDate(),P=new Date(S);P.setDate(P.getDate()+(p.duration||1)),a({...e,text:p.text,start:S,end:P,duration:p.duration||1,progress:p.progress||0,type:p.type,color:typeof p.color=="string"?p.color:p.color?.toHexString?.()||"#4A90E2",owner:p.owner||"",priority:p.priority||"medium",details:p.details||""}),i()},w=()=>{mr({title:r.deleteConfirmTitle?`${r.deleteConfirmTitle}: "${e.text}"?`:`Are you sure you want to delete "${e.text}"?`,icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faExclamationTriangle,style:{color:"#faad14",marginRight:8}}),content:r.deleteConfirmContent||"This action cannot be undone.",okText:r.deleteConfirmOkText||"Yes, Delete",okType:"danger",cancelText:r.deleteConfirmCancelText||"No",onOk(){o(e.id),i()}})};return t.jsx(g.Modal,{title:r.taskEditorTitle||"Edit Stage",open:!0,onCancel:i,footer:[t.jsx(g.Button,{danger:!0,onClick:w,style:{float:"left",...l.buttonDanger},children:r.taskEditorDeleteText||"Delete"},"delete"),t.jsx(g.Button,{onClick:i,style:l.buttonSecondary,children:r.taskEditorCancelText||"Cancel"},"cancel"),t.jsx(g.Button,{type:"primary",onClick:()=>x.submit(),style:l.buttonPrimary,children:r.taskEditorSaveText||"Save Changes"},"submit")],width:600,className:"gantt-modal-antd",styles:{content:l.modal,header:{borderBottom:`1px solid ${l.modal?.borderColor||"#f0f0f0"}`,marginBottom:16}},children:t.jsxs(g.Form,{form:x,layout:"vertical",onFinish:s,initialValues:{text:e.text,type:e.type||"task",priority:e.priority||"medium",start:Ot(e.start),duration:e.duration,progress:e.progress,color:e.color||"#4A90E2",owner:e.owner||"",details:e.details||""},children:[t.jsx(g.Form.Item,{name:"text",label:r.taskNameLabel||"Stage Name",rules:[{required:!0,message:r.taskNameRequired||"Please enter stage name"}],children:t.jsx(g.Input,{placeholder:r.taskNamePlaceholder||"Enter stage name",style:l.input})}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"type",label:r.typeLabel||"Type",style:{flex:1},children:t.jsxs(g.Select,{style:l.input,children:[t.jsx(He,{value:"task",children:r.taskTypeOptions?.task||"Stage"}),t.jsx(He,{value:"milestone",children:r.taskTypeOptions?.milestone||"Milestone"}),t.jsx(He,{value:"project",children:r.taskTypeOptions?.project||"Project"})]})}),t.jsx(g.Form.Item,{name:"priority",label:r.priorityLabel||"Priority",style:{flex:1},children:t.jsxs(g.Select,{style:l.input,children:[t.jsx(He,{value:"low",children:r.priorityOptions?.low||"Low"}),t.jsx(He,{value:"medium",children:r.priorityOptions?.medium||"Medium"}),t.jsx(He,{value:"high",children:r.priorityOptions?.high||"High"})]})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"start",label:r.startDateLabel||"Start Date",style:{flex:1},children:t.jsx(g.DatePicker,{style:{width:"100%",...l.input}})}),t.jsx(g.Form.Item,{name:"duration",label:r.durationLabel||"Duration (days)",style:{flex:1},children:t.jsx(g.InputNumber,{min:0,style:{width:"100%",...l.input}})})]}),t.jsxs("div",{style:{display:"flex",gap:16},children:[t.jsx(g.Form.Item,{name:"color",label:r.colorLabel||"Color",style:{flex:1},children:t.jsx(g.ColorPicker,{showText:!0})}),t.jsx(g.Form.Item,{name:"progress",label:r.progressLabel||"Progress (%)",style:{flex:1},children:t.jsx(g.InputNumber,{min:0,max:100,style:{width:"100%",...l.input}})})]}),t.jsx(g.Form.Item,{name:"owner",label:r.ownerLabel||"Owner",children:t.jsx(g.Input,{placeholder:r.ownerPlaceholder||"Assign to...",style:l.input})}),t.jsx(g.Form.Item,{name:"details",label:r.detailsLabel||"Details",children:t.jsx(hr,{placeholder:r.detailsPlaceholder||"Add stage description...",rows:3,style:l.input})})]})})},{Title:Ke,Text:Re,Paragraph:fr}=g.Typography,{Option:Ne}=g.Select,Wt=({task:e,allTasks:a,links:o,onAddDependency:i,onRemoveDependency:r,onTaskUpdate:h,onClose:x,styleConfig:l})=>{const s=Ye(l),[w,p]=y.useState(""),[S,P]=y.useState("e2s"),[m,T]=y.useState(0),[M,C]=y.useState("day"),[j,f]=y.useState(e.duration),[A,K]=y.useState(""),k=o.filter(E=>E.target===e.id),U=a.filter(E=>E.id!==e.id&&E.id!==e.parent),ee=()=>{if(w){const E=bt(m,M);if(j!==e.duration&&h){const W=xe(new Date(e.start),j,"day");h({...e,duration:j,end:W})}i(w,e.id,S,E),p(""),T(0),C("day")}},F=()=>{if(!A.trim())return;const E=or(A.trim());if(!E){alert(`Invalid format. Use: [TaskNumber][Type][+/-][Lag][Unit]
|
|
15
|
+
Example: 3FS+10d`);return}const W=E.taskNumber-1,Q=a[W];if(!Q){alert(`Task ${E.taskNumber} not found`);return}const oe=sr(E.type),H=bt(E.lag,E.lagUnit);i(Q.id,e.id,oe,H),K("")},J=E=>{switch(E){case"e2s":return"Finish-to-Start (FS)";case"s2s":return"Start-to-Start (SS)";case"e2e":return"Finish-to-Finish (FF)";case"s2e":return"Start-to-Finish (SF)"}},X=E=>{switch(E){case"e2s":return"blue";case"s2s":return"green";case"e2e":return"purple";case"s2e":return"orange"}};return t.jsx(g.Modal,{title:t.jsx(Ke,{level:4,style:{margin:0,color:s.font?.color},children:"Dependency Editor"}),open:!0,onCancel:x,footer:null,width:700,styles:{content:s.modal,header:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`}},children:t.jsxs("div",{style:{padding:"8px 0"},children:[t.jsx(g.Alert,{message:"Managing dependencies helps in auto-scheduling and critical path calculation.",type:"info",showIcon:!0,style:{marginBottom:20,...s.font}}),t.jsxs("div",{style:{display:"flex",gap:20,marginBottom:24},children:[t.jsx(g.Card,{title:t.jsx(Ke,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Settings"}),size:"small",style:{flex:1,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:t.jsxs(g.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[t.jsxs("div",{children:[t.jsx(Re,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Predecessor"}),t.jsx(g.Select,{showSearch:!0,placeholder:"Select a task",optionFilterProp:"children",style:{width:"100%",...s.input},value:w,onChange:p,children:U.map(E=>t.jsxs(Ne,{value:E.id,children:["[",a.indexOf(E)+1,"] ",E.text]},E.id))})]}),t.jsxs("div",{children:[t.jsx(Re,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Type"}),t.jsxs(g.Select,{style:{width:"100%",...s.input},value:S,onChange:P,children:[t.jsx(Ne,{value:"e2s",children:"Finish-to-Start (FS)"}),t.jsx(Ne,{value:"s2s",children:"Start-to-Start (SS)"}),t.jsx(Ne,{value:"e2e",children:"Finish-to-Finish (FF)"}),t.jsx(Ne,{value:"s2e",children:"Start-to-Finish (SF)"})]})]}),t.jsxs("div",{style:{display:"flex",gap:12},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(Re,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Lag/Lead"}),t.jsx(g.InputNumber,{style:{width:"100%",...s.input},value:m,onChange:E=>T(E||0)})]}),t.jsxs("div",{style:{flex:1},children:[t.jsx(Re,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Units"}),t.jsxs(g.Select,{style:{width:"100%",...s.input},value:M,onChange:C,children:[t.jsx(Ne,{value:"day",children:"Days"}),t.jsx(Ne,{value:"hour",children:"Hours"}),t.jsx(Ne,{value:"week",children:"Weeks"}),t.jsx(Ne,{value:"month",children:"Months"})]})]})]}),t.jsxs("div",{children:[t.jsx(Re,{style:{display:"block",marginBottom:8,fontSize:13,color:s.font?.color},children:"Duration (days)"}),t.jsx(g.InputNumber,{style:{width:"100%",...s.input},min:1,value:j,onChange:E=>f(E||1)})]}),t.jsx(g.Button,{type:"primary",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faPlus,style:{marginRight:8}}),block:!0,onClick:ee,disabled:!w,style:{height:40,marginTop:8,...s.buttonPrimary},children:"Add Dependency"})]})}),t.jsxs(g.Card,{title:t.jsx(Ke,{level:5,style:{margin:0,fontSize:14,color:s.font?.color},children:"Quick Add"}),size:"small",style:{width:250,...s.modal},headStyle:{borderBottom:`1px solid ${s.modal?.borderColor||"#f0f0f0"}`},children:[t.jsxs(fr,{type:"secondary",style:{fontSize:12,marginBottom:16,color:s.font?.color,opacity:.7},children:["Format: [TaskNumber][Type][+/-][Lag][Unit]",t.jsx("br",{}),"Example: 3FS+10d"]}),t.jsx(g.Input,{placeholder:"e.g. 5FS+2d",value:A,onChange:E=>K(E.target.value),onPressEnter:F,style:{marginBottom:16,height:40,...s.input}}),t.jsx(g.Button,{block:!0,onClick:F,style:{height:40,...s.buttonSecondary},children:"Apply"})]})]}),t.jsx(g.Divider,{style:{margin:"0 0 24px 0",borderColor:s.modal?.borderColor}}),t.jsxs("div",{style:{maxHeight:300,overflowY:"auto"},children:[t.jsx(Ke,{level:5,style:{fontSize:14,marginBottom:16,color:s.font?.color},children:"Current Dependencies"}),t.jsx(g.List,{dataSource:k,locale:{emptyText:t.jsx(Re,{type:"secondary",style:{color:s.font?.color,opacity:.5},children:"No dependencies added yet."})},renderItem:E=>{const W=a.find(Q=>Q.id===E.source);return t.jsx(g.List.Item,{style:{padding:"12px 16px",background:"#fafafa",borderRadius:8,marginBottom:12,border:`1px solid ${s.listItem?.borderColor||"#f0f0f0"}`},actions:[t.jsx(g.Button,{type:"text",danger:!0,icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faTrash}),onClick:()=>r(E.id)},"delete")],children:t.jsx(g.List.Item.Meta,{avatar:t.jsx("div",{style:{width:32,height:32,borderRadius:16,background:"#1890ff",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:12,fontWeight:"bold"},children:W?a.indexOf(W)+1:"?"}),title:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx("span",{style:{fontWeight:600,color:s.font?.color},children:W?.text||"Unknown Task"}),t.jsx(g.Tag,{color:X(E.type),style:{margin:0},children:J(E.type)})]}),description:t.jsx("div",{style:{display:"flex",alignItems:"center",gap:16,marginTop:4},children:t.jsxs("span",{style:{fontSize:12,color:s.font?.color,opacity:.7},children:[t.jsx(fe.FontAwesomeIcon,{icon:ne.faLink,style:{marginRight:6}}),"Lag: ",E.lag||0," days"]})})})})}})]}),t.jsxs("div",{style:{marginTop:24,padding:"16px",background:"#fff7e6",borderRadius:8,border:"1px solid #ffe7ba"},children:[t.jsxs(Ke,{level:5,style:{fontSize:13,marginBottom:8,display:"flex",alignItems:"center"},children:[t.jsx(fe.FontAwesomeIcon,{icon:ne.faInfoCircle,style:{marginRight:8,color:"#fa8c16"}}),"Coming soon"]}),t.jsx(Re,{style:{fontSize:12,color:"rgba(0,0,0,0.65)"},children:"Dependency visualization on the chart and automatic lag calculations based on working hours."})]})]})})},gr=({x:e,y:a,task:o,onEdit:i,onDelete:r,onCopy:h,onDependencies:x,onConvertToMilestone:l,onConvertToTask:s,onConvertToProject:w,onAutoSchedule:p,onClose:S,styleConfig:P})=>{const m=Ye(P);if(!o)return null;const T=[{key:"edit",label:"Edit",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faEdit}),onClick:()=>{i(),S()}},{key:"copy",label:"Copy",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faCopy}),onClick:()=>{h(),S()}},{key:"dependencies",label:"Dependencies",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faLink}),onClick:()=>{x(),S()}},{type:"divider"},{key:"convert",label:"Convert to",type:"submenu",children:[{key:"milestone",label:"Milestone",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faFlag}),disabled:o.type==="milestone",onClick:()=>{l(),S()}},{key:"task",label:"Task",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faTasks}),disabled:o.type==="task",onClick:()=>{s(),S()}},{key:"project",label:"Project",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faFolder}),disabled:o.type==="project",onClick:()=>{w(),S()}}]},{key:"auto-schedule",label:"Auto Schedule",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faRotateLeft}),onClick:()=>{p?.(),S()}},{type:"divider"},{key:"delete",label:"Delete",icon:t.jsx(fe.FontAwesomeIcon,{icon:ne.faTrash}),danger:!0,onClick:()=>{r(),S()}}];return t.jsx("div",{className:"gantt-context-menu",style:{position:"fixed",left:`${e}px`,top:`${a}px`,zIndex:1e4},onClick:M=>M.stopPropagation(),children:t.jsx(g.Menu,{items:T,style:{boxShadow:m.popover?.boxShadow||"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:m.popover?.borderRadius||"6px",border:`1px solid ${m.popover?.borderColor||"#e0e0e0"}`,backgroundColor:m.popover?.backgroundColor,color:m.font?.color,fontFamily:m.font?.fontFamily}})})},Ht=(e,a=[])=>{const[o,i]=y.useState([]),[r,h]=y.useState(-1),[x,l]=y.useState(e),[s,w]=y.useState(a);y.useEffect(()=>{l(e)},[e]),y.useEffect(()=>{w(a)},[a]);const p=y.useCallback((f,A,K)=>{const k={type:f,before:A,after:K,timestamp:Date.now()},U=o.slice(0,r+1);U.push(k),U.length>50?U.shift():h(r+1),i(U)},[o,r]),S=y.useCallback(()=>{if(r<0)return;const f=o[r];l(f.before.tasks),w(f.before.links),h(r-1)},[o,r]),P=y.useCallback(()=>{if(r>=o.length-1)return;const f=o[r+1];l(f.after.tasks),w(f.after.links),h(r+1)},[o,r]),m=r>=0,T=r<o.length-1,M=y.useCallback(f=>{const A={tasks:x,links:s},K=x.map(U=>U.id===f.id?f:U);p("task_update",A,{tasks:K,links:s}),l(K)},[x,s,p]),C=y.useCallback(f=>{const A={tasks:x,links:s},K=[...x,f];p("task_create",A,{tasks:K,links:s}),l(K)},[x,s,p]),j=y.useCallback(f=>{const A={tasks:x,links:s},K=x.filter(ee=>ee.id!==f),k=s.filter(ee=>ee.source!==f&&ee.target!==f);p("task_delete",A,{tasks:K,links:k}),l(K),w(k)},[x,s,p]);return{tasks:x,links:s,setTasks:l,setLinks:w,undo:S,redo:P,canUndo:m,canRedo:T,updateTask:M,createTask:C,deleteTask:j,saveState:p,history:o}},Vt=(e,a,o={mode:"forward"})=>{const i=new Map,r=new Map;return e.forEach(h=>{i.set(h.id,[]),r.set(h.id,[])}),a.forEach(h=>{h.type==="e2s"&&(i.get(h.target)?.push(h.source),r.get(h.source)?.push(h.target))}),o.mode==="forward"?xr(e,i,o):yr(e,r,o)},xr=(e,a,o)=>{const i=new Map,r=new Set,h=o.projectStart||new Date,x=l=>{if(r.has(l))return;const s=e.find(T=>T.id===l);if(!s)return;const w=a.get(l)||[];w.forEach(T=>x(T));let p=h;w.forEach(T=>{const M=i.get(T);M&&M.end>p&&(p=new Date(M.end))});const S=new Date(p),P=xe(S,s.duration,"day"),m={...s,start:S,end:P};i.set(l,m),r.add(l)};return e.forEach(l=>x(l.id)),e.map(l=>i.get(l.id)||l)},yr=(e,a,o)=>{const i=new Map,r=new Set,h=o.projectEnd||new Date(Math.max(...e.map(l=>l.end.getTime()))),x=l=>{if(r.has(l))return;const s=e.find(T=>T.id===l);if(!s)return;const w=a.get(l)||[];w.forEach(T=>x(T));let p=h;w.forEach(T=>{const M=i.get(T);M&&M.start<p&&(p=new Date(M.start))});const S=new Date(p),P=xe(S,-s.duration,"day"),m={...s,start:P,end:S};i.set(l,m),r.add(l)};return e.forEach(l=>x(l.id)),e.map(l=>i.get(l.id)||l)},wr=Object.freeze(Object.defineProperty({__proto__:null,autoSchedule:Vt,levelResources:e=>{const a=new Map;e.forEach(i=>{i.owner&&(a.has(i.owner)||a.set(i.owner,[]),a.get(i.owner).push(i))});const o=[...e];return a.forEach(i=>{const r=i.sort((h,x)=>h.start.getTime()-x.start.getTime());for(let h=1;h<r.length;h++){const x=r[h],l=r[h-1];if(x.start<l.end){const s=o.findIndex(w=>w.id===x.id);if(s>=0){const w=new Date(l.end),p=xe(w,x.duration,"day");o[s]={...x,start:w,end:p}}}}}),o}},Symbol.toStringTag,{value:"Module"})),Xt=e=>{const a=new Map;return e.forEach(o=>{a.set(o.id,{taskId:o.id,start:new Date(o.start),end:new Date(o.end)})}),a},Ut=e=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority"],o=e.map(r=>[r.id,r.text,we(r.start,"YYYY-MM-DD"),we(r.end,"YYYY-MM-DD"),r.duration.toString(),`${r.progress}%`,r.type||"task",r.owner||"",r.priority||"medium"]),i=[a.join(","),...o.map(r=>r.map(h=>`"${h}"`).join(","))].join(`
|
|
16
|
+
`);st(i,"gantt-tasks.csv","text/csv")},qt=e=>{const a=["ID","Task Name","Start Date","End Date","Duration","Progress","Type","Owner","Priority","Details"],o=e.map(r=>[r.id,r.text,we(r.start,"MM/DD/YYYY"),we(r.end,"MM/DD/YYYY"),r.duration.toString(),r.progress.toString(),r.type||"task",r.owner||"",r.priority||"medium",r.details||""]),i="\uFEFF"+[a.join(" "),...o.map(r=>r.map(h=>h.replace(/\t/g," ")).join(" "))].join(`
|
|
17
|
+
`);st(i,"gantt-tasks.xls","application/vnd.ms-excel")},Gt=(e,a)=>{const o={tasks:e,links:a,exported:new Date().toISOString(),version:"1.0"},i=JSON.stringify(o,null,2);st(i,"gantt-project.json","application/json")},Jt=e=>{const a=`
|
|
18
18
|
GANTT CHART PROJECT
|
|
19
19
|
Generated: ${new Date().toLocaleString()}
|
|
20
20
|
|
|
21
21
|
Tasks:
|
|
22
22
|
${e.map((o,i)=>`
|
|
23
23
|
${i+1}. ${o.text}
|
|
24
|
-
Start: ${
|
|
25
|
-
End: ${
|
|
24
|
+
Start: ${we(o.start,"MM/DD/YYYY")}
|
|
25
|
+
End: ${we(o.end,"MM/DD/YYYY")}
|
|
26
26
|
Duration: ${o.duration} days
|
|
27
27
|
Progress: ${o.progress}%
|
|
28
28
|
${o.owner?`Owner: ${o.owner}`:""}
|
|
29
29
|
`).join(`
|
|
30
30
|
`)}
|
|
31
|
-
`.trim();lt(a,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},wr=(e,a,o="png")=>{if(!document.getElementById(e)){alert("Could not find Gantt chart element to export");return}if(o==="svg"){alert("SVG export requires additional library. Use PNG or implement with dom-to-svg.");return}alert("Image export requires html2canvas library. Install with: npm install html2canvas")},lt=(e,a,o)=>{const i=new Blob([e],{type:o}),r=URL.createObjectURL(i);br(r,a),URL.revokeObjectURL(r)},br=(e,a)=>{const o=document.createElement("a");o.href=e,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o)},Sr=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:Xt,exportToExcel:Vt,exportToImage:wr,exportToJSON:qt,exportToPDF:Gt,importFromJSON:e=>new Promise((a,o)=>{const i=new FileReader;i.onload=r=>{try{const f=r.target?.result,g=JSON.parse(f),l=g.tasks.map(s=>({...s,start:new Date(s.start),end:new Date(s.end)}));a({tasks:l,links:g.links||[]})}catch{o(new Error("Invalid JSON file"))}},i.onerror=()=>o(new Error("Failed to read file")),i.readAsText(e)})},Symbol.toStringTag,{value:"Module"})),Jt=(e,a)=>e.filter(o=>{if(a.searchText){const i=a.searchText.toLowerCase(),r=o.text.toLowerCase().includes(i),f=o.owner?.toLowerCase().includes(i),g=o.details?.toLowerCase().includes(i);if(!r&&!f&&!g)return!1}if(a.status!=="all"&&(o.progress===0?"not-started":o.progress===100?"completed":"in-progress")!==a.status||a.priority!=="all"&&o.priority!==a.priority||a.owner&&o.owner!==a.owner)return!1;if(a.dateRange){const i=o.start.getTime(),r=a.dateRange.start.getTime(),f=a.dateRange.end.getTime();if(i<r||i>f)return!1}return!0}),et=1440*60*1e3,Ee=(e,a)=>{if(e instanceof Date){const o=new Date(e.getTime());return Number.isNaN(o.getTime())?new Date(a.getTime()):o}if(typeof e=="string"||typeof e=="number"){const o=new Date(e);if(!Number.isNaN(o.getTime()))return o}return new Date(a.getTime())},vt=(e,a)=>{if(e==null||e==="")return a;const o=Number(e);return Number.isFinite(o)?o:a},vr=(e,a,o)=>{if(!Array.isArray(e)||e.length===0)return;const i=a.getTime(),r=o.getTime();return e.map(f=>{const g=Ee(f?.start,a),l=Ee(f?.end,o),s=Math.max(g.getTime(),i),w=Math.min(l.getTime(),r);return{start:new Date(s),end:new Date(w)}}).filter(f=>f.end.getTime()>f.start.getTime())},jr=(e,a,o)=>{if(Array.isArray(e))return e.map(i=>{const r=Ee(i?.start,a),f=Ee(i?.end,o),g=f.getTime()<r.getTime()?r:f,l=Math.max(Math.ceil((g.getTime()-r.getTime())/et),0);return{start:r,end:g,duration:vt(i?.duration,l)}}).filter(i=>i.end.getTime()>=i.start.getTime())},Tr=e=>{const a=new Date,o=Ee(e.start,a),i=Ee(e.end,o),r=i.getTime()<o.getTime()?o:i,f=Ee(e.plannedStart??e.planned_start,o),g=Ee(e.plannedEnd??e.planned_end,r),l=g.getTime()<f.getTime()?f:g,s=Ee(e.actualStart??e.actual_start,o),w=Ee(e.actualEnd??e.actual_end,r),u=w.getTime()<s.getTime()?s:w,p=Math.max(Math.ceil((r.getTime()-o.getTime())/et),0),L=e.dependencies;let h;Array.isArray(L)?h=L.map(D=>String(D)):typeof L=="string"&&(h=L.split(",").map(D=>D.trim()).filter(Boolean));const E=vr(e.onHoldPeriods??e.on_hold_periods,o,r);return{id:String(e.id),text:e.text||e.name||e.title||`Task ${String(e.id)}`,start:o,end:r,plannedStart:f,plannedEnd:l,actualStart:s,actualEnd:u,duration:vt(e.duration,p),progress:Math.max(0,Math.min(100,vt(e.progress,0))),type:e.type,parent:e.parent!==void 0&&e.parent!==null&&String(e.parent).length>0?String(e.parent):void 0,open:e.open,color:e.color,details:e.details,owner:e.owner,priority:e.priority,status:e.status,onHoldPeriods:E,dependencies:h,segments:jr(e.segments,o,r),sequence_id:e.sequence_id,stage_id:e.stage_id}},Dr=e=>Array.isArray(e)?e.map(Tr):[],Mr=(e,a)=>{if(a.length===0)return e;const o=[...a].sort((i,r)=>i.start.getTime()-r.start.getTime());return e.map(i=>{if(i.onHoldPeriods&&i.onHoldPeriods.length>0||i.segments&&i.segments.length>0)return i;const r=i.start.getTime(),g=i.end.getTime()-r;if(g<=0){for(const h of o)if(r>=h.start.getTime()&&r<h.end.getTime())return{...i,start:new Date(h.end.getTime()),end:new Date(h.end.getTime())};return i}let l=r,s=0,w=0;const u=[],p=[];for(;s<g;){for(;w<o.length&&o[w].end.getTime()<=l;)w++;if(w<o.length){const h=o[w],E=h.start.getTime(),D=h.end.getTime();if(l<E){const A=E-l,S=Math.min(A,g-s);if(u.push({start:new Date(l),end:new Date(l+S),duration:Math.ceil(S/et)}),s+=S,l+=S,s>=g)break;p.push({start:new Date(E),end:new Date(D)}),l=D,w++}else p.push({start:new Date(l),end:new Date(D)}),l=D,w++}else{const h=g-s;u.push({start:new Date(l),end:new Date(l+h),duration:Math.ceil(h/et)}),s=g}}if(p.length===0)return i;const L=u.length>0?u[u.length-1].end:i.end;return{...i,end:L,duration:Math.max(Math.ceil((L.getTime()-r)/et),0),segments:u,onHoldPeriods:p}})},Er=e=>[{name:"index",label:"",width:40,align:"center"},{name:"text",label:e?.columnLabels?.name||"Name",width:250,align:"left",resize:!0},{name:"predecessors",label:e?.columnLabels?.dependsOn||"Depends on",width:120,align:"left"},{name:"duration",label:e?.columnLabels?.duration||"Duration",width:110,align:"left"},{name:"start",label:e?.columnLabels?.start||"Start",width:130,align:"left"},{name:"add",label:"",width:50,align:"center"}],Lr=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],Fr={showTaskName:!0,showPlannedDates:!0,showActualDates:!0,showStatus:!0,showDependencyRule:!0,showProgress:!0,showOwner:!0,plannedLabel:"Planned",actualLabel:"Actual",statusLabel:"Status",dependencyRuleLabel:"Dependency Rule",progressLabel:"Progress",ownerLabel:"Owner",dateFormat:"MMM D, YYYY",dependencySeparator:" | ",emptyStatusText:"Not set",emptyDependencyRuleText:"No dependency rule"},kr={headerTitle:"Iris Gantt",showHeader:!0,showAddTaskButton:!0,showBaselineButton:!1,showZoomButtons:!0,showExportButtons:!0,showFilterSearch:!0,addTaskButtonText:"New Task",baselineButtonText:"Set Baseline",baselineButtonTextActive:"Baselines",zoomOutTooltip:"Zoom Out",zoomInTooltip:"Zoom In",resetZoomTooltip:"Reset Zoom",exportCSVTooltip:"Export to CSV",exportExcelTooltip:"Export to Excel",exportJSONTooltip:"Export to JSON",exportPDFTooltip:"Export to PDF",hideBaselinesTooltip:"Hide Baselines",showBaselinesTooltip:"Show Baselines",taskCreatorTitle:"Create New Task",taskCreatorOkText:"Create Task",taskCreatorCancelText:"Cancel",taskNameLabel:"Task Name",taskNamePlaceholder:"Enter task name",typeLabel:"Type",priorityLabel:"Priority",startDateLabel:"Start Date",durationLabel:"Duration (days)",colorLabel:"Color",progressLabel:"Progress (%)",ownerLabel:"Owner",ownerPlaceholder:"Assign to...",detailsLabel:"Details",detailsPlaceholder:"Add task description...",taskTypeOptions:{task:"Task",milestone:"Milestone",project:"Project"},priorityOptions:{low:"Low",medium:"Medium",high:"High"},taskEditorTitle:"Edit Task",taskEditorSaveText:"Save Changes",taskEditorCancelText:"Cancel",taskEditorDeleteText:"Delete",deleteConfirmTitle:"Delete Task",deleteConfirmContent:"This action cannot be undone.",deleteConfirmOkText:"Yes, Delete",deleteConfirmCancelText:"No",searchPlaceholder:"Search tasks...",allOwnersText:"All Owners",allStatusText:"All Status",allPriorityText:"All Priority",clearFiltersText:"Clear",statusOptions:{all:"All Status",notStarted:"Not Started",inProgress:"In Progress",completed:"Completed"},priorityFilterOptions:{all:"All Priority",low:"Low",medium:"Medium",high:"High"},columnLabels:{name:"Name",dependsOn:"Depends on",duration:"Duration",start:"Start"},taskNameRequired:"Please enter task name"},Pr=({tasks:e=[],links:a=[],config:o={},uiConfig:i={},styleConfig:r={},iconConfig:f={},taskTooltipConfig:g={},onHoldPeriods:l,onTaskUpdate:s,onTaskCreate:w,onTaskDelete:u,onLinkCreate:p,onLinkDelete:L,baselines:h})=>{const E={...kr,...i},D={...Fr,...g},A=y.useMemo(()=>{const d={};return r.primary&&(d["--wx-gantt-primary"]=r.primary),r.primarySelected&&(d["--wx-gantt-primary-selected"]=r.primarySelected),r.success&&(d["--wx-gantt-success"]=r.success),r.warning&&(d["--wx-gantt-warning"]=r.warning),r.danger&&(d["--wx-gantt-danger"]=r.danger),r.background&&(d["--wx-gantt-background"]=r.background),r.backgroundAlt&&(d["--wx-gantt-background-alt"]=r.backgroundAlt),r.backgroundHover&&(d["--wx-gantt-background-hover"]=r.backgroundHover),r.selectColor&&(d["--wx-gantt-select-color"]=r.selectColor),r.taskColor&&(d["--wx-gantt-task-color"]=r.taskColor),r.taskFillColor&&(d["--wx-gantt-task-fill-color"]=r.taskFillColor),r.projectColor&&(d["--wx-gantt-project-color"]=r.projectColor),r.milestoneColor&&(d["--wx-gantt-milestone-color"]=r.milestoneColor),r.fontColor&&(d["--wx-gantt-font-color"]=r.fontColor),r.fontColorAlt&&(d["--wx-gantt-font-color-alt"]=r.fontColorAlt),r.iconColor&&(d["--wx-gantt-icon-color"]=r.iconColor),r.borderColor&&(d["--wx-gantt-border-color"]=r.borderColor),r.fontFamily&&(d["--wx-gantt-font-family"]=r.fontFamily),r.fontMono&&(d["--wx-gantt-font-mono"]=r.fontMono),r.fontSize&&(d["--wx-gantt-font-size"]=r.fontSize),r.fontWeight&&(d["--wx-gantt-font-weight"]=String(r.fontWeight)),r.lineHeight&&(d["--wx-gantt-line-height"]=String(r.lineHeight)),r.spacingXS&&(d["--gantt-spacing-xs"]=r.spacingXS),r.spacingSM&&(d["--gantt-spacing-sm"]=r.spacingSM),r.spacingMD&&(d["--gantt-spacing-md"]=r.spacingMD),r.spacingLG&&(d["--gantt-spacing-lg"]=r.spacingLG),r.customCSSVariables&&Object.entries(r.customCSSVariables).forEach(([v,N])=>{d[v.startsWith("--")?v:`--${v}`]=N}),d},[r]),S=y.useMemo(()=>{if(!l||l.length===0)return[];const d=new Date;return l.map(v=>({start:Ee(v.start,d),end:Ee(v.end,d)})).filter(v=>v.end.getTime()>v.start.getTime())},[l]),k=y.useMemo(()=>{const d=Dr(e);return Mr(d,S)},[e,S]),B=Array.isArray(a)?a:[],{tasks:O,links:M,setTasks:W,setLinks:G,undo:T,redo:V,updateTask:U,createTask:j,deleteTask:H,saveState:K}=Wt(k,B),[J,Z]=y.useState(O),[fe,xe]=y.useState(null),[I,pe]=y.useState(null),[he,ye]=y.useState(!1),[ne,se]=y.useState(void 0),[oe,Se]=y.useState(void 0),[ce,De]=y.useState(!1),[we,m]=y.useState(null),[F,P]=y.useState(null),[C,ie]=y.useState(null),[ae,te]=y.useState(null),[ee,ve]=y.useState(null),[Fe,Me]=y.useState(1),[Oe,Be]=y.useState(()=>h&&h.size>0?h:k.length>0?Ut(k):new Map);y.useEffect(()=>{h&&h.size>0&&Be(h)},[h]);const[Ie]=y.useState(o.theme||"light"),[dt,jt]=y.useState({searchText:"",status:"all",priority:"all",owner:""}),tt=y.useRef(null),qe=y.useRef(null),ct=y.useRef(null),ut=y.useRef(null),Ne=y.useRef(!1),ke=y.useRef(null),Le={columns:o.columns||Er(i),scales:Lr,readonly:!1,editable:!0,taskHeight:28,rowHeight:48,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:!0,weekends:!0,holidays:[],theme:Ie,locale:"en",showTodayLine:o.showTodayLine!==!1,todayLineColor:o.todayLineColor||"#ff4d4f",todayLineLabel:o.todayLineLabel!==void 0?o.todayLineLabel:"Today",todayLineWidth:o.todayLineWidth||1,todayLineStyle:o.todayLineStyle||"solid",todayLineOpacity:o.todayLineOpacity!==void 0?o.todayLineOpacity:1,todayLineLabelStyle:o.todayLineLabelStyle,showTodayLineMarker:o.showTodayLineMarker!==!1,todayLineMarkerSize:o.todayLineMarkerSize||8,todayLineMarkerStyle:o.todayLineMarkerStyle||"triangle",showProjectStartLine:o.showProjectStartLine!==!1,projectStartDate:o.projectStartDate,projectStartLineColor:o.projectStartLineColor||"#40a9ff",projectStartLineLabel:o.projectStartLineLabel!==void 0?o.projectStartLineLabel:"Start Project",projectStartLineWidth:o.projectStartLineWidth||1,projectStartLineStyle:o.projectStartLineStyle||"solid",projectStartLineOpacity:o.projectStartLineOpacity!==void 0?o.projectStartLineOpacity:1,projectStartLineLabelStyle:o.projectStartLineLabelStyle,showProjectStartLineMarker:o.showProjectStartLineMarker!==!1,projectStartLineMarkerSize:o.projectStartLineMarkerSize||8,projectStartLineMarkerStyle:o.projectStartLineMarkerStyle||"triangle",...o};y.useEffect(()=>{const d=Jt(O,dt);Z((N=>{const n=[],c=b=>{if(!b)return!1;const $=N.find(_=>_.id===b);return $&&!$.open&&$.type==="project"?!0:c($?.parent)};return N.forEach(b=>{c(b.parent)||n.push(b)}),n})(d))},[O,dt]);const Tt=y.useMemo(()=>{if(!O||!Array.isArray(O))return[];try{return Array.from(new Set(O.map(d=>d?.owner).filter(Boolean)))}catch(d){return console.warn("Error extracting owners:",d),[]}},[O]),Dt=(()=>{const d=J.length>0?J:O;if(d.length===0){const b=new Date;return{start:Re(me(b,-30,"day")),end:Re(me(b,60,"day"))}}const v=d.map(b=>b.start.getTime()),N=d.map(b=>b.end.getTime()),n=new Date(Math.min(...v)),c=new Date(Math.max(...N));return{start:Re(me(n,-7,"day")),end:Re(c)}})(),Mt=d=>{xe(d)},Et=(d,v)=>{if(Le.readonly)return;d.preventDefault();const N=O.find(n=>n.id===v);N&&ve({x:d.clientX,y:d.clientY,task:N})},Lt=()=>{if(!ee?.task)return;const d=ee.task,v={...d,id:`task-${Date.now()}`,text:`${d.text} (Copy)`,start:me(d.start,7,"day"),end:me(d.end,7,"day")};j(v),w&&w(v)},ze=d=>{if(!ee?.task)return;const v={...ee.task,type:d};U(v),s&&s(v)},We=y.useCallback((d,v)=>{let N=[];return v.filter(c=>c.parent===d).forEach(c=>{N.push(c.id),N=[...N,...We(c.id,v)]}),N},[]),$e=(d,v)=>(d??null)===(v??null),rt=(d,v,N,n)=>{if(!Le.readonly)if(n==="reorder"){const c=J.findIndex($=>$.id===d),b=We(d,O);ie({id:d,initialIndex:c,currentX:v,currentY:N,descendantIds:b}),document.body.classList.add("gantt-dragging")}else P(d)},nt=()=>{if(C&&ae){const d=O.find(N=>N.id===C.id),v=O.find(N=>N.id===ae.taskId);if(d&&v&&d.id!==v.id){const N=[d.id,...C.descendantIds];if(!N.includes(v.id)){const n=[...O],c=(ae.position==="inside"?v.id:v.parent)??void 0,b=n.findIndex(q=>q.id===d.id);b!==-1&&(n[b]={...n[b],parent:c});const $=n.filter(q=>N.includes(q.id)),_=n.filter(q=>!N.includes(q.id));let R=_.findIndex(q=>q.id===v.id);if(ae.position==="inside"){const q=[v.id,...We(v.id,_)],be=q[q.length-1];R=_.findIndex(st=>st.id===be)+1}else if(ae.position==="below"){const q=We(v.id,_);q.length>0?R=_.findIndex(be=>be.id===q[q.length-1])+1:R++}R<0&&(R=_.length);const z={tasks:[...O],links:[...M]};_.splice(R,0,...$),W(_),K("task_update",z,{tasks:_,links:M});const le=O.filter(q=>$e(q.parent,d.parent)).findIndex(q=>q.id===d.id)+1,de=_.filter(q=>$e(q.parent,c)).findIndex(q=>q.id===d.id)+1,je={currentSequenceId:le,targetSequenceId:de,targetStageId:c??null},Ce=_.find(q=>q.id===d.id);if(Ce&&s){const q={...Ce,sequence_id:de,stage_id:c??null};s(q,je)}}}}P(null),ie(null),te(null),document.body.classList.remove("gantt-dragging")},Ge=y.useRef(null),Ft=y.useCallback(d=>{if(C){const{clientX:v,clientY:N}=d;Ge.current&&cancelAnimationFrame(Ge.current),Ge.current=requestAnimationFrame(()=>{const n=Le.rowHeight||48,c=qe.current?.querySelector(".gantt-grid-body");if(!c||J.length===0){te(null);return}const b=c.getBoundingClientRect(),$=N-b.top+c.scrollTop;let _=Math.floor($/n);_=Math.max(0,Math.min(_,J.length-1));const R=J[_];if(R){if(R.id===C.id||C.descendantIds.includes(R.id)){te(null),ie(re=>re?{...re,currentX:v,currentY:N}:null);return}const Y=$-_*n;let le="above";R.type!=="milestone"?Y<n*.3?le="above":Y>n*.7?le="below":le="inside":le=Y<n/2?"above":"below",te({taskId:R.id,position:le})}ie(z=>z?{...z,currentX:v,currentY:N}:null)})}},[C,J,Le.rowHeight]),ot=()=>{C&&nt()},kt=(d,v)=>{const N={...d,id:`task-${Date.now()}`,parent:v};j(N);const n={taskId:N.id,start:new Date(N.start),end:new Date(N.end)};Be(c=>{const b=new Map(c);return b.set(N.id,n),b}),w&&w(N)},He=d=>{U(d),s&&s(d)},at=d=>{H(d),Be(v=>{const N=new Map(v);return N.delete(d),N}),u&&u(d)},pt=(d,v,N,n)=>{const c={id:`link-${Date.now()}`,source:d,target:v,type:N,lag:n};G([...M,c]),p&&p(c)},ht=d=>{const v=M.filter(N=>N.id!==d);G(v),L&&L(d)};y.useEffect(()=>{const d=new Map(Oe);let v=!1;O.forEach(n=>{Oe.has(n.id)||(d.set(n.id,{taskId:n.id,start:new Date(n.start),end:new Date(n.end)}),v=!0)});const N=new Set(O.map(n=>n.id));Oe.forEach((n,c)=>{N.has(c)||(d.delete(c),v=!0)}),v&&Be(d)},[O]),y.useEffect(()=>{const d=v=>{(v.ctrlKey||v.metaKey)&&(v.key==="z"&&!v.shiftKey?(v.preventDefault(),T()):(v.key==="y"||v.key==="z"&&v.shiftKey)&&(v.preventDefault(),V()))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[T,V]),y.useEffect(()=>{const d=qe.current?.querySelector(".gantt-grid-body"),v=tt.current?.querySelector(".gantt-timeline-body");if(!d||!v)return;const N=()=>{Ne.current||(Ne.current=!0,v.scrollTop=d.scrollTop,ke.current&&clearTimeout(ke.current),ke.current=window.setTimeout(()=>{Ne.current=!1},150))},n=()=>{Ne.current||(Ne.current=!0,d.scrollTop=v.scrollTop,ke.current&&clearTimeout(ke.current),ke.current=window.setTimeout(()=>{Ne.current=!1},150))};return d.addEventListener("scroll",N,{passive:!0}),v.addEventListener("scroll",n,{passive:!0}),()=>{d.removeEventListener("scroll",N),v.removeEventListener("scroll",n),ke.current&&clearTimeout(ke.current)}},[J]);const mt={height:o.containerHeight||"100%",minHeight:o.containerMinHeight||"400px"},ft={"--gantt-row-height":`${Le.rowHeight||48}px`},Pt=o.gridWidth?{"--gantt-grid-width":o.gridWidth}:{};return t.jsxs("div",{className:`gantt-page-wrapper theme-${Ie}`,style:{...mt,...A},children:[E.showHeader&&t.jsx("div",{className:"gantt-page-header",children:t.jsx("div",{className:"gantt-page-header-left",children:t.jsx("h1",{className:"gantt-page-title",children:E.headerTitle})})}),t.jsxs("div",{className:`gantt-container theme-${Le.theme}`,ref:ut,style:{...Pt,...ft},children:[t.jsx(It,{zoomLevel:Fe,setZoomLevel:Me,onExport:d=>{d==="csv"&&Xt(O),d==="excel"&&Vt(O),d==="json"&&qt(O,M),d==="pdf"&&Gt(O)},onFilterChange:d=>jt(d),owners:Tt||[],onAddTask:d=>{if(d){const v=O.find(N=>N.id===d);se(d),Se(v?.text)}else se(void 0),Se(void 0);ye(!0)},uiConfig:E,iconConfig:f,styleConfig:r}),t.jsxs("div",{className:"gantt-layout",ref:ct,onMouseMove:Ft,onMouseUp:ot,onMouseLeave:ot,children:[t.jsx(wt,{ref:qe,tasks:J,columns:Le.columns||[],selectedTask:fe,onTaskClick:Mt,onTaskContextMenu:Et,onTaskUpdate:He,onTaskDragStart:rt,onAddTask:d=>{if(d){const v=O.find(N=>N.id===d);se(d),Se(v?.text)}else se(void 0),Se(void 0);ye(!0)},onAddDependency:pt,onRemoveDependency:ht,onDependencyClick:d=>{const v=O.find(N=>N.id===d);v&&(m(v),De(!0))},links:M,allTasks:O,dropIndicator:ae,reorderTask:C,iconConfig:f,styleConfig:r}),t.jsx(St,{ref:tt,tasks:J,links:M,range:Dt,scales:Le.scales,config:Le,selectedTask:fe,draggedTask:F,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(d,v)=>{const N=O.find(n=>n.id===d);N&&He({...N,...v})},zoomLevel:Fe,baselines:Oe,taskTooltipConfig:D})]}),he&&t.jsx(Rt,{onCreateTask:kt,onClose:()=>{ye(!1),se(void 0),Se(void 0)},uiConfig:E,parentId:ne,parentTaskName:oe,styleConfig:r}),I&&t.jsx(Yt,{task:I,onUpdate:He,onDelete:at,onClose:()=>pe(null),uiConfig:E,styleConfig:r}),ce&&we&&t.jsx(zt,{task:we,allTasks:O,links:M,onAddDependency:pt,onRemoveDependency:ht,onTaskUpdate:He,onClose:()=>{De(!1),m(null)},styleConfig:r}),ee&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>ve(null),onContextMenu:d=>{d.preventDefault(),ve(null)}}),t.jsx(fr,{x:ee.x,y:ee.y,task:ee.task,onEdit:()=>{ee.task&&pe(ee.task)},onDelete:()=>{ee.task&&at(ee.task.id)},onCopy:Lt,onDependencies:()=>{ee.task&&(m(ee.task),De(!0))},onConvertToMilestone:()=>ze("milestone"),onConvertToTask:()=>ze("task"),onConvertToProject:()=>ze("project"),onClose:()=>ve(null),onAutoSchedule:()=>{const d=Ht(O,M,{mode:"forward"});W(d),ve(null)},iconConfig:f,styleConfig:r})]}),C&&(()=>{const d=O.find(R=>R.id===C.id);if(!d)return null;const v=Number.isFinite(C.currentX)?C.currentX:0,N=Number.isFinite(C.currentY)?C.currentY:0,n=Le.rowHeight||48,b=ut.current?.getBoundingClientRect(),$=b?v-b.left+12:v+12,_=b?N-b.top+12:N+12;return t.jsxs("div",{className:"gantt-drag-preview",style:{height:n,top:_,left:$,position:"absolute",pointerEvents:"none",zIndex:9999,maxWidth:"420px"},children:[t.jsx("span",{className:"gantt-drag-preview-name",title:d.text,children:d.text}),C.descendantIds.length>0&&t.jsxs("span",{className:"gantt-drag-preview-count",children:["+",C.descendantIds.length]})]})})()]})]})},Or=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(e,a)=>{const o=new Set,i=new Map,r=new Map,f=new Map;e.forEach(h=>{r.set(h.id,[]),f.set(h.id,[])}),a.forEach(h=>{h.type==="e2s"&&(r.get(h.source)?.push(h.target),f.get(h.target)?.push(h.source))});const g=new Map,l=new Map,s=(h,E=new Set)=>{if(E.has(h))return;E.add(h);const D=e.find(S=>S.id===h);if(!D)return;const A=f.get(h)||[];if(A.length===0)g.set(h,0),l.set(h,D.duration);else{let S=0;A.forEach(k=>{s(k,E);const B=l.get(k)||0;S=Math.max(S,B)}),g.set(h,S),l.set(h,S+D.duration)}};e.forEach(h=>s(h.id));const w=new Map,u=new Map,p=Math.max(...Array.from(l.values())),L=(h,E=new Set)=>{if(E.has(h))return;E.add(h);const D=e.find(S=>S.id===h);if(!D)return;const A=r.get(h)||[];if(A.length===0)u.set(h,p),w.set(h,p-D.duration);else{let S=1/0;A.forEach(k=>{L(k,E);const B=w.get(k)||0;S=Math.min(S,B)}),u.set(h,S),w.set(h,S-D.duration)}};return e.forEach(h=>L(h.id)),e.forEach(h=>{const E=g.get(h.id)||0,A=(w.get(h.id)||0)-E;i.set(h.id,A),Math.abs(A)<.01&&o.add(h.id)}),{criticalTasks:o,taskFloats:i,projectDuration:p}},getTaskFloat:(e,a)=>a.taskFloats.get(e)||0,isCriticalTask:(e,a)=>a.criticalTasks.has(e)},Symbol.toStringTag,{value:"Module"}));X.AutoScheduler=yr,X.Chart=St,X.CriticalPath=Or,X.DependencyEditor=zt,X.ExportUtils=Sr,X.FilterSearch=Bt,X.Gantt=Pr,X.Grid=wt,X.TaskBar=_t,X.TaskCreator=Rt,X.TaskEditor=Yt,X.Timeline=bt,X.Toolbar=It,X.addToDate=me,X.applyFilters=Jt,X.calculateDuration=rr,X.createBaseline=Ut,X.formatDate=ge,X.getDaysBetween=Ze,X.getEndOfDay=tr,X.getHoursBetween=At,X.getStartOfDay=Re,X.isHoliday=gt,X.isWeekend=xt,X.useUndoRedo=Wt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|
|
31
|
+
`.trim();st(a,"gantt-report.txt","text/plain"),alert("PDF export is a simplified text version. For full PDF with charts, a PDF library would be needed.")},br=(e,a,o="png")=>{if(!document.getElementById(e)){alert("Could not find Gantt chart element to export");return}if(o==="svg"){alert("SVG export requires additional library. Use PNG or implement with dom-to-svg.");return}alert("Image export requires html2canvas library. Install with: npm install html2canvas")},st=(e,a,o)=>{const i=new Blob([e],{type:o}),r=URL.createObjectURL(i);Sr(r,a),URL.revokeObjectURL(r)},Sr=(e,a)=>{const o=document.createElement("a");o.href=e,o.download=a,document.body.appendChild(o),o.click(),document.body.removeChild(o)},vr=Object.freeze(Object.defineProperty({__proto__:null,exportToCSV:Ut,exportToExcel:qt,exportToImage:br,exportToJSON:Gt,exportToPDF:Jt,importFromJSON:e=>new Promise((a,o)=>{const i=new FileReader;i.onload=r=>{try{const h=r.target?.result,x=JSON.parse(h),l=x.tasks.map(s=>({...s,start:new Date(s.start),end:new Date(s.end)}));a({tasks:l,links:x.links||[]})}catch{o(new Error("Invalid JSON file"))}},i.onerror=()=>o(new Error("Failed to read file")),i.readAsText(e)})},Symbol.toStringTag,{value:"Module"})),Kt=(e,a)=>e.filter(o=>{if(a.searchText){const i=a.searchText.toLowerCase(),r=o.text.toLowerCase().includes(i),h=o.owner?.toLowerCase().includes(i),x=o.details?.toLowerCase().includes(i);if(!r&&!h&&!x)return!1}if(a.status!=="all"&&(o.progress===0?"not-started":o.progress===100?"completed":"in-progress")!==a.status||a.priority!=="all"&&o.priority!==a.priority||a.owner&&o.owner!==a.owner)return!1;if(a.dateRange){const i=o.start.getTime(),r=a.dateRange.start.getTime(),h=a.dateRange.end.getTime();if(i<r||i>h)return!1}return!0}),Ze=1440*60*1e3,Me=(e,a)=>{if(e instanceof Date){const o=new Date(e.getTime());return Number.isNaN(o.getTime())?new Date(a.getTime()):o}if(typeof e=="string"||typeof e=="number"){const o=new Date(e);if(!Number.isNaN(o.getTime()))return o}return new Date(a.getTime())},Tt=(e,a)=>{if(e==null||e==="")return a;const o=Number(e);return Number.isFinite(o)?o:a},jr=e=>{if(Array.isArray(e)){const a=e.map(o=>String(o).trim()).filter(Boolean);return a.length>0?a:void 0}if(typeof e=="string"){const a=e.split(/[|,]/).map(o=>o.trim()).filter(Boolean);return a.length>0?a:void 0}},Tr=e=>{if(Array.isArray(e)){const a=e.map(o=>String(o).trim()).filter(Boolean);return a.length>0?a:void 0}if(typeof e=="string"){const a=e.split(/\r?\n|\|/).map(o=>o.trim()).filter(Boolean);return a.length>0?a:void 0}},Dr=(e,a,o)=>{if(!Array.isArray(e)||e.length===0)return;const i=a.getTime(),r=o.getTime();return e.map(h=>{const x=Me(h?.start,a),l=Me(h?.end,o),s=Math.max(x.getTime(),i),w=Math.min(l.getTime(),r);return{start:new Date(s),end:new Date(w)}}).filter(h=>h.end.getTime()>h.start.getTime())},Mr=(e,a,o)=>{if(Array.isArray(e))return e.map(i=>{const r=Me(i?.start,a),h=Me(i?.end,o),x=h.getTime()<r.getTime()?r:h,l=Math.max(Math.ceil((x.getTime()-r.getTime())/Ze),0);return{start:r,end:x,duration:Tt(i?.duration,l)}}).filter(i=>i.end.getTime()>=i.start.getTime())},Er=e=>{const a=new Date,o=Me(e.start??e.startDate??e.start_date,a),i=Me(e.end??e.endDate??e.end_date,o),r=i.getTime()<o.getTime()?o:i,h=Me(e.plannedStart??e.planned_start??e.planned_start_date,o),x=Me(e.plannedEnd??e.planned_end??e.planned_end_date,r),l=x.getTime()<h.getTime()?h:x,s=Me(e.actualStart??e.actual_start??e.actual_start_date,o),w=Me(e.actualEnd??e.actual_end??e.actual_end_date,r),p=w.getTime()<s.getTime()?s:w,S=Math.max(Math.ceil((r.getTime()-o.getTime())/Ze),0),P=jr(e.dependencies??e.dependsOn??e.depends_on),m=Tr(e.dependencyRule??e.dependency_rule??e.dependencyRuleDescription??e.dependency_rule_description),T=Dr(e.onHoldPeriods??e.on_hold_periods,o,r);return{id:String(e.id),rawId:e.id,text:e.text||e.name||e.title||e.taskName||e.task_name||`Task ${String(e.id)}`,start:o,end:r,plannedStart:h,plannedEnd:l,actualStart:s,actualEnd:p,duration:Tt(e.duration,S),progress:Math.max(0,Math.min(100,Tt(e.progress??e.progressPercentage??e.progress_percentage,0))),type:e.type,parent:e.parent!==void 0&&e.parent!==null&&String(e.parent).length>0?String(e.parent):void 0,open:e.open,color:e.color,details:e.details,owner:e.owner||e.ownerName||e.owner_name,priority:e.priority,status:e.status??e.currentStatus??e.current_status,onHoldPeriods:T,dependencies:P,dependencyRule:m,segments:Mr(e.segments,o,r),sequence_id:e.sequence_id,stage_id:e.stage_id,tooltipConfig:e.tooltipConfig}},Lr=e=>Array.isArray(e)?e.map(Er):[],Fr=(e,a)=>{if(a.length===0)return e;const o=[...a].sort((i,r)=>i.start.getTime()-r.start.getTime());return e.map(i=>{if(i.onHoldPeriods&&i.onHoldPeriods.length>0||i.segments&&i.segments.length>0)return i;const r=i.start.getTime(),x=i.end.getTime()-r;if(x<=0){for(const m of o)if(r>=m.start.getTime()&&r<m.end.getTime())return{...i,start:new Date(m.end.getTime()),end:new Date(m.end.getTime())};return i}let l=r,s=0,w=0;const p=[],S=[];for(;s<x;){for(;w<o.length&&o[w].end.getTime()<=l;)w++;if(w<o.length){const m=o[w],T=m.start.getTime(),M=m.end.getTime();if(l<T){const C=T-l,j=Math.min(C,x-s);if(p.push({start:new Date(l),end:new Date(l+j),duration:Math.ceil(j/Ze)}),s+=j,l+=j,s>=x)break;S.push({start:new Date(T),end:new Date(M)}),l=M,w++}else S.push({start:new Date(l),end:new Date(M)}),l=M,w++}else{const m=x-s;p.push({start:new Date(l),end:new Date(l+m),duration:Math.ceil(m/Ze)}),s=x}}if(S.length===0)return i;const P=p.length>0?p[p.length-1].end:i.end;return{...i,end:P,duration:Math.max(Math.ceil((P.getTime()-r)/Ze),0),segments:p,onHoldPeriods:S}})},Pr=e=>[{name:"index",label:"",width:40,align:"center"},{name:"text",label:e?.columnLabels?.name||"Name",width:250,align:"left",resize:!0},{name:"predecessors",label:e?.columnLabels?.dependsOn||"Depends on",width:120,align:"left"},{name:"duration",label:e?.columnLabels?.duration||"Duration",width:110,align:"left"},{name:"start",label:e?.columnLabels?.start||"Start",width:130,align:"left"}],Nr=[{unit:"month",step:1,format:"MMM"},{unit:"day",step:1,format:"D"}],kr={showTaskName:!0,showPlannedDates:!0,showActualDates:!0,showStatus:!0,showDependencyRule:!0,showProgress:!0,showOwner:!0,plannedLabel:"Planned",actualLabel:"Actual",statusLabel:"Status",dependencyRuleLabel:"Dependency Rule",progressLabel:"Progress",ownerLabel:"Owner",dateFormat:"MMM D, YYYY",dependencySeparator:" | ",emptyStatusText:"Not set",emptyOwnerText:"Not assigned",emptyDependencyRuleText:"No dependency rule"},Or={headerTitle:"Iris Gantt",showHeader:!0,showAddTaskButton:!0,showBaselineButton:!1,showZoomButtons:!0,showExportButtons:!0,showFilterSearch:!0,addTaskButtonText:"New Task",baselineButtonText:"Set Baseline",baselineButtonTextActive:"Baselines",zoomOutTooltip:"Zoom Out",zoomInTooltip:"Zoom In",resetZoomTooltip:"Reset Zoom",exportCSVTooltip:"Export to CSV",exportExcelTooltip:"Export to Excel",exportJSONTooltip:"Export to JSON",exportPDFTooltip:"Export to PDF",hideBaselinesTooltip:"Hide Baselines",showBaselinesTooltip:"Show Baselines",taskCreatorTitle:"Create New Task",taskCreatorOkText:"Create Task",taskCreatorCancelText:"Cancel",taskNameLabel:"Task Name",taskNamePlaceholder:"Enter task name",typeLabel:"Type",priorityLabel:"Priority",startDateLabel:"Start Date",durationLabel:"Duration (days)",colorLabel:"Color",progressLabel:"Progress (%)",ownerLabel:"Owner",ownerPlaceholder:"Assign to...",detailsLabel:"Details",detailsPlaceholder:"Add task description...",taskTypeOptions:{task:"Task",milestone:"Milestone",project:"Project"},priorityOptions:{low:"Low",medium:"Medium",high:"High"},taskEditorTitle:"Edit Task",taskEditorSaveText:"Save Changes",taskEditorCancelText:"Cancel",taskEditorDeleteText:"Delete",deleteConfirmTitle:"Delete Task",deleteConfirmContent:"This action cannot be undone.",deleteConfirmOkText:"Yes, Delete",deleteConfirmCancelText:"No",searchPlaceholder:"Search tasks...",allOwnersText:"All Owners",allStatusText:"All Status",allPriorityText:"All Priority",clearFiltersText:"Clear",statusOptions:{all:"All Status",notStarted:"Not Started",inProgress:"In Progress",completed:"Completed"},priorityFilterOptions:{all:"All Priority",low:"Low",medium:"Medium",high:"High"},columnLabels:{name:"Name",dependsOn:"Depends on",duration:"Duration",start:"Start"},taskNameRequired:"Please enter task name"},$r=({tasks:e=[],links:a=[],config:o={},uiConfig:i={},styleConfig:r={},iconConfig:h={},taskTooltipConfig:x={},onHoldPeriods:l,onTaskUpdate:s,onTaskDragUpdate:w,onTaskCreate:p,onTaskDelete:S,onLinkCreate:P,onLinkDelete:m,baselines:T})=>{const M={...Or,...i},C={...kr,...x},j=y.useMemo(()=>{const u={};return r.primary&&(u["--wx-gantt-primary"]=r.primary),r.primarySelected&&(u["--wx-gantt-primary-selected"]=r.primarySelected),r.success&&(u["--wx-gantt-success"]=r.success),r.warning&&(u["--wx-gantt-warning"]=r.warning),r.danger&&(u["--wx-gantt-danger"]=r.danger),r.background&&(u["--wx-gantt-background"]=r.background),r.backgroundAlt&&(u["--wx-gantt-background-alt"]=r.backgroundAlt),r.backgroundHover&&(u["--wx-gantt-background-hover"]=r.backgroundHover),r.selectColor&&(u["--wx-gantt-select-color"]=r.selectColor),r.taskColor&&(u["--wx-gantt-task-color"]=r.taskColor),r.taskFillColor&&(u["--wx-gantt-task-fill-color"]=r.taskFillColor),r.projectColor&&(u["--wx-gantt-project-color"]=r.projectColor),r.milestoneColor&&(u["--wx-gantt-milestone-color"]=r.milestoneColor),r.fontColor&&(u["--wx-gantt-font-color"]=r.fontColor),r.fontColorAlt&&(u["--wx-gantt-font-color-alt"]=r.fontColorAlt),r.iconColor&&(u["--wx-gantt-icon-color"]=r.iconColor),r.borderColor&&(u["--wx-gantt-border-color"]=r.borderColor),r.fontFamily&&(u["--wx-gantt-font-family"]=r.fontFamily),r.fontMono&&(u["--wx-gantt-font-mono"]=r.fontMono),r.fontSize&&(u["--wx-gantt-font-size"]=r.fontSize),r.fontWeight&&(u["--wx-gantt-font-weight"]=String(r.fontWeight)),r.lineHeight&&(u["--wx-gantt-line-height"]=String(r.lineHeight)),r.spacingXS&&(u["--gantt-spacing-xs"]=r.spacingXS),r.spacingSM&&(u["--gantt-spacing-sm"]=r.spacingSM),r.spacingMD&&(u["--gantt-spacing-md"]=r.spacingMD),r.spacingLG&&(u["--gantt-spacing-lg"]=r.spacingLG),r.customCSSVariables&&Object.entries(r.customCSSVariables).forEach(([D,n])=>{u[D.startsWith("--")?D:`--${D}`]=n}),u},[r]),f=y.useMemo(()=>{if(!l||l.length===0)return[];const u=new Date;return l.map(D=>({start:Me(D.start,u),end:Me(D.end,u)})).filter(D=>D.end.getTime()>D.start.getTime())},[l]),A=y.useMemo(()=>{const u=Lr(e);return Fr(u,f)},[e,f]),K=Array.isArray(a)?a:[],{tasks:k,links:U,setTasks:ee,setLinks:F,undo:J,redo:X,updateTask:E,createTask:W,deleteTask:Q,saveState:oe}=Ht(A,K),[H,he]=y.useState(k),[le,B]=y.useState(null),[ue,me]=y.useState(null),[ye,re]=y.useState(!1),[pe,Z]=y.useState(void 0),[be,ae]=y.useState(void 0),[ve,O]=y.useState(!1),[c,v]=y.useState(null),[$,N]=y.useState(null),[V,se]=y.useState(null),[G,de]=y.useState(null),[ie,je]=y.useState(null),[De,Ve]=y.useState(1),[Ae,Fe]=y.useState(()=>T&&T.size>0?T:A.length>0?Xt(A):new Map);y.useEffect(()=>{T&&T.size>0&&Fe(T)},[T]);const[it]=y.useState(o.theme||"light"),[lt,dt]=y.useState({searchText:"",status:"all",priority:"all",owner:""}),Qe=y.useRef(null),Xe=y.useRef(null),Dt=y.useRef(null),et=y.useRef(null),ke=y.useRef(null),ct=y.useRef(null),Ee={columns:o.columns||Pr(i),scales:Nr,readonly:!1,editable:!0,taskHeight:28,rowHeight:48,scaleHeight:28,columnWidth:80,minColumnWidth:60,autoSchedule:!1,criticalPath:!1,baselines:!0,weekends:!0,holidays:[],theme:it,locale:"en",showTodayLine:o.showTodayLine!==!1,todayLineColor:o.todayLineColor||"#ff4d4f",todayLineLabel:o.todayLineLabel!==void 0?o.todayLineLabel:"Today",todayLineWidth:o.todayLineWidth||1,todayLineStyle:o.todayLineStyle||"solid",todayLineOpacity:o.todayLineOpacity!==void 0?o.todayLineOpacity:1,todayLineLabelStyle:o.todayLineLabelStyle,showTodayLineMarker:o.showTodayLineMarker!==!1,todayLineMarkerSize:o.todayLineMarkerSize||8,todayLineMarkerStyle:o.todayLineMarkerStyle||"triangle",showProjectStartLine:o.showProjectStartLine!==!1,projectStartDate:o.projectStartDate,projectStartLineColor:o.projectStartLineColor||"#40a9ff",projectStartLineLabel:o.projectStartLineLabel!==void 0?o.projectStartLineLabel:"Start Project",projectStartLineWidth:o.projectStartLineWidth||1,projectStartLineStyle:o.projectStartLineStyle||"solid",projectStartLineOpacity:o.projectStartLineOpacity!==void 0?o.projectStartLineOpacity:1,projectStartLineLabelStyle:o.projectStartLineLabelStyle,showProjectStartLineMarker:o.showProjectStartLineMarker!==!1,projectStartLineMarkerSize:o.projectStartLineMarkerSize||8,projectStartLineMarkerStyle:o.projectStartLineMarkerStyle||"triangle",...o};y.useEffect(()=>{const u=Kt(k,lt);he((n=>{const d=[],b=L=>{if(!L)return!1;const I=n.find(R=>R.id===L);return I&&!I.open&&I.type==="project"?!0:b(I?.parent)};return n.forEach(L=>{b(L.parent)||d.push(L)}),d})(u))},[k,lt]);const Mt=y.useMemo(()=>{if(!k||!Array.isArray(k))return[];try{return Array.from(new Set(k.map(u=>u?.owner).filter(Boolean)))}catch(u){return console.warn("Error extracting owners:",u),[]}},[k]),Et=(()=>{const u=H.length>0?H:k;if(u.length===0){const L=new Date;return{start:_e(xe(L,-30,"day")),end:_e(xe(L,60,"day"))}}const D=u.map(L=>L.start.getTime()),n=u.map(L=>L.end.getTime()),d=new Date(Math.min(...D)),b=new Date(Math.max(...n));return{start:_e(xe(d,-7,"day")),end:_e(b)}})(),Lt=u=>{B(u)},Ft=(u,D)=>{if(Ee.readonly)return;u.preventDefault();const n=k.find(d=>d.id===D);n&&je({x:u.clientX,y:u.clientY,task:n})},tt=()=>{if(!ie?.task)return;const u=ie.task,D={...u,id:`task-${Date.now()}`,text:`${u.text} (Copy)`,start:xe(u.start,7,"day"),end:xe(u.end,7,"day")};W(D),p&&p(D)},Ue=u=>{if(!ie?.task)return;const D={...ie.task,type:u};E(D),s&&s(D)},Le=y.useCallback((u,D)=>{let n=[];return D.filter(b=>b.parent===u).forEach(b=>{n.push(b.id),n=[...n,...Le(b.id,D)]}),n},[]),qe=(u,D)=>(u??null)===(D??null),rt=(u,D,n,d)=>{if(!Ee.readonly)if(d==="reorder"){const b=H.findIndex(I=>I.id===u),L=Le(u,k);se({id:u,initialIndex:b,currentX:D,currentY:n,descendantIds:L}),document.body.classList.add("gantt-dragging")}else N(u)},ut=()=>{if(V&&G){const u=k.find(n=>n.id===V.id),D=k.find(n=>n.id===G.taskId);if(u&&D&&u.id!==D.id){const n=[u.id,...V.descendantIds];if(!n.includes(D.id)){const d=[...k],b=(G.position==="inside"?D.id:D.parent)??void 0,L=d.findIndex(Y=>Y.id===u.id);L!==-1&&(d[L]={...d[L],parent:b});const I=d.filter(Y=>n.includes(Y.id)),R=d.filter(Y=>!n.includes(Y.id));let _=R.findIndex(Y=>Y.id===D.id);if(G.position==="inside"){const Y=[D.id,...Le(D.id,R)],Ie=Y[Y.length-1];_=R.findIndex(kt=>kt.id===Ie)+1}else if(G.position==="below"){const Y=Le(D.id,R);Y.length>0?_=R.findIndex(Ie=>Ie.id===Y[Y.length-1])+1:_++}_<0&&(_=R.length);const z={tasks:[...k],links:[...U]};R.splice(_,0,...I),ee(R),oe("task_update",z,{tasks:R,links:U});const te=k.filter(Y=>qe(Y.parent,u.parent)).findIndex(Y=>Y.id===u.id)+1,Se=R.filter(Y=>qe(Y.parent,b)).findIndex(Y=>Y.id===u.id)+1,Oe={currentSequenceId:te,targetSequenceId:Se,targetStageId:b??null},Pe=R.find(Y=>Y.id===u.id);if(Pe){const Y={...Pe,sequence_id:Se,stage_id:b??null};s&&s(Y,Oe),w&&w({task:Y,previousTask:u,dragType:"reorder",reorderMeta:Oe})}}}}N(null),se(null),de(null),document.body.classList.remove("gantt-dragging")},nt=y.useRef(null),pt=y.useCallback(u=>{if(V){const{clientX:D,clientY:n}=u;nt.current&&cancelAnimationFrame(nt.current),nt.current=requestAnimationFrame(()=>{const d=Ee.rowHeight||48,b=Xe.current?.querySelector(".gantt-grid-body");if(!b||H.length===0){de(null);return}const L=b.getBoundingClientRect(),I=n-L.top+b.scrollTop;let R=Math.floor(I/d);R=Math.max(0,Math.min(R,H.length-1));const _=H[R];if(_){if(_.id===V.id||V.descendantIds.includes(_.id)){de(null),se(ce=>ce?{...ce,currentX:D,currentY:n}:null);return}const ge=I-R*d;let te="above";_.type!=="milestone"?ge<d*.3?te="above":ge>d*.7?te="below":te="inside":te=ge<d/2?"above":"below",de({taskId:_.id,position:te})}se(z=>z?{...z,currentX:D,currentY:n}:null)})}},[V,H,Ee.rowHeight]),ht=()=>{V&&ut()},mt=(u,D)=>{const n={...u,id:`task-${Date.now()}`,parent:D};W(n);const d={taskId:n.id,start:new Date(n.start),end:new Date(n.end)};Fe(b=>{const L=new Map(b);return L.set(n.id,d),L}),p&&p(n)},Be=u=>{E(u),s&&s(u)},ft=u=>{Q(u),Fe(D=>{const n=new Map(D);return n.delete(u),n}),S&&S(u)},gt=(u,D,n,d)=>{const b={id:`link-${Date.now()}`,source:u,target:D,type:n,lag:d};F([...U,b]),P&&P(b)},ot=u=>{const D=U.filter(n=>n.id!==u);F(D),m&&m(u)};y.useEffect(()=>{const u=new Map(Ae);let D=!1;k.forEach(d=>{Ae.has(d.id)||(u.set(d.id,{taskId:d.id,start:new Date(d.start),end:new Date(d.end)}),D=!0)});const n=new Set(k.map(d=>d.id));Ae.forEach((d,b)=>{n.has(b)||(u.delete(b),D=!0)}),D&&Fe(u)},[k]),y.useEffect(()=>{const u=D=>{(D.ctrlKey||D.metaKey)&&(D.key==="z"&&!D.shiftKey?(D.preventDefault(),J()):(D.key==="y"||D.key==="z"&&D.shiftKey)&&(D.preventDefault(),X()))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[J,X]),y.useEffect(()=>{const u=Xe.current?.querySelector(".gantt-grid-body"),D=Qe.current?.querySelector(".gantt-timeline-body");if(!u||!D)return;const n=()=>{ke.current!=="timeline"&&(ke.current="grid",D.scrollTop=u.scrollTop,requestAnimationFrame(()=>{ke.current=null}))},d=()=>{ke.current!=="grid"&&(ke.current="timeline",u.scrollTop=D.scrollTop,requestAnimationFrame(()=>{ke.current=null}))};return u.addEventListener("scroll",n,{passive:!0}),D.addEventListener("scroll",d,{passive:!0}),()=>{u.removeEventListener("scroll",n),D.removeEventListener("scroll",d),ct.current&&clearTimeout(ct.current)}},[H]);const xt={height:o.containerHeight||"100%",minHeight:o.containerMinHeight||"400px"},Pt={"--gantt-row-height":`${Ee.rowHeight||48}px`},Nt=o.gridWidth?{"--gantt-grid-width":o.gridWidth}:{};return t.jsxs("div",{className:`gantt-page-wrapper theme-${it}`,style:{...xt,...j},children:[M.showHeader&&t.jsx("div",{className:"gantt-page-header",children:t.jsx("div",{className:"gantt-page-header-left",children:t.jsx("h1",{className:"gantt-page-title",children:M.headerTitle})})}),t.jsxs("div",{className:`gantt-container theme-${Ee.theme}`,ref:et,style:{...Nt,...Pt},children:[t.jsx(It,{zoomLevel:De,setZoomLevel:Ve,onExport:u=>{u==="csv"&&Ut(k),u==="excel"&&qt(k),u==="json"&&Gt(k,U),u==="pdf"&&Jt(k)},onFilterChange:u=>dt(u),owners:Mt||[],onAddTask:u=>{if(u){const D=k.find(n=>n.id===u);Z(u),ae(D?.text)}else Z(void 0),ae(void 0);re(!0)},uiConfig:M,iconConfig:h,styleConfig:r}),t.jsxs("div",{className:"gantt-layout",ref:Dt,onMouseMove:pt,onMouseUp:ht,onMouseLeave:ht,children:[t.jsx(St,{ref:Xe,tasks:H,columns:Ee.columns||[],selectedTask:le,onTaskClick:Lt,onTaskContextMenu:Ft,onTaskUpdate:Be,onTaskDragStart:rt,onAddTask:u=>{if(u){const D=k.find(n=>n.id===u);Z(u),ae(D?.text)}else Z(void 0),ae(void 0);re(!0)},onAddDependency:gt,onRemoveDependency:ot,onDependencyClick:u=>{const D=k.find(n=>n.id===u);D&&(v(D),O(!0))},links:U,allTasks:k,dropIndicator:G,reorderTask:V,iconConfig:h,styleConfig:r}),t.jsx(jt,{ref:Qe,tasks:H,links:U,range:Et,scales:Ee.scales,config:Ee,selectedTask:le,draggedTask:$,onTaskClick:()=>{},onTaskDragStart:()=>{},onTaskDragEnd:()=>{},onTaskUpdate:(u,D,n)=>{const d=k.find(I=>I.id===u);if(!d)return;const b={...d},L={...d,...D};Be(L),n&&w&&w({task:L,previousTask:b,dragType:n.dragType})},zoomLevel:De,baselines:Ae,taskTooltipConfig:C})]}),ye&&t.jsx(zt,{onCreateTask:mt,onClose:()=>{re(!1),Z(void 0),ae(void 0)},uiConfig:M,parentId:pe,parentTaskName:be,styleConfig:r}),ue&&t.jsx(Yt,{task:ue,onUpdate:Be,onDelete:ft,onClose:()=>me(null),uiConfig:M,styleConfig:r}),ve&&c&&t.jsx(Wt,{task:c,allTasks:k,links:U,onAddDependency:gt,onRemoveDependency:ot,onTaskUpdate:Be,onClose:()=>{O(!1),v(null)},styleConfig:r}),ie&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"gantt-context-menu-overlay",onClick:()=>je(null),onContextMenu:u=>{u.preventDefault(),je(null)}}),t.jsx(gr,{x:ie.x,y:ie.y,task:ie.task,onEdit:()=>{ie.task&&me(ie.task)},onDelete:()=>{ie.task&&ft(ie.task.id)},onCopy:tt,onDependencies:()=>{ie.task&&(v(ie.task),O(!0))},onConvertToMilestone:()=>Ue("milestone"),onConvertToTask:()=>Ue("task"),onConvertToProject:()=>Ue("project"),onClose:()=>je(null),onAutoSchedule:()=>{const u=Vt(k,U,{mode:"forward"});ee(u),je(null)},iconConfig:h,styleConfig:r})]}),V&&(()=>{const u=k.find(_=>_.id===V.id);if(!u)return null;const D=Number.isFinite(V.currentX)?V.currentX:0,n=Number.isFinite(V.currentY)?V.currentY:0,d=Ee.rowHeight||48,L=et.current?.getBoundingClientRect(),I=L?D-L.left+12:D+12,R=L?n-L.top+12:n+12;return t.jsxs("div",{className:"gantt-drag-preview",style:{height:d,top:R,left:I,position:"absolute",pointerEvents:"none",zIndex:9999,maxWidth:"420px"},children:[t.jsx("span",{className:"gantt-drag-preview-name",title:u.text,children:u.text}),V.descendantIds.length>0&&t.jsxs("span",{className:"gantt-drag-preview-count",children:["+",V.descendantIds.length]})]})})()]})]})},Cr=Object.freeze(Object.defineProperty({__proto__:null,calculateCriticalPath:(e,a)=>{const o=new Set,i=new Map,r=new Map,h=new Map;e.forEach(m=>{r.set(m.id,[]),h.set(m.id,[])}),a.forEach(m=>{m.type==="e2s"&&(r.get(m.source)?.push(m.target),h.get(m.target)?.push(m.source))});const x=new Map,l=new Map,s=(m,T=new Set)=>{if(T.has(m))return;T.add(m);const M=e.find(j=>j.id===m);if(!M)return;const C=h.get(m)||[];if(C.length===0)x.set(m,0),l.set(m,M.duration);else{let j=0;C.forEach(f=>{s(f,T);const A=l.get(f)||0;j=Math.max(j,A)}),x.set(m,j),l.set(m,j+M.duration)}};e.forEach(m=>s(m.id));const w=new Map,p=new Map,S=Math.max(...Array.from(l.values())),P=(m,T=new Set)=>{if(T.has(m))return;T.add(m);const M=e.find(j=>j.id===m);if(!M)return;const C=r.get(m)||[];if(C.length===0)p.set(m,S),w.set(m,S-M.duration);else{let j=1/0;C.forEach(f=>{P(f,T);const A=w.get(f)||0;j=Math.min(j,A)}),p.set(m,j),w.set(m,j-M.duration)}};return e.forEach(m=>P(m.id)),e.forEach(m=>{const T=x.get(m.id)||0,C=(w.get(m.id)||0)-T;i.set(m.id,C),Math.abs(C)<.01&&o.add(m.id)}),{criticalTasks:o,taskFloats:i,projectDuration:S}},getTaskFloat:(e,a)=>a.taskFloats.get(e)||0,isCriticalTask:(e,a)=>a.criticalTasks.has(e)},Symbol.toStringTag,{value:"Module"}));q.AutoScheduler=wr,q.Chart=jt,q.CriticalPath=Cr,q.DependencyEditor=Wt,q.ExportUtils=vr,q.FilterSearch=Bt,q.Gantt=$r,q.Grid=St,q.TaskBar=Rt,q.TaskCreator=zt,q.TaskEditor=Yt,q.Timeline=vt,q.Toolbar=It,q.addToDate=xe,q.applyFilters=Kt,q.calculateDuration=nr,q.createBaseline=Xt,q.formatDate=we,q.getDaysBetween=ze,q.getEndOfDay=rr,q.getHoursBetween=_t,q.getStartOfDay=_e,q.isHoliday=wt,q.isWeekend=yt,q.useUndoRedo=Ht,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));
|