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