UNPKG

react-gantt-chart

Version:
15 lines (13 loc) 64.5 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t),n=function(){return n=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},n.apply(this,arguments)}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function a(e,t,r,o){return new(r||(r=Promise))((function(n,a){function s(e){try{l(o.next(e))}catch(e){a(e)}}function i(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,i)}l((o=o.apply(e,t||[])).next())}))}function s(e,t){var r,o,n,a,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}var i={rootStyle:{fill:"green",stroke:"green"}},l=function(t){var r=t.taskFromIndex,o=t.taskFromX1,a=t.taskFromX2,s=t.taskFromY,i=t.taskToIndex,l=t.taskToX1,d=t.taskToX2,c=t.taskToY,u=t.rowHeight,g=t.taskHeight,h=t.arrowIndent,f=t.rtl,p=t.rootStyle,v=!0===f?function(e){var t=e.taskFromIndex,r=e.taskFromX1,o=e.taskFromY,n=e.taskToIndex,a=e.taskToX2,s=e.taskToY,i=e.rowHeight,l=e.taskHeight,d=e.arrowIndent,c=t>n?-1:1,u=s+l/2,g=r-2*d,h=g>a?"":"H ".concat(a+d),f=g<a?-d:a-r+d;return["M ".concat(r," ").concat(o+l/2," \n h ").concat(-d," \n v ").concat(c*i/2," \n ").concat(h,"\n V ").concat(u," \n h ").concat(f),"".concat(a,",").concat(u," \n ").concat(a+5,",").concat(u+5," \n ").concat(a+5,",").concat(u-5)]}({taskFromIndex:r,taskFromX1:o,taskFromY:s,taskToIndex:i,taskToX2:d,taskToY:c,rowHeight:u,taskHeight:g,arrowIndent:h}):function(e){var t=e.taskFromIndex,r=e.taskFromX2,o=e.taskFromY,n=e.taskToIndex,a=e.taskToX1,s=e.taskToY,i=e.rowHeight,l=e.taskHeight,d=e.arrowIndent,c=t>n?-1:1,u=s+l/2,g=r+2*d,h=g<a?"":"H ".concat(a-d),f=g>a?d:a-r-d;return["M ".concat(r," ").concat(o+l/2," \n h ").concat(d," \n v ").concat(c*i/2," \n ").concat(h,"\n V ").concat(u," \n h ").concat(f),"".concat(a,",").concat(u," \n ").concat(a-5,",").concat(u-5," \n ").concat(a-5,",").concat(u+5)]}({taskFromIndex:r,taskFromX2:a,taskFromY:s,taskToIndex:i,taskToX1:l,taskToY:c,rowHeight:u,taskHeight:g,arrowIndent:h}),x=v[0],y=v[1];return e.jsxs("g",n({style:p},{children:[e.jsx("path",{strokeWidth:"1.5",d:x,fill:"none"},void 0),e.jsx("polygon",{points:y},void 0)]}),void 0)};l.defaultProps=i;var d=t.memo(l),c={rootStyle:{overflow:"auto",maxWidth:"100%"},bodyStyle:{height:1}},u=function(r){var o=r.scroll,a=r.onScroll,s=r.rootStyle,i=r.bodyStyle,l=t.useRef(null);return t.useEffect((function(){l.current&&(l.current.scrollLeft=o)}),[o]),e.jsx("div",n({style:s,dir:"ltr",ref:l,onScroll:a},{children:e.jsx("div",{style:i},void 0)}),void 0)};u.defaultProps=c;var g={multiBarRowMode:!1,rootStyle:{position:"absolute",display:"flex",flexShrink:0,pointerEvents:"none",userSelect:"none"}},h=function(r){var o=r.task,a=r.rtl,s=r.children,i=r.arrowIndent,l=r.scrollX,d=r.scrollY,c=r.svgContainerHeight,u=r.svgContainerWidth,g=r.headerHeight,h=r.rowHeight,f=r.taskListWidth,p=r.multiBarRowMode,v=r.rootStyle,x=t.useState(0),y=x[0],S=x[1],m=t.useState(0),k=m[0],b=m[1],C=t.useRef(null),w=0!==k&&0!==y;return t.useEffect((function(){if(C.current){var e=1.1*C.current.offsetHeight,t=1.1*C.current.offsetWidth,r=(!0===p&&void 0!==o.line?o.line:o.index)*h-d+g,n=void 0;if(a)(n=o.x1-1.5*i-t-l)<0&&(n=o.x2+1.5*i-l),t+n>u&&(n=u-t,r+=h);else t+(n=o.x2+1.5*i+f-l)>f+u&&(n=o.x1+f-1.5*i-l-t),n<f&&(n=u+f-t,r+=h);e+r-d>c-d&&(r=c-e),S(r),b(n)}}),[o,i,l,d,g,f,h,c,u,a,p]),e.jsx("div",n({ref:C,style:n(n({},v),{left:k,top:y,visibility:w?"visible":"hidden"})},{children:s}),void 0)};h.defaultProps=g;var f={rootStyle:{overflow:"hidden auto",width:"17px",flexShrink:0},bodyStyle:{width:1}},p=function(r){var o=r.scroll,a=r.onScroll,s=r.rootStyle,i=r.bodyStyle,l=t.useRef(null);return t.useEffect((function(){l.current&&(l.current.scrollTop=o)}),[o]),e.jsx("div",n({style:s,onScroll:a,ref:l},{children:e.jsx("div",{style:i},void 0)}),void 0)};p.defaultProps=f;var v=Object.freeze({__proto__:null,Arrow:d,arrowDefaultProps:i,HorizontalScroll:u,horizontalScrollDefaultProps:c,Tooltip:h,tooltipDefaultProps:g,VerticalScroll:p,verticalScrollDefaultProps:f}),x={rootStyle:{cursor:"pointer",outline:"none"},barDisplay:e.jsx(e.Fragment,{},void 0),leftBarDateHandle:e.jsx(e.Fragment,{},void 0),rightBarDateHandle:e.jsx(e.Fragment,{},void 0),barProgressHandle:e.jsx(e.Fragment,{},void 0),onMouseEnter:function(){return null},onMouseLeave:function(){return null}},y=function(t){var r=t.isDateChangeable,o=t.isProgressChangeable,a=t.rootStyle,s=t.barDisplay,i=t.leftBarDateHandle,l=t.rightBarDateHandle,d=t.barProgressHandle,c=t.onMouseEnter,u=t.onMouseLeave;return e.jsxs("g",n({style:a,tabIndex:0,onMouseEnter:c,onMouseLeave:u},{children:[s,e.jsxs("g",{children:[!0===r&&e.jsxs("g",{children:[i,l]},void 0),!0===o&&d]},void 0)]}),void 0)};y.defaultProps=x;var S=function(e,t){void 0===t&&(t=m);var r=e.tasks,o=e.dates,a=o[1].getTime()-o[0].getTime()-60*o[1].getTimezoneOffset()*1e3+60*o[0].getTimezoneOffset()*1e3,s=r.map((function(r,o){return t(n(n({},e),{task:r,taskIndex:o,dateDelta:a}))}));return s=s.map((function(e){for(var t=e.dependencies||[],r=function(r){var o=s.findIndex((function(e){return e.id===t[r]}));-1!==o&&s[o].barChildren.push(e)},o=0;o<t.length;o++)r(o);return e}))},m=function(e){return{task:b(n({},e)),milestone:w(n({},e)),project:C(n({},e))}[e.task.type]},k=function(e){return{task:b(n({},e)),milestone:b(n({},e)),project:C(n({},e))}[e.task.type]},b=function(e){var t,r,o=e.task,a=e.taskIndex,s=e.dates,i=e.dateDelta,l=e.rtl,d=e.multiBarRowMode,c=e.columnWidth,u=e.rowHeight,g=e.taskHeight,h=e.barCornerRadius,f=e.handleWidth,p=e.barProgressColor,v=e.barProgressSelectedColor,x=e.barBackgroundColor,y=e.barBackgroundSelectedColor;l?(r=D(o.start,s,i,c),t=D(o.end,s,i,c)):(t=T(o.start,s,i,c),r=T(o.end,s,i,c));var S=o.type;"task"===S&&r-t<2*f&&(S="smalltask",r=t+2*f);var m=P(t,r,o.progress,l),k=m[0],b=m[1],C=!0===d&&void 0!==o.line?o.line:a,w=j(C,u,g),M="project"===o.type?o.hideChildren:void 0,H=n({backgroundColor:x,backgroundSelectedColor:y,progressColor:p,progressSelectedColor:v},o.styles);return n(n({},o),{typeInternal:S,x1:t,x2:r,y:w,index:a,progressX:b,progressWidth:k,barCornerRadius:h,handleWidth:f,hideChildren:M,height:g,barChildren:[],styles:H})},C=function(e){var t,r,o=e.task,a=e.taskIndex,s=e.dates,i=e.dateDelta,l=e.rtl,d=e.multiBarRowMode,c=e.columnWidth,u=e.rowHeight,g=e.taskHeight,h=e.barCornerRadius,f=e.handleWidth,p=e.projectProgressColor,v=e.projectProgressSelectedColor,x=e.projectBackgroundColor,y=e.projectBackgroundSelectedColor;l?(r=D(o.start,s,i,c),t=D(o.end,s,i,c)):(t=T(o.start,s,i,c),r=T(o.end,s,i,c));var S=o.type;"task"===S&&r-t<2*f&&(S="smalltask",r=t+2*f);var m=P(t,r,o.progress,l),k=m[0],b=m[1],C=!0===d&&void 0!==o.line?o.line:a,w=j(C,u,g),M="project"===o.type?o.hideChildren:void 0,H=n({backgroundColor:x,backgroundSelectedColor:y,progressColor:p,progressSelectedColor:v},o.styles);return n(n({},o),{typeInternal:S,x1:t,x2:r,y:w,index:a,progressX:b,progressWidth:k,barCornerRadius:h,handleWidth:f,hideChildren:M,height:g,barChildren:[],styles:H})},w=function(e){var t=e.task,r=e.taskIndex,o=e.dates,a=e.dateDelta,s=e.multiBarRowMode,i=e.columnWidth,l=e.rowHeight,d=e.taskHeight,c=e.barCornerRadius,u=e.handleWidth,g=e.milestoneBackgroundColor,h=e.milestoneBackgroundSelectedColor,f=T(t.start,o,a,i),p=!0===s&&void 0!==t.line?t.line:r,v=j(p,l,d),x=f-.5*d,y=f+.5*d,S=d/1.414,m=n({backgroundColor:g,backgroundSelectedColor:h,progressColor:"",progressSelectedColor:""},t.styles);return n(n({},t),{end:t.start,x1:x,x2:y,y:v,index:r,progressX:0,progressWidth:0,barCornerRadius:c,handleWidth:u,typeInternal:t.type,progress:0,height:S,hideChildren:void 0,barChildren:[],styles:m})},T=function(e,t,r,o){var n=~~((e.getTime()-t[0].getTime()+e.getTimezoneOffset()-t[0].getTimezoneOffset())/r);return Math.round((n+(e.getTime()-t[n].getTime()-60*e.getTimezoneOffset()*1e3+60*t[n].getTimezoneOffset()*1e3)/r)*o)},D=function(e,t,r,o){var n=T(e,t,r,o);return n+=o},j=function(e,t,r){return e*t+(t-r)/2},P=function(e,t,r,o){var n=(t-e)*r*.01;return[n,o?t-n:e]},M=function(e,t){var r=t.x2-t.x1,o=Math.round(100*e/r);return o>=100?100:o<=0?0:o},H=function(e,t,r){return[e-5,t+r,e+5,t+r,e,t+r-8.66].join(",")},B=function(e,t,r){var o=Math.round((e-r.x1)/t)*t,n=r.x1+o;return[n,n+r.x2-r.x1]},W=function(e,t,r,o,n){var a=new Date((e-t)/o*n+r.getTime());return a=new Date(a.getTime()+6e4*(a.getTimezoneOffset()-r.getTimezoneOffset()))},E=function(e,t,r,o,n,a,s){var i;if("milestone"===r.type)i=L(e,t,r,o,n,a);else i=F(e,t,r,o,n,a,s);return i},F=function(e,t,r,o,a,s,i){var l=n({},r),d=!1;switch(t){case"progress":if(l.progress=i?function(e,t){if(e>=t.x2)return 0;if(e<=t.x1)return 100;var r=t.x2-t.x1;return Math.round(100*(t.x2-e)/r)}(e,r):function(e,t){if(e>=t.x2)return 100;if(e<=t.x1)return 0;var r=t.x2-t.x1;return Math.round(100*(e-t.x1)/r)}(e,r),d=l.progress!==r.progress){var c=P(l.x1,l.x2,l.progress,i),u=c[0],g=c[1];l.progressWidth=u,l.progressX=g}break;case"start":var h=function(e,t,r){e>=r.x2-2*r.handleWidth&&(e=r.x2-2*r.handleWidth);var o=Math.round((e-r.x1)/t)*t;return r.x1+o}(e,o,r);if(l.x1=h,d=l.x1!==r.x1){i?l.end=W(h,r.x1,r.end,o,a):l.start=W(h,r.x1,r.start,o,a);var f=P(l.x1,l.x2,l.progress,i);u=f[0],g=f[1];l.progressWidth=u,l.progressX=g}break;case"end":var p=function(e,t,r){e<=r.x1+2*r.handleWidth&&(e=r.x1+2*r.handleWidth);var o=Math.round((e-r.x2)/t)*t;return r.x2+o}(e,o,r);if(l.x2=p,d=l.x2!==r.x2){i?l.start=W(p,r.x2,r.start,o,a):l.end=W(p,r.x2,r.end,o,a);var v=P(l.x1,l.x2,l.progress,i);u=v[0],g=v[1];l.progressWidth=u,l.progressX=g}break;case"move":var x=B(e-s,o,r),y=x[0],S=x[1];if(d=y!==r.x1){l.start=W(y,r.x1,r.start,o,a),l.end=W(S,r.x2,r.end,o,a),l.x1=y,l.x2=S;var m=P(l.x1,l.x2,l.progress,i);u=m[0],g=m[1];l.progressWidth=u,l.progressX=g}}return{isChanged:d,changedTask:l}},L=function(e,t,r,o,a,s){var i=n({},r),l=!1;if("move"===t){var d=B(e-s,o,r),c=d[0],u=d[1];(l=c!==r.x1)&&(i.start=W(c,r.x1,r.start,o,a),i.end=i.start,i.x1=c,i.x2=u)}return{isChanged:l,changedTask:i}},R=Object.freeze({__proto__:null,convertToBarTasks:S,convertToBarTask:m,convertToBarTaskNR:k,convertToBar:b,convertToProject:C,convertToMilestone:w,progressWithByParams:P,progressByProgressWidth:M,getProgressPoint:H,handleTaskBySVGMouseEvent:E}),I={x:0,y:0,rootStyle:{height:"50px"},barStyle:{height:"50px",width:"200px",userSelect:"none",strokeWidth:0,fill:"#B8C2CC"},progressStyle:{height:"50px",fill:"#A3A3FF"},progressX:50,progressWidth:100,barCornerRadius:5,onMouseDown:function(e){return console.log("BarDisplay click")}},z=function(t){var r=t.x,o=t.y,a=t.progressX,s=t.progressWidth,i=t.barCornerRadius,l=t.onMouseDown,d=t.rootStyle,c=t.barStyle,u=t.progressStyle;return e.jsxs("g",n({style:d,onMouseDown:l},{children:[e.jsx("rect",{style:c,x:r,y:o,rx:i,ry:i},void 0),e.jsx("rect",{style:u,x:a,y:o,width:s,rx:i,ry:i},void 0)]}),void 0)};z.defaultProps=I;var O={progressPoint:"15,10,25,10,20,0",onMouseDown:function(e){return console.log(e)},rootStyle:{fill:"#ddd",cursor:"ew-resize"}},X=function(t){var r=t.progressPoint,o=t.onMouseDown,n=t.rootStyle;return e.jsx("polygon",{style:n,points:r,onMouseDown:o},void 0)};X.defaultProps=O;var _={rootStyle:{cursor:"pointer",outline:"none"}},Y=function(r){var o=r.rootStyle,a=r.task,s=r.isDateChangeable,i=r.isProgressChangeable,l=r.onEventStart,d=t.useState(!1),c=d[0],u=d[1],g=H(a.progressWidth+a.x1,a.y,a.height);return e.jsxs("g",n({style:o,tabIndex:0,onMouseEnter:function(){return u((function(){return!0}))},onMouseLeave:function(){return u((function(){return!1}))}},{children:[e.jsx(z,{x:a.x1,y:a.y,progressX:a.progressX,progressWidth:a.progressWidth,barCornerRadius:a.barCornerRadius,onMouseDown:function(e){!0===s&&l("move",a,e)},rootStyle:n(n({},I),{height:a.height})},void 0),e.jsx("g",{children:!0===i&&e.jsx(X,{progressPoint:g,onMouseDown:function(e){l("progress",a,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0)},void 0)]}),void 0)};Y.defaultProps=_;var A={rootStyle:{cursor:"pointer",outline:"none"},backgroundStyle:{userSelect:"none"}},V=function(t){var r=t.task,o=t.isDateChangeable,a=t.isSelected,s=t.onEventStart,i=t.rootStyle,l=t.backgroundStyle,d="rotate(45 ".concat(r.x1+.356*r.height," \n ").concat(r.y+.85*r.height,")");return e.jsx("svg",{children:e.jsx("g",n({tabIndex:0,style:i},{children:e.jsx("rect",{style:l,fill:a?r.styles.backgroundSelectedColor:r.styles.backgroundColor,x:r.x1,width:r.height,y:r.y,height:r.height,rx:r.barCornerRadius,ry:r.barCornerRadius,transform:d,onMouseDown:function(e){o&&s("move",r,e)}},void 0)}),void 0)},void 0)};V.defaultProps=A;var N={rootStyle:{cursor:"pointer",outline:"none"},backgroundStyle:{userSelect:"none",opacity:.6,fill:"orange"},progressStyle:{fill:"green"}},G=function(t){var r=t.task,o=t.rootStyle,a=t.backgroundStyle,s=t.progressStyle;return e.jsx("svg",{children:e.jsxs("g",n({tabIndex:0,style:o},{children:[e.jsx("rect",{style:a,x:r.x1,y:r.y,height:r.height,width:r.x2-r.x1,rx:r.barCornerRadius,ry:r.barCornerRadius},void 0),e.jsx("rect",{style:s,x:r.progressX,y:r.y,height:r.height,width:r.progressWidth,rx:r.barCornerRadius,ry:r.barCornerRadius},void 0)]}),void 0)},void 0)};G.defaultProps=N;var K={x:0,y:0,width:10,height:30,barCornerRadius:5,onMouseDown:function(e){return console.log(e)},rootStyle:{fill:"#ddd",cursor:"ew-resize"}},Q=function(t){var r=t.x,o=t.y,n=t.width,a=t.height,s=t.barCornerRadius,i=t.onMouseDown,l=t.rootStyle;return e.jsx("rect",{style:l,x:r,y:o,width:n,height:a,ry:s,rx:s,onMouseDown:i},void 0)};Q.defaultProps=K;var q,U=function(r){var o=r.task,a=r.rtl,s=r.isDateChangeable,i=r.isProgressChangeable,l=r.onEventStart,d=t.useState(!1),c=d[0],u=d[1],g=e.jsx(z,{x:o.x1,y:o.y,progressX:o.progressX,progressWidth:o.progressWidth,barCornerRadius:o.barCornerRadius,onMouseDown:function(e){!0===s&&l("move",o,e)},rootStyle:n(n({},I.rootStyle),{height:o.height}),barStyle:n(n({},I.barStyle),{height:o.height,width:o.x2-o.x1}),progressStyle:n(n({},I.progressStyle),{height:o.height})},void 0),h=e.jsx(Q,{x:o.x1+1,y:o.y+1,width:o.handleWidth,height:o.height-2,barCornerRadius:o.barCornerRadius,onMouseDown:function(e){return l("start",o,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0),f=e.jsx(Q,{x:o.x2-o.handleWidth-1,y:o.y+1,height:o.height-2,width:o.handleWidth,barCornerRadius:o.barCornerRadius,onMouseDown:function(e){return l("end",o,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0),p=H(+!a*o.progressWidth+o.progressX,o.y,o.height),v=e.jsx(X,{progressPoint:p,onMouseDown:function(e){return l("progress",o,e)},rootStyle:{fill:"#ddd",cursor:"ew-resize",opacity:c?1:0,visibility:c?"visible":"hidden"}},void 0);return e.jsx("svg",n({style:{overflow:"visible"}},{children:e.jsx(y,{rtl:a,isDateChangeable:s,isProgressChangeable:i,barDisplay:g,leftBarDateHandle:h,rightBarDateHandle:f,barProgressHandle:v,onMouseEnter:function(){return u((function(){return!0}))},onMouseLeave:function(){return u((function(){return!1}))}},void 0)}),void 0)},Z=function(t){var r=t.task,o=t.rtl,a=t.isDateChangeable,s=t.isProgressChangeable,i=e.jsx(z,{x:r.x1,y:r.y,progressX:r.progressX,progressWidth:r.progressWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDisplay (move): onMouseDown is not implemented")},rootStyle:n(n({},I.rootStyle),{height:"".concat(48,"px")}),barStyle:n(n({},I.barStyle),{height:"".concat(48,"px"),width:"".concat(r.x2-r.x1,"px"),fill:"#E0E3E7",stroke:"green",strokeWidth:"1px"}),progressStyle:n(n({},I.progressStyle),{height:"".concat(48,"px"),fill:"transparent"})},void 0),l=e.jsx(Q,{x:r.x1+8+1,y:r.y+24-5,height:r.handleWidth,width:r.handleWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDateHandle (start): onMouseDown is not implemented")},rootStyle:{fill:"#A9ADB2",stroke:"white",strokeWidth:"".concat(1,"px"),opacity:1,visibility:"visible"}},void 0),d=e.jsx(Q,{x:r.x2-r.handleWidth-8-1,y:r.y+24-5,height:r.handleWidth,width:r.handleWidth,barCornerRadius:5,onMouseDown:function(e){console.log("BarDateHandle (end): onMouseDown is not implemented")},rootStyle:{fill:"#A9ADB2",stroke:"white",strokeWidth:"".concat(1,"px"),opacity:1,visibility:"visible"}},void 0);return e.jsx("svg",n({style:{overflow:"visible"}},{children:e.jsx(y,{rtl:o,isDateChangeable:a,isProgressChangeable:s,barDisplay:i,leftBarDateHandle:l,rightBarDateHandle:d},void 0)}),void 0)};exports.ViewMode=void 0,(q=exports.ViewMode||(exports.ViewMode={})).QuarterDay="Quarter Day",q.HalfDay="Half Day",q.Day="Day",q.Week="Week",q.Month="Month";var J=Object.freeze({__proto__:null,get ViewMode(){return exports.ViewMode}}),$={rootStyle:{stroke:"#e6e4e4"},lineStyle:{textAnchor:"middle",fill:"#555",userSelect:"none",pointerEvents:"none"},textStyle:{strokeWidth:.2,stroke:"#e6e4e4"}},ee=function(t){var r=t.value,o=t.x1Line,a=t.xText,s=t.y1Line,i=t.y2Line,l=t.yText,d=t.rootStyle,c=t.lineStyle,u=t.textStyle;return e.jsxs("g",n({style:d},{children:[e.jsx("line",{style:c,x1:o,y1:s,x2:o,y2:i},r+"line"),e.jsx("text",n({style:u,y:l,x:a},{children:r}),r+"text")]}),void 0)};ee.defaultProps=$;var te={},re=function(e,t){void 0===t&&(t={});var r=JSON.stringify([e,t]),o=te[r];return o||(o=new Intl.DateTimeFormat(e,t),te[r]=o),o},oe=function(e,t,r){return new Date(e.getFullYear()+("year"===r?t:0),e.getMonth()+("month"===r?t:0),e.getDate()+("day"===r?t:0),e.getHours()+("hour"===r?t:0),e.getMinutes()+("minute"===r?t:0),e.getSeconds()+("second"===r?t:0),e.getMilliseconds()+("millisecond"===r?t:0))},ne=function(e,t){var r=["millisecond","second","minute","hour","day","month","year"],o=function(e){var o=r.indexOf(t);return r.indexOf(e)<=o};return new Date(e.getFullYear(),o("year")?0:e.getMonth(),o("month")?1:e.getDate(),o("day")?0:e.getHours(),o("hour")?0:e.getMinutes(),o("minute")?0:e.getSeconds(),o("second")?0:e.getMilliseconds())},ae=function(e,t){for(var r=e[0].start,o=e[0].start,n=0,a=e;n<a.length;n++){var s=a[n];s.start<r&&(r=s.start),s.end>o&&(o=s.end)}switch(t){case exports.ViewMode.Month:r=oe(r,-1,"month"),r=ne(r,"month"),o=oe(o,1,"year"),o=ne(o,"year");break;case exports.ViewMode.Week:r=ne(r,"day"),o=ne(o,"day"),r=oe(le(r),-7,"day"),o=oe(o,1.5,"month");break;case exports.ViewMode.Day:r=ne(r,"day"),o=ne(o,"day"),r=oe(r,-1,"day"),o=oe(o,19,"day");break;case exports.ViewMode.QuarterDay:r=ne(r,"day"),o=ne(o,"day"),r=oe(r,-1,"day"),o=oe(o,66,"hour");break;case exports.ViewMode.HalfDay:r=ne(r,"day"),o=ne(o,"day"),r=oe(r,-1,"day"),o=oe(o,108,"hour")}return[r,o]},se=function(e,t,r){for(var o=new Date(e),n=[o];o<t;){switch(r){case exports.ViewMode.Month:o=oe(o,1,"month");break;case exports.ViewMode.Week:o=oe(o,7,"day");break;case exports.ViewMode.Day:o=oe(o,1,"day");break;case exports.ViewMode.HalfDay:o=oe(o,12,"hour");break;case exports.ViewMode.QuarterDay:o=oe(o,6,"hour")}n.push(o)}return n},ie=function(e,t){var r=re(t,{month:"long"}).format(e);return r=r.replace(r[0],r[0].toLocaleUpperCase())},le=function(e){var t=e.getDay(),r=e.getDate()-t+(0===t?-6:1);return new Date(e.setDate(r))},de=function(e){var t=new Date(e.valueOf()),r=(t.getDay()+6)%7;t.setDate(t.getDate()-r+3);var o=t.valueOf();t.setMonth(0,1),4!==t.getDay()&&t.setMonth(0,1+(4-t.getDay()+7)%7);var n=(1+Math.ceil((o-t.valueOf())/6048e5)).toString();return 1===n.length?"0".concat(n):n},ce=function(e,t){return new Date(t,e+1,0).getDate()},ue=Object.freeze({__proto__:null,getCachedDateTimeFormat:re,addToDate:oe,startOfDate:ne,ganttDateRange:ae,seedDates:se,getLocaleMonth:ie,getWeekNumberISO8601:de,getDaysInMonth:ce}),ge={rootStyle:{},headerStyle:{fill:"#ffffff",stroke:"#e0e0e0",strokeWidth:1.4},bottomTextStyle:{textAnchor:"middle",fill:"#333",userSelect:"none",pointerEvents:"none"},calenderHeaderRootStyle:$.rootStyle,calenderHeaderLineStyle:$.lineStyle,calenderHeaderTextStyle:$.textStyle},he=function(t){var r,o,a,s,i=t.columnWidth,l=t.dateSetup,d=t.headerHeight,c=t.locale,u=t.rtl,g=t.rootStyle,h=t.headerStyle,f=t.bottomTextStyle,p=t.calenderHeaderRootStyle,v=t.calenderHeaderLineStyle,x=t.calenderHeaderTextStyle,y=[],S=[];switch(l.viewMode){case exports.ViewMode.Month:r=function(){for(var t=[],r=[],o=.5*d,a=0;a<l.dates.length;a++){var s=l.dates[a],g=ie(s,c);if(r.push(e.jsx("text",n({style:f,y:.8*d,x:i*a+.5*i},{children:g}),g+s.getFullYear())),0===a||s.getFullYear()!==l.dates[a-1].getFullYear()){var h=s.getFullYear().toString(),y=void 0;y=u?(6+a+s.getMonth()+1)*i:(6+a-s.getMonth())*i,t.push(e.jsx(ee,{value:h,x1Line:i*a,y1Line:0,y2Line:d,xText:y,yText:.9*o,rootStyle:p,lineStyle:v,textStyle:x},h))}}return[t,r]}(),y=r[0],S=r[1];break;case exports.ViewMode.Week:o=function(){for(var t=[],r=[],o=1,a=.5*d,s=l.dates,g=s.length-1;g>=0;g--){var h=s[g],y="";0!==g&&h.getMonth()===s[g-1].getMonth()||(y="".concat(ie(h,c),", ").concat(h.getFullYear()));var S="W".concat(de(h));r.push(e.jsx("text",n({style:f,y:.8*d,x:i*(g+ +u)},{children:S}),h.getTime())),y&&(g!==s.length-1&&t.push(e.jsx(ee,{value:y,x1Line:i*g+o*i,y1Line:0,y2Line:d,xText:i*g+i*o*.5,yText:.9*a,rootStyle:p,lineStyle:v,textStyle:x},y)),o=0),o++}return[t,r]}(),y=o[0],S=o[1];break;case exports.ViewMode.Day:a=function(){for(var t=[],r=[],o=.5*d,a=l.dates,s=0;s<a.length;s++){var u=a[s],g=u.getDate().toString();if(r.push(e.jsx("text",n({style:f,y:.8*d,x:i*s+.5*i},{children:g}),u.getTime())),s+1!==a.length&&u.getMonth()!==a[s+1].getMonth()){var h=ie(u,c);t.push(e.jsx(ee,{value:h,x1Line:i*(s+1),y1Line:0,y2Line:d,xText:i*(s+1)-ce(u.getMonth(),u.getFullYear())*i*.5,yText:.9*o,rootStyle:p,lineStyle:v,textStyle:x},h+u.getFullYear()))}}return[t,r]}(),y=a[0],S=a[1];break;default:s=function(){for(var t=[],r=[],o=l.viewMode===exports.ViewMode.HalfDay?2:4,a=.5*d,s=l.dates,g=0;g<s.length;g++){var h=s[g],y=re(c,{hour:"numeric"}).format(h);if(r.push(e.jsx("text",n({style:f,y:.8*d,x:i*(g+ +u)},{children:y}),h.getTime())),0===g||h.getDate()!==s[g-1].getDate()){var S="".concat(h.getDate()," ").concat(ie(h,c));t.push(e.jsx(ee,{value:S,x1Line:i*g+o*i,y1Line:0,y2Line:d,xText:i*g+o*i*.5,yText:.9*a,rootStyle:p,lineStyle:v,textStyle:x},S+h.getFullYear()))}}return[t,r]}(),y=s[0],S=s[1]}return e.jsx("svg",n({style:{overflow:"visible"}},{children:e.jsxs("g",n({style:g},{children:[e.jsx("rect",{style:h,x:0,y:0,width:i*l.dates.length,height:d},void 0),y,S]}),void 0)}),void 0)};he.defaultProps=ge;var fe=function(t){for(var r=t.tasks,o=t.dates,a=t.rtl,s=t.rowHeight,i=t.columnWidth,l=t.svgWidth,d=t.todayColor,c=t.gridRowStyle,u=t.gridRowLineStyle,g=t.gridTickStyle,h=new Date,f=0,p=0,v=[],x=[e.jsx("line",{style:u,x:"0",y1:0,x2:l,y2:0},"RowLineFirst")],y=0,S=r;y<S.length;y++){var m=S[y];v.push(e.jsx("rect",{style:c,x:"0",y:f,width:l,height:s},"Row"+m.id)),x.push(e.jsx("line",{style:u,x:"0",y1:f+s,x2:l,y2:f+s},"RowLine"+m.id)),f+=s}for(var k=[],b=e.jsx("rect",{},void 0),C=0;C<o.length;C++){var w=o[C];k.push(e.jsx("line",{style:g,x1:p,y1:0,x2:p,y2:f},w.getTime())),(C+1!==o.length&&w.getTime()<h.getTime()&&o[C+1].getTime()>=h.getTime()||0!==C&&C+1===o.length&&w.getTime()<h.getTime()&&oe(w,w.getTime()-o[C-1].getTime(),"millisecond").getTime()>=h.getTime())&&(b=e.jsx("rect",{x:p,y:0,width:i,height:f,fill:d},void 0)),a&&C+1!==o.length&&w.getTime()>=h.getTime()&&o[C+1].getTime()<h.getTime()&&(b=e.jsx("rect",{x:p+i,y:0,width:i,height:f,fill:d},void 0)),p+=i}return e.jsx("svg",n({style:{overflow:"visible"}},{children:e.jsxs("g",{children:[e.jsx("g",{children:v},void 0),e.jsx("g",{children:x},void 0),e.jsx("g",{children:k},void 0),e.jsx("g",{children:b},void 0)]},void 0)}),void 0)};fe.defaultProps={gridRowStyle:{fill:"#fff"},gridRowLineStyle:{stroke:"#ebeff2"},gridTickStyle:{stroke:"#e6e4e4"}};var pe={taskItemTextStyle:{fill:"#1B2026",textAnchor:"middle",fontWeight:"lighter",dominantBaseline:"central",userSelect:"none",pointerEvents:"none"},taskItemTextOutsideStyle:{fill:"#1B2026",textAnchor:"start",userSelect:"none",pointerEvents:"none"}},ve=function(r){var o,a,s=r.task,i=r.arrowIndent,l=r.isDelete,d=r.taskHeight,c=r.isSelected,u=r.rtl,g=r.onEventStart,h=r.taskItemTextStyle,f=r.taskItemTextOutsideStyle,p=t.useState(e.jsx("div",{},void 0)),v=p[0],x=p[1],y=t.useState(!0),S=y[0],m=y[1],k=t.useRef(null);return t.useEffect((function(){switch(s.typeInternal){case"milestone":default:x((function(){return e.jsx(Z,{task:r.task,rtl:r.rtl,isDateChangeable:r.isDateChangeable,isProgressChangeable:r.isProgressChangeable,onEventStart:r.onEventStart},void 0)}));break;case"project":x(e.jsx(G,{task:r.task,backgroundStyle:n(n({},N.backgroundStyle),{fill:s.styles.backgroundColor,opacity:.1}),progressStyle:n(n({},N.progressStyle),{fill:s.styles.progressSelectedColor})},void 0));break;case"smalltask":x(e.jsx(Y,n({},r),void 0))}}),[s,c]),t.useEffect((function(){k.current&&m(k.current.getBBox().width<s.x2-s.x1)}),[k,s]),e.jsx("svg",{children:e.jsxs("g",n({onKeyDown:function(e){return function(e){"Delete"===e.key&&l&&g("delete",s,e);e.stopPropagation()}(e)},onMouseEnter:function(e){g("mouseenter",s,e)},onMouseLeave:function(e){g("mouseleave",s,e)},onDoubleClick:function(e){g("dblclick",s,e)},onFocus:function(){g("select",s)}},{children:[v,e.jsx("text",n({style:S?h:f,x:(o=s.x2-s.x1,a=s.barChildren.length>0,S?s.x1+.5*o:u&&k.current?s.x1-k.current.getBBox().width-i*+a-.2*i:s.x1+o+i*+a+.2*i),y:s.y+.5*d,ref:k},{children:s.name}),void 0)]}),void 0)},void 0)};ve.defaultProps=pe;var xe={taskItemTextStyle:{fill:"#fff",textAnchor:"middle",fontWeight:"lighter",dominantBaseline:"central",userSelect:"none",pointerEvents:"none"},taskItemTextOutsideStyle:{fill:"#555",textAnchor:"start",userSelect:"none",pointerEvents:"none"}},ye=function(r){var o,a,s=r.task,i=r.rtl,l=r.isDateChangeable,d=r.isProgressChangeable,c=r.isDelete,u=r.isSelected,g=r.taskHeight,h=r.arrowIndent,f=r.onEventStart,p=r.taskItemTextStyle,v=r.taskItemTextOutsideStyle,x=t.useState(e.jsx("div",{},void 0)),y=x[0],S=x[1],m=t.useState(!0),k=m[0],b=m[1],C=t.useRef(null);return t.useEffect((function(){switch(s.typeInternal){case"milestone":S(e.jsx(V,n({},r),void 0));break;case"project":S(e.jsx(G,{task:s,backgroundStyle:n(n({},N.backgroundStyle),{fill:s.styles.backgroundColor,opacity:1}),progressStyle:n(n({},N.progressStyle),{fill:s.styles.progressSelectedColor})},void 0));break;case"smalltask":S(e.jsx(Y,n({},r),void 0));break;default:S((function(){return e.jsx(U,{task:s,rtl:i,isDateChangeable:l,isProgressChangeable:d,onEventStart:f},void 0)}))}}),[s,u]),t.useEffect((function(){C.current&&b(C.current.getBBox().width<s.x2-s.x1)}),[C,s]),e.jsx("svg",{children:e.jsxs("g",n({onKeyDown:function(e){if("Delete"===e.key)c&&f("delete",s,e);e.stopPropagation()},onMouseEnter:function(e){f("mouseenter",s,e)},onMouseLeave:function(e){f("mouseleave",s,e)},onDoubleClick:function(e){f("dblclick",s,e)},onFocus:function(){f("select",s)}},{children:[y,e.jsx("text",n({style:k?p:v,x:(o=s.x2-s.x1,a=s.barChildren.length>0,k?s.x1+.5*o:i&&C.current?s.x1-C.current.getBBox().width-h*+a-.2*h:s.x1+o+h*+a+.2*h),y:s.y+.5*g,ref:C},{children:s.name}),void 0)]}),void 0)},void 0)};ye.defaultProps=xe;var Se=function(r){var o=r.scrollY,a=r.TaskListHeader,s=r.TaskListTable,i=r.taskListHeaderProps,l=r.taskListTableProps,d=r.taskListTableWrapperStyles,c=r.taskListRef,u=t.useRef(null);return t.useEffect((function(){u.current&&(u.current.scrollTop=o)}),[o]),e.jsxs("div",n({ref:c},{children:[e.jsx(a,n({},i),void 0),e.jsx("div",n({style:d,ref:u},{children:e.jsx(s,n({},l),void 0)}),void 0)]}),void 0)},me={columns:["Name","From","To"],rootStyle:{display:"table",borderBottom:"#e6e4e4 1px solid",borderTop:"#e6e4e4 1px solid",borderLeft:"#e6e4e4 1px solid"},headerStyle:{display:"table-row",listStyle:"none"},columnStyle:{display:"table-cell",verticalAlign:"middle"},columnSeparatorStyle:{borderRight:"1px solid rgb(196, 196, 196)",opacity:1,marginLeft:"-2px"}},ke=function(t){var r=t.columns,a=t.rootStyle,s=t.headerStyle,i=t.columnStyle,l=t.columnSeparatorStyle,d=[];return r.forEach((function(t,a){var s=e.jsxs(o.default.Fragment,{children:[e.jsx("div",n({style:i},{children:t}),void 0),a!==r.length-1&&e.jsx("div",{style:l},void 0)]},a);d.push(s)})),e.jsx("div",n({style:a},{children:e.jsx("div",n({style:s},{children:d}),void 0)}),void 0)};ke.defaultProps=me;var be={},Ce={weekday:"short",year:"numeric",month:"long",day:"numeric"},we={expanderSymbolOpen:"▼",expanderSymbolClose:"▶",expanderSymbolEmpty:"",showStartDateColumn:!0,showEndDateColumn:!0,rootStyle:{display:"table",borderBottom:"#e6e4e4 1px solid",borderLeft:"#e6e4e4 1px solid"},tableRowStyle:{display:"table-row",textOverflow:"ellipsis"},tableRowStyleProject:{},tableCellStyle:{display:"table-cell",verticalAlign:"middle",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tableCellStyleProject:{},tableCellStyleTask:{},tableCellStyleMileStone:{},tableCellWrapperStyle:{display:"flex"},expanderStyle:{color:"rgb(86 86 86)",fontSize:"0.6rem",padding:"0.15rem 0.2rem 0rem 0.2rem",userSelect:"none",cursor:"pointer"},expanderEmptyStyle:{fontSize:"0.6rem",paddingLeft:"1rem",userSelect:"none"}},Te=function(r){var o=r.tasks,a=r.locale,s=r.expanderSymbolOpen,i=r.expanderSymbolClose,l=r.expanderSymbolEmpty,d=r.onExpanderClick,c=r.showStartDateColumn,u=r.showEndDateColumn,g=r.rootStyle,h=r.tableRowStyle,f=r.tableRowStyleProject,p=r.tableCellStyle,v=r.tableCellStyleProject,x=r.tableCellStyleTask,y=r.tableCellStyleMileStone,S=r.tableCellWrapperStyle,m=r.expanderStyle,k=r.expanderEmptyStyle,b=t.useMemo((function(){return function(e){return function(t,r){var o=t.toString(),n=be[o];return n||(n=t.toLocaleDateString(e,r),be[o]=n),n}}(a)}),[a]);return e.jsx("div",n({style:g},{children:o.map((function(t){var r=l;!0===t.hideChildren?r=i:!1===t.hideChildren&&(r=s);var o=n(n({},h),"project"===t.type?f:{}),a=n(n(n(n({},p),"project"===t.type?v:{}),"task"===t.type?x:{}),"milestone"===t.type?y:{});return e.jsxs("div",n({style:o},{children:[e.jsx("div",n({style:a,title:t.name},{children:e.jsxs("div",n({style:S},{children:[e.jsx("div",n({style:r?m:k,onClick:function(){return d(t)}},{children:r}),void 0),e.jsx("div",{children:t.name},void 0)]}),void 0)}),void 0),!0===c&&e.jsxs("div",n({style:a},{children:[" ",b(t.start,Ce)]}),void 0),!0===u&&e.jsxs("div",n({style:a},{children:[" ",b(t.end,Ce)]}),void 0)]}),"".concat(t.id,"row"))}))}),void 0)};Te.defaultProps=we;var De=Object.freeze({__proto__:null,Bar:y,barDefaultProps:x,BarSmall:Y,barSmallDefaultProps:_,MileStone:V,mileStoneDefaultProps:A,Project:G,projectDefaultProps:N,BarDateHandle:Q,barDateHandleDefaultProps:K,BarDisplay:z,barDisplayDefaultProps:I,BarProgressHandle:X,barProgressHandleDefaultProps:O,BarOriginal:U,BarNationalResources:Z,Calendar:he,calendarDefaultProps:ge,CalendarHeader:ee,calendarHeaderDefaultProps:$,Grid:fe,TaskItemNationalResources:ve,taskItemNationalResourcesDefaultProps:pe,TaskItemOriginal:ye,taskItemOriginalDefaultProps:xe,TaskList:Se,TaskListHeader:ke,taskListHeaderDefaultProps:me,TaskListTable:Te,taskListTableDefaultProps:we}),je=Object.freeze({__proto__:null}),Pe=Object.freeze({__proto__:null}),Me=Object.freeze({__proto__:null}),He=Object.freeze({__proto__:null}),Be=Object.freeze({__proto__:null,barTask:je,custom:Pe,dateSetup:Me,ganttTaskActions:He,publicTypes:J,get ViewMode(){return exports.ViewMode}});function We(e){return void 0!==e.key}function Ee(e){return void 0!==e.clientX}function Fe(e){return void 0!==e.x1}function Le(e){var t=e.filter((function(e){return e.hideChildren&&"project"===e.type}));if(t.length>0)for(var r=function(r){var o=t[r],n=Re(e,o);e=e.filter((function(e){return-1===n.indexOf(e)}))},o=0;t.length>o;o++)r(o);return e}function Re(e,t){var r=[],o=(r="project"!==t.type?e.filter((function(e){return e.dependencies&&-1!==e.dependencies.indexOf(t.id)})):e.filter((function(e){return e.project&&e.project===t.id}))).reduce((function(t,r){return t.concat(t,Re(e,r))}),[]);return r=r.concat(r,o)}var Ie=Object.freeze({__proto__:null,isKeyboardEvent:We,isMouseEvent:Ee,isBarTask:Fe,removeHiddenTasks:Le}),ze=Object.freeze({__proto__:null,barHelper:R,dateHelper:ue,otherHelper:Ie,convertToBarTasks:S,convertToBarTask:m,convertToBarTaskNR:k,convertToBar:b,convertToProject:C,convertToMilestone:w,progressWithByParams:P,progressByProgressWidth:M,getProgressPoint:H,handleTaskBySVGMouseEvent:E,getCachedDateTimeFormat:re,addToDate:oe,startOfDate:ne,ganttDateRange:ae,seedDates:se,getLocaleMonth:ie,getWeekNumberISO8601:de,getDaysInMonth:ce,isKeyboardEvent:We,isMouseEvent:Ee,isBarTask:Fe,removeHiddenTasks:Le}),Oe=function(r){var o,i=r.tasks,l=r.dates,c=r.ganttEvent,u=r.selectedTask,g=r.rowHeight,h=r.columnWidth,f=r.timeStep,p=r.svg,v=r.taskHeight,x=r.arrowColor,y=r.arrowIndent,S=r.fontFamily,m=r.fontSize,k=r.rtl,b=r.setGanttEvent,C=r.setFailedTask,w=r.setSelectedTask,T=r.onDateChange,D=r.onProgressChange,j=r.onDoubleClick,P=r.onDelete,M=t.useState(0),H=M[0],B=M[1],W=t.useState(0),F=W[0],L=W[1],R=t.useState(!1),I=R[0],z=R[1],O=null===(o=null==p?void 0:p.current)||void 0===o?void 0:o.createSVGPoint(),X=function(e,t,r){return a(void 0,void 0,void 0,(function(){var o,n,a,i;return s(this,(function(s){switch(s.label){case 0:return r?[3,1]:("select"===e&&w(t.id),[3,7]);case 1:if(!We(r))return[3,6];if("delete"!==e)return[3,5];if(!P)return[3,5];s.label=2;case 2:return s.trys.push([2,4,,5]),[4,P(t)];case 3:return void 0!==(o=s.sent())&&o&&b({action:e,changedTask:t}),[3,5];case 4:return n=s.sent(),console.error("Error on Delete. "+n),[3,5];case 5:return[3,7];case 6:if("mouseenter"===e)c.action||b({action:e,changedTask:t,originalSelectedTask:t});else if("mouseleave"===e)"mouseenter"===c.action&&b({action:""});else if("dblclick"===e)j&&j(t);else if("move"===e){if(!(null==p?void 0:p.current)||!O)return[2];O.x=r.clientX,a=O.matrixTransform(null===(i=p.current.getScreenCTM())||void 0===i?void 0:i.inverse()),L(a.x-t.x1),b({action:e,changedTask:t,originalSelectedTask:t})}else b({action:e,changedTask:t,originalSelectedTask:t});s.label=7;case 7:return[2]}}))}))};return t.useEffect((function(){var e=l[1].getTime()-l[0].getTime()-60*l[1].getTimezoneOffset()*1e3+60*l[0].getTimezoneOffset()*1e3;B(f*h/e)}),[h,l,f]),t.useEffect((function(){var e=function(e){return a(void 0,void 0,void 0,(function(){var t,r,o,n,a;return s(this,(function(s){return c.changedTask&&O&&(null==p?void 0:p.current)?(e.preventDefault(),O.x=e.clientX,t=O.matrixTransform(null===(a=null==p?void 0:p.current.getScreenCTM())||void 0===a?void 0:a.inverse()),r=E(t.x,c.action,c.changedTask,H,f,F,k),o=r.isChanged,n=r.changedTask,o&&b({action:c.action,changedTask:n}),[2]):[2]}))}))},t=function(r){return a(void 0,void 0,void 0,(function(){var o,n,a,i,l,d,u,g,h;return s(this,(function(s){switch(s.label){case 0:if(o=c.action,n=c.originalSelectedTask,!((a=c.changedTask)&&O&&(null==p?void 0:p.current)&&n))return[2];if(r.preventDefault(),O.x=r.clientX,i=O.matrixTransform(null===(h=null==p?void 0:p.current.getScreenCTM())||void 0===h?void 0:h.inverse()),l=E(i.x,o,a,H,f,F,k).changedTask,d=n.start!==l.start||n.end!==l.end||n.progress!==l.progress,p.current.removeEventListener("mousemove",e),p.current.removeEventListener("mouseup",t),b({action:""}),z(!1),u=!0,"move"!==o&&"end"!==o&&"start"!==o||!T||!d)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,T(l,l.barChildren)];case 2:return void 0!==(g=s.sent())&&(u=g),[3,4];case 3:return s.sent(),u=!1,[3,4];case 4:return[3,9];case 5:if(!D||!d)return[3,9];s.label=6;case 6:return s.trys.push([6,8,,9]),[4,D(l,l.barChildren)];case 7:return void 0!==(g=s.sent())&&(u=g),[3,9];case 8:return s.sent(),u=!1,[3,9];case 9:return u||C(n),[2]}}))}))};I||"move"!==c.action&&"end"!==c.action&&"start"!==c.action&&"progress"!==c.action||!(null==p?void 0:p.current)||(p.current.addEventListener("mousemove",e),p.current.addEventListener("mouseup",t),z(!0))}),[c,H,F,D,f,T,p,I]),e.jsxs("g",n({className:"content"},{children:[e.jsx("g",n({className:"arrows",fill:x,stroke:x},{children:i.map((function(t){return t.barChildren.map((function(r){var o=i[r.index];return e.jsx(d,{taskFromIndex:t.index,taskFromX1:t.x1,taskFromX2:t.x2,taskFromY:t.y,taskToIndex:o.index,taskToX1:o.x1,taskToX2:o.x2,taskToY:o.y,rowHeight:g,taskHeight:v,arrowIndent:y,rtl:k,rootStyle:{fill:x,stroke:x}},"Arrow from ".concat(t.id," to ").concat(i[r.index].id))}))}))}),void 0),e.jsx("g",n({className:"bar",fontFamily:S,fontSize:m},{children:i.map((function(t){return e.jsx(ye,{task:t,arrowIndent:y,taskHeight:v,isProgressChangeable:!!D&&!t.isDisabled,isDateChangeable:!!T&&!t.isDisabled,isDelete:!t.isDisabled,onEventStart:X,isSelected:!!u&&t.id===u.id,rtl:k},t.id)}))}),void 0)]}),void 0)},Xe=function(r){var o=r.gridProps,a=r.calendarProps,s=r.barProps,i=r.ganttHeight,l=r.scrollY,d=r.scrollX,c=r.rootStyle,u=r.contentStyle,g=t.useRef(null),h=t.useRef(null),f=t.useRef(null);t.useEffect((function(){h.current&&(h.current.scrollTop=l)}),[l]),t.useEffect((function(){f.current&&(f.current.scrollLeft=d)}),[d]);var p=n(n({},s),{svg:g});return e.jsxs("div",n({style:c,ref:f,dir:"ltr"},{children:[e.jsx("svg",n({height:a.headerHeight,width:o.svgWidth,fontFamily:s.fontFamily,xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx(he,n({},a),void 0)}),void 0),e.jsx("div",n({ref:h,style:n(n({},u),{height:i||void 0,width:o.svgWidth})},{children:e.jsxs("svg",n({ref:g,height:s.rowHeight*s.tasks.length,width:o.svgWidth,fontFamily:s.fontFamily,xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx(fe,n({},o),void 0),e.jsx(Oe,n({},p),void 0)]}),void 0)}),void 0)]}),void 0)};Xe.defaultProps={rootStyle:{overflow:"hidden",margin:0,padding:0,fontSize:0},contentStyle:{overflow:"hidden",margin:0,padding:0}};var _e={bodyStyle:{display:"flex",padding:"0",margin:"0",listStyle:"none",outline:"none",position:"relative"},timeStep:3e5,onDateChange:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDateChange: ".concat(e))},onProgressChange:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onProgressChange: ".concat(e))},onDoubleClick:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDoubleClick: ".concat(e))},onDelete:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onDelete: ".concat(e))},onSelect:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onSelect: ".concat(e))},onExpanderClick:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return console.log("onExpanderClick: ".concat(e))},viewMode:exports.ViewMode.Day,locale:"en-GB",rtl:!1,headerHeight:50,columnWidth:60,listCellWidth:"155px",rowHeight:50,ganttHeight:300,barFill:60,barCornerRadius:3,barProgressColor:"#a3a3ff",barProgressSelectedColor:"#8282f5",barBackgroundColor:"#b8c2cc",barBackgroundSelectedColor:"#aeb8c2",projectProgressColor:"#7db59a",projectProgressSelectedColor:"#59a985",projectBackgroundColor:"#fac465",projectBackgroundSelectedColor:"#f7bb53",milestoneBackgroundColor:"#f1c453",milestoneBackgroundSelectedColor:"#f29e4c",handleWidth:8,arrowColor:"grey",fontFamily:"Arial, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue",fontSize:"14px",arrowIndent:20,todayColor:"rgba(252, 248, 227, 0.5)",TooltipContent:function(t){var r=t.task,o=t.fontFamily,a=t.fontSize;return e.jsxs("div",n({style:{background:"#fff",padding:"12px",boxShadow:"0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)",fontFamily:o,fontSize:a}},{children:[e.jsx("b",n({style:{fontSize:a+6}},{children:"".concat(r.name,": ").concat(r.start.getDate(),"-").concat(r.start.getMonth()+1,"-").concat(r.start.getFullYear()," - ").concat(r.end.getDate(),"-").concat(r.end.getMonth()+1,"-").concat(r.end.getFullYear())}),void 0),r.end.getTime()-r.start.getTime()!=0&&e.jsx("p",n({style:{fontSize:"12px",marginBottom:"6px",color:"#666"}},{children:"Duration: ".concat(~~((r.end.getTime()-r.start.getTime())/864e5)," day(s)")}),void 0),e.jsx("p",n({style:{fontSize:"12px",marginBottom:"6px",color:"#666"}},{children:!!r.progress&&"Progress: ".concat(r.progress," %")}),void 0)]}),void 0)}},Ye=function(r){var o=r.tasks,a=r.bodyStyle,s=r.timeStep,i=r.onDateChange,l=r.onProgressChange,d=r.onDoubleClick,g=r.onDelete,v=r.onSelect,x=r.onExpanderClick,y=r.viewMode,m=r.locale,k=r.rtl,b=r.headerHeight,C=r.columnWidth,w=r.listCellWidth,T=r.rowHeight,D=r.ganttHeight,j=r.barFill,P=r.barCornerRadius,M=r.barProgressColor,H=r.barProgressSelectedColor,B=r.barBackgroundColor,W=r.barBackgroundSelectedColor,E=r.projectProgressColor,F=r.projectProgressSelectedColor,L=r.projectBackgroundColor,R=r.projectBackgroundSelectedColor,I=r.milestoneBackgroundColor,z=r.milestoneBackgroundSelectedColor,O=r.handleWidth,X=r.arrowColor,_=r.fontFamily,Y=r.fontSize,A=r.arrowIndent,V=r.todayColor,N=r.TooltipContent,G=t.useState((function(){var e=ae(o,y),t=e[0],r=e[1];return{viewMode:y,dates:se(t,r,y)}})),K=G[0],Q=G[1],q=t.useState(T*j/100),U=q[0],Z=q[1],J=t.useState(0),$=J[0],ee=J[1],te=t.useState(0),re=te[0],oe=te[1],ne=t.useState(D),ie=ne[0],le=ne[1],de=t.useState([]),ce=de[0],ue=de[1],ge=t.useState({action:""}),he=ge[0],fe=ge[1],pe=t.useState(),ve=pe[0],xe=pe[1],ye=t.useState(null),be=ye[0],Ce=ye[1],De=t.useState(0),je=De[0],Pe=De[1],Me=t.useState(-1),He=Me[0],Be=Me[1],We=t.useState(!1),Ee=We[0],Fe=We[1],Re=t.useRef(null),Ie=t.useRef(null),ze=K.dates.length*C,Oe=ce.length*T;t.useEffect((function(){var e=x?Le(o):o,t=ae(e,y),r=t[0],n=t[1],a=se(r,n,y);k&&(a=a.reverse(),-1===He&&Be(a.length*C)),Q({dates:a,viewMode:y}),ue(S({tasks:e,dates:a,columnWidth:C,rowHeight:T,taskHeight:U,barCornerRadius:P,handleWidth:O,rtl:k,barProgressColor:M,barProgressSelectedColor:H,barBackgroundColor:B,barBackgroundSelectedColor:W,projectProgressColor:E,projectProgressSelectedColor:F,projectBackgroundColor:L,projectBackgroundSelectedColor:R,milestoneBackgroundColor:I,milestoneBackgroundSelectedColor:z}))}),[o,y,T,P,C,U,O,M,H,B,W,E,F,L,R,I,z,k,He,x]),t.useEffect((function(){var e=he.changedTask,t=he.action;if(e)if("delete"===t)fe({action:""}),ue(ce.filter((function(t){return t.id!==e.id})));else if("move"===t||"end"===t||"start"===t||"progress"===t){var r=ce.find((function(t){return t.id===e.id}));if(r&&(r.start.getTime()!==e.start.getTime()||r.end.getTime()!==e.end.getTime()||r.progress!==e.progress)){var o=ce.map((function(t){return t.id===e.id?e:t}));ue(o)}}}),[he,ce]),t.useEffect((function(){Re.current&&oe(Re.current.offsetWidth-$)}),[Re,$]),t.useEffect((function(){var e=function(e){if(e.shiftKey||e.deltaX){var t=e.deltaX?e.deltaX:e.deltaY,r=He+t;r<0?r=0:r>ze&&(r=ze),Be(r),e.preventDefault()}else if(D){var o=je+e.deltaY;o<0?o=0:o>Oe-D&&(o=Oe-D),o!==je&&(Pe(o),e.preventDefault())}Fe(!0)};return Re.current&&Re.current.addEventListener("wheel",e,{passive:!1}),function(){Re.current&&Re.current.removeEventListener("wheel",e)}}),[Re.current,je,He,D,ze,k]),t.useEffect((function(){be&&(ue(ce.map((function(e){return e.id!==be.id?e:be}))),Ce(null))}),[be,ce]),t.useEffect((function(){var e=T*j/100;e!==U&&Z(e)}),[T,j,U]),t.useEffect((function(){w||ee(0),Ie.current&&ee(Ie.current.offsetWidth)}),[Ie,w]),t.useEffect((function(){le(D?D+b:o.length*T+b)}),[D,b,T,o]);var _e={columnWidth:C,svgWidth:ze,tasks:o,rowHeight:T,dates:K.dates,todayColor:V,rtl:k},Ye={dateSetup:K,locale:m,headerHeight:b,columnWidth:C,rtl:k,rootStyle:{fontFamily:_,fontSize:Y}},Ae={tasks:ce,dates:K.dates,ganttEvent:he,selectedTask:ve,rowHeight:T,taskHeight:U,columnWidth:C,arrowColor:X,timeStep:s,fontFamily:_,fontSize:Y,arrowIndent:A,svgWidth:ze,rtl:k,setGanttEvent:fe,setFailedTask:Ce,setSelectedTask:function(e){var t=ce.find((function(t){return t.id===e})),r=ce.find((function(e){return!!ve&&e.id===ve.id}));v&&(r&&v(r,!1),t&&v(t,!0)),xe(t)},onDateChange:i,onProgressChange:l,onDoubleClick:d,onDelete:g},Ve={scrollY:je,TaskListHeader:ke,TaskListTable:Te,taskListHeaderProps:{rootStyle:n(n({},me.rootStyle),{fontFamily:"sans-serif",fontSize:"15px"}),headerStyle:n(n({},me.headerStyle),{height:48}),columnStyle:n(n({},me.columnStyle),{minWidth:150,textAlign:"center"}),columnSeparatorStyle:n(n({},me.columnSeparatorStyle),{height:25,marginTop:10})},taskListTableProps:{tasks:ce,locale:"en-GB",onExpanderClick:function(e){x&&void 0!==e.hideChildren&&x(n(n({},e),{hideChildren:!e.hideChildren}))},rootStyle:n(n({},we.rootStyle),{fontFamily:"Arial",fontSize:"15px"}),tableRowStyle:n(n({},we.tableRowStyle),{height:50}),tableCellStyle:n(n({},we.tableCellStyle),{minWidth:150,maxWidth:150})},taskListTableWrapperStyles:{height:D,overflow:"hidden"},taskListRef:Ie};return e.jsxs("div",{children:[e.jsxs("div",n({style:a,tabIndex:0,ref:Re},{children:[w&&e.jsx(Se,n({},Ve),void 0),e.jsx(Xe,{barProps:Ae,gridProps:_e,calendarProps:Ye,ganttHeight:D,scrollX:He,scrollY:je},void 0),he.changedTask&&e.jsx(h,n({arrowIndent:A,rowHeight:T,svgContainerHeight:ie,svgContainerWidth:re,scrollX:He,scrollY:je,task:he.changedTask,headerHeight:b,taskListWidth:$,rtl:k},{children:e.jsx(N,{task:he.changedTask,fontSize:"15px",fontFamily:"Arial"},void 0)}),void 0),e.jsx(p,{scroll:je,onScroll:function(e){je===e.currentTarget.scrollTop||Ee||Pe(e.currentTarget.scrollTop),Fe(!1)},rootStyle:n(n({},f.rootStyle),{height:D,marginTop:b,marginLeft:k?"":"-17px"}),bodyStyle:n(n({},f.bodyStyle),{height:Oe})},void 0)]}),void 0),e.jsx(u,{scroll:He,onScroll:function(e){He===e.currentTarget.scrollLeft||Ee||Be(e.currentTarget.scrollLeft),Fe(!1)},rootStyle:n(n({},c.rootStyle),{margin:k?"0px ".concat($,"px 0px 0px"):"0px 0px 0px ".concat($,"px")}),bodyStyle:n(n({},c.bodyStyle),{width:ze})},void 0)]},void 0)};Ye.defaultProps=_e;var Ae=function(r){var o,i=r.tasks,l=r.dates,c=r.ganttEvent,u=r.selectedTask,g=r.rowHeight,h=r.columnWidth,f=r.timeStep,p=r.svg,v=r.taskHeight,x=r.arrowColor,y=r.arrowIndent,S=r.fontFamily,m=r.fontSize,k=r.rtl,b=r.setGanttEvent,C=r.setFailedTask,w=r.setSelectedTask,T=r.onDateChange,D=r.onProgressChange,j=r.onDoubleClick,P=r.onDelete,M=t.useState(0),H=M[0],B=M[1],W=t.useState(0),F=W[0],L=W[1],R=t.useState(!1),I=R[0],z=R[1],O=null===(o=null==p?void 0:p.current)||void 0===o?void 0:o.createSVGPoint(),X=function(e,t,r){return a(void 0,void 0,void 0,(function(){var o,n,a,i;return s(this,(function(s){switch(s.label){case 0:return r?[3,1]:("select"===e&&w(t.id),[3,7]);case 1:if(!We(r))return[3,6];if("delete"!==e)return[3,5];if(!P)return[3,5];s.label=2;case 2:return s.trys.push([2,4,,5]),[4,P(t)];case 3:return void 0!==(o=s.sent())&&o&&b({action:e,changedTask:t}),[3,5];case 4:return n=s.sent(),console.error("Error on Delete. "+n),[3,5];case 5:return[3,7];case 6:if("mouseenter"===e)c.action||b({action:e,changedTask:t,originalSelectedTask:t});else if("mouseleave"===e)"mouseenter"===c.action&&b({action:""});else if("dblclick"===e)j&&j(t);else if("move"===e){if(!(null==p?void 0:p.current)||!O)return[2];O.x=r.clientX,a=O.matrixTransform(null===(i=p.current.getScreenCTM())||void 0===i?void 0:i.inverse()),L(a.x-t.x1),b({action:e,changedTask:t,originalSelectedTask:t})}else b({action:e,changedTask:t,originalSelectedTask:t});s.label=7;case 7:return[2]}}))}))};return t.useEffect((function(){var e=l[1].getTime()-l[0].getTime()-60*l[1].getTimezoneOffset()*1e3+60*l[0].getTimezoneOffset()*1e3;B(f*h/e)}),[h,l,f]),t.useEffect((function(){var e=function(e){return a(void 0,void 0,void 0,(function(){var t,r,o,n,a;return s(this,(function(s){return c.changedTask&&O&&(null==p?void 0:p.current)?(e.preventDefault(),O.x=e.clientX,t=O.matrixTransform(null===(a=null==p?void 0:p.current.getScreenCTM())||void 0===a?void 0:a.inverse()),r=E(t.x,c.action,c.changedTask,H,f,F,k),o=r.isChanged,n=r.changedTask,o&&b({action:c.action,changedTask:n}),[2]):[2]}))}))},t=function(r){return a(void 0,void 0,void 0,(function(){var o,n,a,i,l,d,u,g,h;return s(this,(function(s){switch(s.label){case 0:if(o=c.action,n=c.originalSelectedTask,!((a=c.changedTask)&&O&&(null==p?void 0:p.current)&&n))return[2];if(r.preventDefault(),O.x=r.clientX,i=O.matrixTransform(null===(h=null==p?void 0:p.current.getScreenCTM())||void 0===h?void 0:h.inverse()),l=E(i.x,o,a,H,f,F,k).changedTask,d=n.start!==l.start||n.end!==l.end||n.progress!==l.progress,p.current.removeEventListener("mousemove",e),p.current.removeEventListener("mouseup",t),b({action:""}),z(!1),u=!0,"move"!==o&&"end"!==o&&"start"!==o||!T||!d)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,T(l,l.barChil