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