iris-gantt 1.5.2 → 1.5.4

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