iris-gantt 1.4.1 → 1.4.2

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