(r[M].coordinate+r[M-1].coordinate)/2&&t<=(r[M].coordinate+r[M+1].coordinate)/2||M===d-1&&t>(r[M].coordinate+r[M-1].coordinate)/2){c=r[M].index;break}return c},w1=function(t){var n,r=t,l=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?At(At({},t.type.defaultProps),t.props):t.props,c=o.stroke,d=o.fill,h;switch(l){case"Line":h=c;break;case"Area":case"Radar":h=c&&c!=="none"?c:d;break;default:h=d;break}return h},EH=function(t){var n=t.barSize,r=t.totalSize,l=t.stackGroups,o=l===void 0?{}:l;if(!o)return{};for(var c={},d=Object.keys(o),h=0,p=d.length;h=0});if(O&&O.length){var w=O[0].type.defaultProps,E=w!==void 0?At(At({},w),O[0].props):O[0].props,M=E.barSize,A=E[x];c[A]||(c[A]=[]);var C=ze(M)?n:M;c[A].push({item:O[0],stackList:O.slice(1),barSize:ze(C)?void 0:fn(C,r,0)})}}return c},TH=function(t){var n=t.barGap,r=t.barCategoryGap,l=t.bandSize,o=t.sizeList,c=o===void 0?[]:o,d=t.maxBarSize,h=c.length;if(h<1)return null;var p=fn(n,l,0,!0),v,m=[];if(c[0].barSize===+c[0].barSize){var g=!1,j=l/h,S=c.reduce(function(M,A){return M+A.barSize||0},0);S+=(h-1)*p,S>=l&&(S-=(h-1)*p,p=0),S>=l&&j>0&&(g=!0,j*=.9,S=h*j);var _=(l-S)/2>>0,x={offset:_-p,size:0};v=c.reduce(function(M,A){var C={item:A.item,position:{offset:x.offset+x.size+p,size:g?j:A.barSize}},k=[].concat(YE(M),[C]);return x=k[k.length-1].position,A.stackList&&A.stackList.length&&A.stackList.forEach(function(z){k.push({item:z,position:x})}),k},m)}else{var O=fn(r,l,0,!0);l-2*O-(h-1)*p<=0&&(p=0);var w=(l-2*O-(h-1)*p)/h;w>1&&(w>>=0);var E=d===+d?Math.min(w,d):w;v=c.reduce(function(M,A,C){var k=[].concat(YE(M),[{item:A.item,position:{offset:O+(w+p)*C+(w-E)/2,size:E}}]);return A.stackList&&A.stackList.length&&A.stackList.forEach(function(z){k.push({item:z,position:k[k.length-1].position})}),k},m)}return v},CH=function(t,n,r,l){var o=r.children,c=r.width,d=r.margin,h=c-(d.left||0)-(d.right||0),p=aR({children:o,legendWidth:h});if(p){var v=l||{},m=v.width,g=v.height,j=p.align,S=p.verticalAlign,_=p.layout;if((_==="vertical"||_==="horizontal"&&S==="middle")&&j!=="center"&&ve(t[j]))return At(At({},t),{},$l({},j,t[j]+(m||0)));if((_==="horizontal"||_==="vertical"&&j==="center")&&S!=="middle"&&ve(t[S]))return At(At({},t),{},$l({},S,t[S]+(g||0)))}return t},MH=function(t,n,r){return ze(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},iR=function(t,n,r,l,o){var c=n.props.children,d=er(c,th).filter(function(p){return MH(l,o,p.props.direction)});if(d&&d.length){var h=d.map(function(p){return p.props.dataKey});return t.reduce(function(p,v){var m=sn(v,r);if(ze(m))return p;var g=Array.isArray(m)?[Wd(m),Zd(m)]:[m,m],j=h.reduce(function(S,_){var x=sn(v,_,0),O=g[0]-Math.abs(Array.isArray(x)?x[0]:x),w=g[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(O,S[0]),Math.max(w,S[1])]},[1/0,-1/0]);return[Math.min(j[0],p[0]),Math.max(j[1],p[1])]},[1/0,-1/0])}return null},kH=function(t,n,r,l,o){var c=n.map(function(d){return iR(t,d,r,o,l)}).filter(function(d){return!ze(d)});return c&&c.length?c.reduce(function(d,h){return[Math.min(d[0],h[0]),Math.max(d[1],h[1])]},[1/0,-1/0]):null},lR=function(t,n,r,l,o){var c=n.map(function(h){var p=h.props.dataKey;return r==="number"&&p&&iR(t,h,p,l)||Rs(t,p,r,o)});if(r==="number")return c.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var d={};return c.reduce(function(h,p){for(var v=0,m=p.length;v=2?cn(d[0]-d[1])*2*p:p,n&&(t.ticks||t.niceTicks)){var v=(t.ticks||t.niceTicks).map(function(m){var g=o?o.indexOf(m):m;return{coordinate:l(g)+p,value:m,offset:p}});return v.filter(function(m){return!Au(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,g){return{coordinate:l(m)+p,value:m,index:g,offset:p}}):l.ticks&&!r?l.ticks(t.tickCount).map(function(m){return{coordinate:l(m)+p,value:m,offset:p}}):l.domain().map(function(m,g){return{coordinate:l(m)+p,value:o?o[m]:m,index:g,offset:p}})},ib=new WeakMap,sf=function(t,n){if(typeof n!="function")return t;ib.has(t)||ib.set(t,new WeakMap);var r=ib.get(t);if(r.has(n))return r.get(n);var l=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,l),l},uR=function(t,n,r){var l=t.scale,o=t.type,c=t.layout,d=t.axisType;if(l==="auto")return c==="radial"&&d==="radiusAxis"?{scale:Vs(),realScaleType:"band"}:c==="radial"&&d==="angleAxis"?{scale:Uf(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:ks(),realScaleType:"point"}:o==="category"?{scale:Vs(),realScaleType:"band"}:{scale:Uf(),realScaleType:"linear"};if(Ei(l)){var h="scale".concat(Dd(l));return{scale:(ME[h]||ks)(),realScaleType:ME[h]?h:"point"}}return ke(l)?{scale:l}:{scale:ks(),realScaleType:"point"}},FE=1e-4,cR=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,l=t.range(),o=Math.min(l[0],l[1])-FE,c=Math.max(l[0],l[1])+FE,d=t(n[0]),h=t(n[r-1]);(dc||hc)&&t.domain([n[0],n[r-1]])}},RH=function(t,n){if(!t)return null;for(var r=0,l=t.length;rl)&&(o[1]=l),o[0]>l&&(o[0]=l),o[1]=0?(t[d][r][0]=o,t[d][r][1]=o+h,o=t[d][r][1]):(t[d][r][0]=c,t[d][r][1]=c+h,c=t[d][r][1])}},$H=function(t){var n=t.length;if(!(n<=0))for(var r=0,l=t[0].length;r=0?(t[c][r][0]=o,t[c][r][1]=o+d,o=t[c][r][1]):(t[c][r][0]=0,t[c][r][1]=0)}},qH={sign:DH,expand:wz,none:ql,silhouette:Oz,wiggle:Az,positive:$H},zH=function(t,n,r){var l=n.map(function(d){return d.props.dataKey}),o=qH[r],c=Sz().keys(l).value(function(d,h){return+sn(d,h,0)}).order(ax).offset(o);return c(t)},LH=function(t,n,r,l,o,c){if(!t)return null;var d=c?n.reverse():n,h={},p=d.reduce(function(m,g){var j,S=(j=g.type)!==null&&j!==void 0&&j.defaultProps?At(At({},g.type.defaultProps),g.props):g.props,_=S.stackId,x=S.hide;if(x)return m;var O=S[r],w=m[O]||{hasStack:!1,stackGroups:{}};if(It(_)){var E=w.stackGroups[_]||{numericAxisId:r,cateAxisId:l,items:[]};E.items.push(g),w.hasStack=!0,w.stackGroups[_]=E}else w.stackGroups[Nu("_stackId_")]={numericAxisId:r,cateAxisId:l,items:[g]};return At(At({},m),{},$l({},O,w))},h),v={};return Object.keys(p).reduce(function(m,g){var j=p[g];if(j.hasStack){var S={};j.stackGroups=Object.keys(j.stackGroups).reduce(function(_,x){var O=j.stackGroups[x];return At(At({},_),{},$l({},x,{numericAxisId:r,cateAxisId:l,items:O.items,stackedData:zH(t,O.items,o)}))},S)}return At(At({},m),{},$l({},g,j))},v)},fR=function(t,n){var r=n.realScaleType,l=n.type,o=n.tickCount,c=n.originalDomain,d=n.allowDecimals,h=r||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&l==="number"&&c&&(c[0]==="auto"||c[1]==="auto")){var p=t.domain();if(!p.length)return null;var v=JI(p,o,d);return t.domain([Wd(v),Zd(v)]),{niceTicks:v}}if(o&&l==="number"){var m=t.domain(),g=eH(m,o,d);return{niceTicks:g}}return null},KE=function(t){var n=t.axis,r=t.ticks,l=t.offset,o=t.bandSize,c=t.entry,d=t.index;if(n.type==="category")return r[d]?r[d].coordinate+l:null;var h=sn(c,n.dataKey,n.domain[d]);return ze(h)?null:n.scale(h)-o/2+l},BH=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var l=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return l<=0&&o>=0?0:o<0?o:l}return r[0]},UH=function(t,n){var r,l=(r=t.type)!==null&&r!==void 0&&r.defaultProps?At(At({},t.type.defaultProps),t.props):t.props,o=l.stackId;if(It(o)){var c=n[o];if(c){var d=c.items.indexOf(t);return d>=0?c.stackedData[d]:null}}return null},IH=function(t){return t.reduce(function(n,r){return[Wd(r.concat([n[0]]).filter(ve)),Zd(r.concat([n[1]]).filter(ve))]},[1/0,-1/0])},dR=function(t,n,r){return Object.keys(t).reduce(function(l,o){var c=t[o],d=c.stackedData,h=d.reduce(function(p,v){var m=IH(v.slice(n,r+1));return[Math.min(p[0],m[0]),Math.max(p[1],m[1])]},[1/0,-1/0]);return[Math.min(h[0],l[0]),Math.max(h[1],l[1])]},[1/0,-1/0]).map(function(l){return l===1/0||l===-1/0?0:l})},XE=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ZE=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Tx=function(t,n,r){if(ke(t))return t(n,r);if(!Array.isArray(t))return n;var l=[];if(ve(t[0]))l[0]=r?t[0]:Math.min(t[0],n[0]);else if(XE.test(t[0])){var o=+XE.exec(t[0])[1];l[0]=n[0]-o}else ke(t[0])?l[0]=t[0](n[0]):l[0]=n[0];if(ve(t[1]))l[1]=r?t[1]:Math.max(t[1],n[1]);else if(ZE.test(t[1])){var c=+ZE.exec(t[1])[1];l[1]=n[1]+c}else ke(t[1])?l[1]=t[1](n[1]):l[1]=n[1];return l},Kf=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var l=t.scale.bandwidth();if(!r||l>0)return l}if(t&&n&&n.length>=2){for(var o=Q0(n,function(m){return m.coordinate}),c=1/0,d=1,h=o.length;de.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},WH=function(t,n,r,l,o){var c=t.width,d=t.height,h=t.startAngle,p=t.endAngle,v=fn(t.cx,c,c/2),m=fn(t.cy,d,d/2),g=mR(c,d,r),j=fn(t.innerRadius,g,0),S=fn(t.outerRadius,g,g*.8),_=Object.keys(n);return _.reduce(function(x,O){var w=n[O],E=w.domain,M=w.reversed,A;if(ze(w.range))l==="angleAxis"?A=[h,p]:l==="radiusAxis"&&(A=[j,S]),M&&(A=[A[1],A[0]]);else{A=w.range;var C=A,k=YH(C,2);h=k[0],p=k[1]}var z=uR(w,o),B=z.realScaleType,Z=z.scale;Z.domain(E).range(A),cR(Z);var G=fR(Z,Xr(Xr({},w),{},{realScaleType:B})),H=Xr(Xr(Xr({},w),G),{},{range:A,radius:S,realScaleType:B,scale:Z,cx:v,cy:m,innerRadius:j,outerRadius:S,startAngle:h,endAngle:p});return Xr(Xr({},x),{},pR({},O,H))},{})},QH=function(t,n){var r=t.x,l=t.y,o=n.x,c=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(l-c,2))},JH=function(t,n){var r=t.x,l=t.y,o=n.cx,c=n.cy,d=QH({x:r,y:l},{x:o,y:c});if(d<=0)return{radius:d};var h=(r-o)/d,p=Math.acos(h);return l>c&&(p=2*Math.PI-p),{radius:d,angle:ZH(p),angleInRadian:p}},eG=function(t){var n=t.startAngle,r=t.endAngle,l=Math.floor(n/360),o=Math.floor(r/360),c=Math.min(l,o);return{startAngle:n-c*360,endAngle:r-c*360}},tG=function(t,n){var r=n.startAngle,l=n.endAngle,o=Math.floor(r/360),c=Math.floor(l/360),d=Math.min(o,c);return t+d*360},eT=function(t,n){var r=t.x,l=t.y,o=JH({x:r,y:l},n),c=o.radius,d=o.angle,h=n.innerRadius,p=n.outerRadius;if(cp)return!1;if(c===0)return!0;var v=eG(n),m=v.startAngle,g=v.endAngle,j=d,S;if(m<=g){for(;j>g;)j-=360;for(;j=m&&j<=g}else{for(;j>m;)j-=360;for(;j=g&&j<=m}return S?Xr(Xr({},n),{},{radius:c,angle:tG(j,n)}):null},vR=function(t){return!T.isValidElement(t)&&!ke(t)&&typeof t!="boolean"?t.className:""};function nu(e){"@babel/helpers - typeof";return nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nu(e)}var nG=["offset"];function rG(e){return oG(e)||lG(e)||iG(e)||aG()}function aG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iG(e,t){if(e){if(typeof e=="string")return Cx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cx(e,t)}}function lG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oG(e){if(Array.isArray(e))return Cx(e)}function Cx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ut(e){for(var t=1;t=0?1:-1,E,M;l==="insideStart"?(E=j+w*c,M=_):l==="insideEnd"?(E=S-w*c,M=!_):l==="end"&&(E=S+w*c,M=_),M=O<=0?M:!M;var A=mt(p,v,x,E),C=mt(p,v,x,E+(M?1:-1)*359),k="M".concat(A.x,",").concat(A.y,`
+ A`).concat(x,",").concat(x,",0,1,").concat(M?0:1,`,
+ `).concat(C.x,",").concat(C.y),z=ze(t.id)?Nu("recharts-radial-line-"):t.id;return Y.createElement("text",ru({},r,{dominantBaseline:"central",className:qe("recharts-radial-bar-label",d)}),Y.createElement("defs",null,Y.createElement("path",{id:z,d:k})),Y.createElement("textPath",{xlinkHref:"#".concat(z)},n))},vG=function(t){var n=t.viewBox,r=t.offset,l=t.position,o=n,c=o.cx,d=o.cy,h=o.innerRadius,p=o.outerRadius,v=o.startAngle,m=o.endAngle,g=(v+m)/2;if(l==="outside"){var j=mt(c,d,p+r,g),S=j.x,_=j.y;return{x:S,y:_,textAnchor:S>=c?"start":"end",verticalAnchor:"middle"}}if(l==="center")return{x:c,y:d,textAnchor:"middle",verticalAnchor:"middle"};if(l==="centerTop")return{x:c,y:d,textAnchor:"middle",verticalAnchor:"start"};if(l==="centerBottom")return{x:c,y:d,textAnchor:"middle",verticalAnchor:"end"};var x=(h+p)/2,O=mt(c,d,x,g),w=O.x,E=O.y;return{x:w,y:E,textAnchor:"middle",verticalAnchor:"middle"}},yG=function(t){var n=t.viewBox,r=t.parentViewBox,l=t.offset,o=t.position,c=n,d=c.x,h=c.y,p=c.width,v=c.height,m=v>=0?1:-1,g=m*l,j=m>0?"end":"start",S=m>0?"start":"end",_=p>=0?1:-1,x=_*l,O=_>0?"end":"start",w=_>0?"start":"end";if(o==="top"){var E={x:d+p/2,y:h-m*l,textAnchor:"middle",verticalAnchor:j};return Ut(Ut({},E),r?{height:Math.max(h-r.y,0),width:p}:{})}if(o==="bottom"){var M={x:d+p/2,y:h+v+g,textAnchor:"middle",verticalAnchor:S};return Ut(Ut({},M),r?{height:Math.max(r.y+r.height-(h+v),0),width:p}:{})}if(o==="left"){var A={x:d-x,y:h+v/2,textAnchor:O,verticalAnchor:"middle"};return Ut(Ut({},A),r?{width:Math.max(A.x-r.x,0),height:v}:{})}if(o==="right"){var C={x:d+p+x,y:h+v/2,textAnchor:w,verticalAnchor:"middle"};return Ut(Ut({},C),r?{width:Math.max(r.x+r.width-C.x,0),height:v}:{})}var k=r?{width:p,height:v}:{};return o==="insideLeft"?Ut({x:d+x,y:h+v/2,textAnchor:w,verticalAnchor:"middle"},k):o==="insideRight"?Ut({x:d+p-x,y:h+v/2,textAnchor:O,verticalAnchor:"middle"},k):o==="insideTop"?Ut({x:d+p/2,y:h+g,textAnchor:"middle",verticalAnchor:S},k):o==="insideBottom"?Ut({x:d+p/2,y:h+v-g,textAnchor:"middle",verticalAnchor:j},k):o==="insideTopLeft"?Ut({x:d+x,y:h+g,textAnchor:w,verticalAnchor:S},k):o==="insideTopRight"?Ut({x:d+p-x,y:h+g,textAnchor:O,verticalAnchor:S},k):o==="insideBottomLeft"?Ut({x:d+x,y:h+v-g,textAnchor:w,verticalAnchor:j},k):o==="insideBottomRight"?Ut({x:d+p-x,y:h+v-g,textAnchor:O,verticalAnchor:j},k):po(o)&&(ve(o.x)||ji(o.x))&&(ve(o.y)||ji(o.y))?Ut({x:d+fn(o.x,p),y:h+fn(o.y,v),textAnchor:"end",verticalAnchor:"end"},k):Ut({x:d+p/2,y:h+v/2,textAnchor:"middle",verticalAnchor:"middle"},k)},gG=function(t){return"cx"in t&&ve(t.cx)};function Ft(e){var t=e.offset,n=t===void 0?5:t,r=sG(e,nG),l=Ut({offset:n},r),o=l.viewBox,c=l.position,d=l.value,h=l.children,p=l.content,v=l.className,m=v===void 0?"":v,g=l.textBreakAll;if(!o||ze(d)&&ze(h)&&!T.isValidElement(p)&&!ke(p))return null;if(T.isValidElement(p))return T.cloneElement(p,l);var j;if(ke(p)){if(j=T.createElement(p,l),T.isValidElement(j))return j}else j=hG(l);var S=gG(o),_=Ce(l,!0);if(S&&(c==="insideStart"||c==="insideEnd"||c==="end"))return mG(l,j,_);var x=S?vG(l):yG(l);return Y.createElement(Ci,ru({className:qe("recharts-label",m)},_,x,{breakAll:g}),j)}Ft.displayName="Label";var yR=function(t){var n=t.cx,r=t.cy,l=t.angle,o=t.startAngle,c=t.endAngle,d=t.r,h=t.radius,p=t.innerRadius,v=t.outerRadius,m=t.x,g=t.y,j=t.top,S=t.left,_=t.width,x=t.height,O=t.clockWise,w=t.labelViewBox;if(w)return w;if(ve(_)&&ve(x)){if(ve(m)&&ve(g))return{x:m,y:g,width:_,height:x};if(ve(j)&&ve(S))return{x:j,y:S,width:_,height:x}}return ve(m)&&ve(g)?{x:m,y:g,width:0,height:0}:ve(n)&&ve(r)?{cx:n,cy:r,startAngle:o||l||0,endAngle:c||l||0,innerRadius:p||0,outerRadius:v||h||d||0,clockWise:O}:t.viewBox?t.viewBox:{}},bG=function(t,n){return t?t===!0?Y.createElement(Ft,{key:"label-implicit",viewBox:n}):It(t)?Y.createElement(Ft,{key:"label-implicit",viewBox:n,value:t}):T.isValidElement(t)?t.type===Ft?T.cloneElement(t,{key:"label-implicit",viewBox:n}):Y.createElement(Ft,{key:"label-implicit",content:t,viewBox:n}):ke(t)?Y.createElement(Ft,{key:"label-implicit",content:t,viewBox:n}):po(t)?Y.createElement(Ft,ru({viewBox:n},t,{key:"label-implicit"})):null:null},xG=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var l=t.children,o=yR(t),c=er(l,Ft).map(function(h,p){return T.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!r)return c;var d=bG(t.label,n||o);return[d].concat(rG(c))};Ft.parseViewBox=yR;Ft.renderCallByParent=xG;var lb,nT;function jG(){if(nT)return lb;nT=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return lb=e,lb}var _G=jG();const SG=rt(_G);function au(e){"@babel/helpers - typeof";return au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(e)}var wG=["valueAccessor"],OG=["data","dataKey","clockWise","id","textBreakAll"];function AG(e){return CG(e)||TG(e)||EG(e)||NG()}function NG(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EG(e,t){if(e){if(typeof e=="string")return Mx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mx(e,t)}}function TG(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function CG(e){if(Array.isArray(e))return Mx(e)}function Mx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function PG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var DG=function(t){return Array.isArray(t.value)?SG(t.value):t.value};function Ha(e){var t=e.valueAccessor,n=t===void 0?DG:t,r=iT(e,wG),l=r.data,o=r.dataKey,c=r.clockWise,d=r.id,h=r.textBreakAll,p=iT(r,OG);return!l||!l.length?null:Y.createElement(tt,{className:"recharts-label-list"},l.map(function(v,m){var g=ze(o)?n(v,m):sn(v&&v.payload,o),j=ze(d)?{}:{id:"".concat(d,"-").concat(m)};return Y.createElement(Ft,Zf({},Ce(v,!0),p,j,{parentViewBox:v.parentViewBox,value:g,textBreakAll:h,viewBox:Ft.parseViewBox(ze(c)?v:aT(aT({},v),{},{clockWise:c})),key:"label-".concat(m),index:m}))}))}Ha.displayName="LabelList";function $G(e,t){return e?e===!0?Y.createElement(Ha,{key:"labelList-implicit",data:t}):Y.isValidElement(e)||ke(e)?Y.createElement(Ha,{key:"labelList-implicit",data:t,content:e}):po(e)?Y.createElement(Ha,Zf({data:t},e,{key:"labelList-implicit"})):null:null}function qG(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,l=er(r,Ha).map(function(c,d){return T.cloneElement(c,{data:t,key:"labelList-".concat(d)})});if(!n)return l;var o=$G(e.label,t);return[o].concat(AG(l))}Ha.renderCallByParent=qG;function iu(e){"@babel/helpers - typeof";return iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iu(e)}function kx(){return kx=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(c>p),`,
+ `).concat(m.x,",").concat(m.y,`
+ `);if(l>0){var j=mt(n,r,l,c),S=mt(n,r,l,p);g+="L ".concat(S.x,",").concat(S.y,`
+ A `).concat(l,",").concat(l,`,0,
+ `).concat(+(Math.abs(h)>180),",").concat(+(c<=p),`,
+ `).concat(j.x,",").concat(j.y," Z")}else g+="L ".concat(n,",").concat(r," Z");return g},IG=function(t){var n=t.cx,r=t.cy,l=t.innerRadius,o=t.outerRadius,c=t.cornerRadius,d=t.forceCornerRadius,h=t.cornerIsExternal,p=t.startAngle,v=t.endAngle,m=cn(v-p),g=uf({cx:n,cy:r,radius:o,angle:p,sign:m,cornerRadius:c,cornerIsExternal:h}),j=g.circleTangency,S=g.lineTangency,_=g.theta,x=uf({cx:n,cy:r,radius:o,angle:v,sign:-m,cornerRadius:c,cornerIsExternal:h}),O=x.circleTangency,w=x.lineTangency,E=x.theta,M=h?Math.abs(p-v):Math.abs(p-v)-_-E;if(M<0)return d?"M ".concat(S.x,",").concat(S.y,`
+ a`).concat(c,",").concat(c,",0,0,1,").concat(c*2,`,0
+ a`).concat(c,",").concat(c,",0,0,1,").concat(-c*2,`,0
+ `):gR({cx:n,cy:r,innerRadius:l,outerRadius:o,startAngle:p,endAngle:v});var A="M ".concat(S.x,",").concat(S.y,`
+ A`).concat(c,",").concat(c,",0,0,").concat(+(m<0),",").concat(j.x,",").concat(j.y,`
+ A`).concat(o,",").concat(o,",0,").concat(+(M>180),",").concat(+(m<0),",").concat(O.x,",").concat(O.y,`
+ A`).concat(c,",").concat(c,",0,0,").concat(+(m<0),",").concat(w.x,",").concat(w.y,`
+ `);if(l>0){var C=uf({cx:n,cy:r,radius:l,angle:p,sign:m,isExternal:!0,cornerRadius:c,cornerIsExternal:h}),k=C.circleTangency,z=C.lineTangency,B=C.theta,Z=uf({cx:n,cy:r,radius:l,angle:v,sign:-m,isExternal:!0,cornerRadius:c,cornerIsExternal:h}),G=Z.circleTangency,H=Z.lineTangency,W=Z.theta,Q=h?Math.abs(p-v):Math.abs(p-v)-B-W;if(Q<0&&c===0)return"".concat(A,"L").concat(n,",").concat(r,"Z");A+="L".concat(H.x,",").concat(H.y,`
+ A`).concat(c,",").concat(c,",0,0,").concat(+(m<0),",").concat(G.x,",").concat(G.y,`
+ A`).concat(l,",").concat(l,",0,").concat(+(Q>180),",").concat(+(m>0),",").concat(k.x,",").concat(k.y,`
+ A`).concat(c,",").concat(c,",0,0,").concat(+(m<0),",").concat(z.x,",").concat(z.y,"Z")}else A+="L".concat(n,",").concat(r,"Z");return A},HG={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},bR=function(t){var n=oT(oT({},HG),t),r=n.cx,l=n.cy,o=n.innerRadius,c=n.outerRadius,d=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,v=n.startAngle,m=n.endAngle,g=n.className;if(c0&&Math.abs(v-m)<360?x=IG({cx:r,cy:l,innerRadius:o,outerRadius:c,cornerRadius:Math.min(_,S/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:v,endAngle:m}):x=gR({cx:r,cy:l,innerRadius:o,outerRadius:c,startAngle:v,endAngle:m}),Y.createElement("path",kx({},Ce(n,!0),{className:j,d:x,role:"img"}))};function lu(e){"@babel/helpers - typeof";return lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lu(e)}function Rx(){return Rx=Object.assign?Object.assign.bind():function(e){for(var t=1;ttY.call(e,t));function Li(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const aY="__v",iY="__o",lY="_owner",{getOwnPropertyDescriptor:mT,keys:vT}=Object;function oY(e,t){return e.byteLength===t.byteLength&&Wf(new Uint8Array(e),new Uint8Array(t))}function sY(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function uY(e,t){return e.byteLength===t.byteLength&&Wf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function cY(e,t){return Li(e.getTime(),t.getTime())}function fY(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function dY(e,t){return e===t}function yT(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const l=new Array(r),o=e.entries();let c,d,h=0;for(;(c=o.next())&&!c.done;){const p=t.entries();let v=!1,m=0;for(;(d=p.next())&&!d.done;){if(l[m]){m++;continue}const g=c.value,j=d.value;if(n.equals(g[0],j[0],h,m,e,t,n)&&n.equals(g[1],j[1],g[0],j[0],e,t,n)){v=l[m]=!0;break}m++}if(!v)return!1;h++}return!0}const hY=Li;function pY(e,t,n){const r=vT(e);let l=r.length;if(vT(t).length!==l)return!1;for(;l-- >0;)if(!xR(e,t,n,r[l]))return!1;return!0}function ws(e,t,n){const r=pT(e);let l=r.length;if(pT(t).length!==l)return!1;let o,c,d;for(;l-- >0;)if(o=r[l],!xR(e,t,n,o)||(c=mT(e,o),d=mT(t,o),(c||d)&&(!c||!d||c.configurable!==d.configurable||c.enumerable!==d.enumerable||c.writable!==d.writable)))return!1;return!0}function mY(e,t){return Li(e.valueOf(),t.valueOf())}function vY(e,t){return e.source===t.source&&e.flags===t.flags}function gT(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const l=new Array(r),o=e.values();let c,d;for(;(c=o.next())&&!c.done;){const h=t.values();let p=!1,v=0;for(;(d=h.next())&&!d.done;){if(!l[v]&&n.equals(c.value,d.value,c.value,d.value,e,t,n)){p=l[v]=!0;break}v++}if(!p)return!1}return!0}function Wf(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function yY(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function xR(e,t,n,r){return(r===lY||r===iY||r===aY)&&(e.$$typeof||t.$$typeof)?!0:rY(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const gY="[object ArrayBuffer]",bY="[object Arguments]",xY="[object Boolean]",jY="[object DataView]",_Y="[object Date]",SY="[object Error]",wY="[object Map]",OY="[object Number]",AY="[object Object]",NY="[object RegExp]",EY="[object Set]",TY="[object String]",CY={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},MY="[object URL]",kY=Object.prototype.toString;function RY({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:l,areFunctionsEqual:o,areMapsEqual:c,areNumbersEqual:d,areObjectsEqual:h,arePrimitiveWrappersEqual:p,areRegExpsEqual:v,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:j,unknownTagComparators:S}){return function(x,O,w){if(x===O)return!0;if(x==null||O==null)return!1;const E=typeof x;if(E!==typeof O)return!1;if(E!=="object")return E==="number"?d(x,O,w):E==="function"?o(x,O,w):!1;const M=x.constructor;if(M!==O.constructor)return!1;if(M===Object)return h(x,O,w);if(Array.isArray(x))return t(x,O,w);if(M===Date)return r(x,O,w);if(M===RegExp)return v(x,O,w);if(M===Map)return c(x,O,w);if(M===Set)return m(x,O,w);const A=kY.call(x);if(A===_Y)return r(x,O,w);if(A===NY)return v(x,O,w);if(A===wY)return c(x,O,w);if(A===EY)return m(x,O,w);if(A===AY)return typeof x.then!="function"&&typeof O.then!="function"&&h(x,O,w);if(A===MY)return j(x,O,w);if(A===SY)return l(x,O,w);if(A===bY)return h(x,O,w);if(CY[A])return g(x,O,w);if(A===gY)return e(x,O,w);if(A===jY)return n(x,O,w);if(A===xY||A===OY||A===TY)return p(x,O,w);if(S){let C=S[A];if(!C){const k=nY(x);k&&(C=S[k])}if(C)return C(x,O,w)}return!1}}function PY({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:oY,areArraysEqual:n?ws:sY,areDataViewsEqual:uY,areDatesEqual:cY,areErrorsEqual:fY,areFunctionsEqual:dY,areMapsEqual:n?cb(yT,ws):yT,areNumbersEqual:hY,areObjectsEqual:n?ws:pY,arePrimitiveWrappersEqual:mY,areRegExpsEqual:vY,areSetsEqual:n?cb(gT,ws):gT,areTypedArraysEqual:n?cb(Wf,ws):Wf,areUrlsEqual:yY,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const l=ff(r.areArraysEqual),o=ff(r.areMapsEqual),c=ff(r.areObjectsEqual),d=ff(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:l,areMapsEqual:o,areObjectsEqual:c,areSetsEqual:d})}return r}function DY(e){return function(t,n,r,l,o,c,d){return e(t,n,d)}}function $Y({circular:e,comparator:t,createState:n,equals:r,strict:l}){if(n)return function(d,h){const{cache:p=e?new WeakMap:void 0,meta:v}=n();return t(d,h,{cache:p,equals:r,meta:v,strict:l})};if(e)return function(d,h){return t(d,h,{cache:new WeakMap,equals:r,meta:void 0,strict:l})};const o={cache:void 0,equals:r,meta:void 0,strict:l};return function(d,h){return t(d,h,o)}}const qY=Xa();Xa({strict:!0});Xa({circular:!0});Xa({circular:!0,strict:!0});Xa({createInternalComparator:()=>Li});Xa({strict:!0,createInternalComparator:()=>Li});Xa({circular:!0,createInternalComparator:()=>Li});Xa({circular:!0,createInternalComparator:()=>Li,strict:!0});function Xa(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:l=!1}=e,o=PY(e),c=RY(o),d=n?n(c):DY(c);return $Y({circular:t,comparator:c,createState:r,equals:d,strict:l})}function zY(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function bT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function l(o){n<0&&(n=o),o-n>t?(e(o),n=-1):zY(l)};requestAnimationFrame(r)}function Dx(e){"@babel/helpers - typeof";return Dx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dx(e)}function LY(e){return HY(e)||IY(e)||UY(e)||BY()}function BY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UY(e,t){if(e){if(typeof e=="string")return xT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xT(e,t)}}function xT(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:O<0?0:O},_=function(O){for(var w=O>1?1:O,E=w,M=0;M<8;++M){var A=m(E)-w,C=j(E);if(Math.abs(A-w)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,l=t.damping,o=l===void 0?8:l,c=t.dt,d=c===void 0?17:c,h=function(v,m,g){var j=-(v-m)*r,S=g*o,_=g+(j-S)*d/1e3,x=g*d/1e3+v;return Math.abs(x-m)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xV(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o=0)&&(n[l]=e[l]);return n}function fb(e){return wV(e)||SV(e)||_V(e)||jV()}function jV(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _V(e,t){if(e){if(typeof e=="string")return Bx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bx(e,t)}}function SV(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wV(e){if(Array.isArray(e))return Bx(e)}function Bx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ed(e){return ed=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ed(e)}var la=(function(e){TV(n,e);var t=CV(n);function n(r,l){var o;OV(this,n),o=t.call(this,r,l);var c=o.props,d=c.isActive,h=c.attributeName,p=c.from,v=c.to,m=c.steps,g=c.children,j=c.duration;if(o.handleStyleChange=o.handleStyleChange.bind(Hx(o)),o.changeStyle=o.changeStyle.bind(Hx(o)),!d||j<=0)return o.state={style:{}},typeof g=="function"&&(o.state={style:v}),Ix(o);if(m&&m.length)o.state={style:m[0].style};else if(p){if(typeof g=="function")return o.state={style:p},Ix(o);o.state={style:h?Ts({},h,p):p}}else o.state={style:{}};return o}return NV(n,[{key:"componentDidMount",value:function(){var l=this.props,o=l.isActive,c=l.canBegin;this.mounted=!0,!(!o||!c)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(l){var o=this.props,c=o.isActive,d=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,v=o.to,m=o.from,g=this.state.style;if(d){if(!c){var j={style:h?Ts({},h,v):v};this.state&&g&&(h&&g[h]!==v||!h&&g!==v)&&this.setState(j);return}if(!(qY(l.to,v)&&l.canBegin&&l.isActive)){var S=!l.canBegin||!l.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var _=S||p?m:l.to;if(this.state&&g){var x={style:h?Ts({},h,_):_};(h&&g[h]!==_||!h&&g!==_)&&this.setState(x)}this.runAnimation(ur(ur({},this.props),{},{from:_,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var l=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),l&&l()}},{key:"handleStyleChange",value:function(l){this.changeStyle(l)}},{key:"changeStyle",value:function(l){this.mounted&&this.setState({style:l})}},{key:"runJSAnimation",value:function(l){var o=this,c=l.from,d=l.to,h=l.duration,p=l.easing,v=l.begin,m=l.onAnimationEnd,g=l.onAnimationStart,j=yV(c,d,lV(p),h,this.changeStyle),S=function(){o.stopJSAnimation=j()};this.manager.start([g,v,S,h,m])}},{key:"runStepAnimation",value:function(l){var o=this,c=l.steps,d=l.begin,h=l.onAnimationStart,p=c[0],v=p.style,m=p.duration,g=m===void 0?0:m,j=function(_,x,O){if(O===0)return _;var w=x.duration,E=x.easing,M=E===void 0?"ease":E,A=x.style,C=x.properties,k=x.onAnimationEnd,z=O>0?c[O-1]:x,B=C||Object.keys(A);if(typeof M=="function"||M==="spring")return[].concat(fb(_),[o.runJSAnimation.bind(o,{from:z.style,to:A,duration:w,easing:M}),w]);var Z=ST(B,w,M),G=ur(ur(ur({},z.style),A),{},{transition:Z});return[].concat(fb(_),[G,w,k]).filter(KY)};return this.manager.start([h].concat(fb(c.reduce(j,[v,Math.max(g,d)])),[l.onAnimationEnd]))}},{key:"runAnimation",value:function(l){this.manager||(this.manager=GY());var o=l.begin,c=l.duration,d=l.attributeName,h=l.to,p=l.easing,v=l.onAnimationStart,m=l.onAnimationEnd,g=l.steps,j=l.children,S=this.manager;if(this.unSubscribe=S.subscribe(this.handleStyleChange),typeof p=="function"||typeof j=="function"||p==="spring"){this.runJSAnimation(l);return}if(g.length>1){this.runStepAnimation(l);return}var _=d?Ts({},d,h):h,x=ST(Object.keys(_),c,p);S.start([v,o,ur(ur({},_),{},{transition:x}),c,m])}},{key:"render",value:function(){var l=this.props,o=l.children;l.begin;var c=l.duration;l.attributeName,l.easing;var d=l.isActive;l.steps,l.from,l.to,l.canBegin,l.onAnimationEnd,l.shouldReAnimate,l.onAnimationReStart;var h=bV(l,gV),p=T.Children.count(o),v=this.state.style;if(typeof o=="function")return o(v);if(!d||p===0||c<=0)return o;var m=function(j){var S=j.props,_=S.style,x=_===void 0?{}:_,O=S.className,w=T.cloneElement(j,ur(ur({},h),{},{style:ur(ur({},x),v),className:O}));return w};return p===1?m(T.Children.only(o)):Y.createElement("div",null,T.Children.map(o,function(g){return m(g)}))}}]),n})(T.PureComponent);la.displayName="Animate";la.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};la.propTypes={from:Qe.oneOfType([Qe.object,Qe.string]),to:Qe.oneOfType([Qe.object,Qe.string]),attributeName:Qe.string,duration:Qe.number,begin:Qe.number,easing:Qe.oneOfType([Qe.string,Qe.func]),steps:Qe.arrayOf(Qe.shape({duration:Qe.number.isRequired,style:Qe.object.isRequired,easing:Qe.oneOfType([Qe.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Qe.func]),properties:Qe.arrayOf("string"),onAnimationEnd:Qe.func})),children:Qe.oneOfType([Qe.node,Qe.func]),isActive:Qe.bool,canBegin:Qe.bool,onAnimationEnd:Qe.func,shouldReAnimate:Qe.bool,onAnimationStart:Qe.func,onAnimationReStart:Qe.func};function uu(e){"@babel/helpers - typeof";return uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uu(e)}function td(){return td=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,h=r>=0?1:-1,p=l>=0&&r>=0||l<0&&r<0?1:0,v;if(c>0&&o instanceof Array){for(var m=[0,0,0,0],g=0,j=4;gc?c:o[g];v="M".concat(t,",").concat(n+d*m[0]),m[0]>0&&(v+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(p,",").concat(t+h*m[0],",").concat(n)),v+="L ".concat(t+r-h*m[1],",").concat(n),m[1]>0&&(v+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(p,`,
+ `).concat(t+r,",").concat(n+d*m[1])),v+="L ".concat(t+r,",").concat(n+l-d*m[2]),m[2]>0&&(v+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(p,`,
+ `).concat(t+r-h*m[2],",").concat(n+l)),v+="L ".concat(t+h*m[3],",").concat(n+l),m[3]>0&&(v+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(p,`,
+ `).concat(t,",").concat(n+l-d*m[3])),v+="Z"}else if(c>0&&o===+o&&o>0){var S=Math.min(c,o);v="M ".concat(t,",").concat(n+d*S,`
+ A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+h*S,",").concat(n,`
+ L `).concat(t+r-h*S,",").concat(n,`
+ A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+r,",").concat(n+d*S,`
+ L `).concat(t+r,",").concat(n+l-d*S,`
+ A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+r-h*S,",").concat(n+l,`
+ L `).concat(t+h*S,",").concat(n+l,`
+ A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t,",").concat(n+l-d*S," Z")}else v="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(l," h ").concat(-r," Z");return v},BV=function(t,n){if(!t||!n)return!1;var r=t.x,l=t.y,o=n.x,c=n.y,d=n.width,h=n.height;if(Math.abs(d)>0&&Math.abs(h)>0){var p=Math.min(o,o+d),v=Math.max(o,o+d),m=Math.min(c,c+h),g=Math.max(c,c+h);return r>=p&&r<=v&&l>=m&&l<=g}return!1},UV={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},O1=function(t){var n=MT(MT({},UV),t),r=T.useRef(),l=T.useState(-1),o=kV(l,2),c=o[0],d=o[1];T.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var M=r.current.getTotalLength();M&&d(M)}catch{}},[]);var h=n.x,p=n.y,v=n.width,m=n.height,g=n.radius,j=n.className,S=n.animationEasing,_=n.animationDuration,x=n.animationBegin,O=n.isAnimationActive,w=n.isUpdateAnimationActive;if(h!==+h||p!==+p||v!==+v||m!==+m||v===0||m===0)return null;var E=qe("recharts-rectangle",j);return w?Y.createElement(la,{canBegin:c>0,from:{width:v,height:m,x:h,y:p},to:{width:v,height:m,x:h,y:p},duration:_,animationEasing:S,isActive:w},function(M){var A=M.width,C=M.height,k=M.x,z=M.y;return Y.createElement(la,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:_,isActive:O,easing:S},Y.createElement("path",td({},Ce(n,!0),{className:E,d:kT(k,z,A,C,g),ref:r})))}):Y.createElement("path",td({},Ce(n,!0),{className:E,d:kT(h,p,v,m,g)}))},IV=["points","className","baseLinePoints","connectNulls"];function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function GV(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function RT(e){return KV(e)||FV(e)||VV(e)||YV()}function YV(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VV(e,t){if(e){if(typeof e=="string")return Gx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gx(e,t)}}function FV(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KV(e){if(Array.isArray(e))return Gx(e)}function Gx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){PT(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),PT(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Ds=function(t,n){var r=XV(t);n&&(r=[r.reduce(function(o,c){return[].concat(RT(o),RT(c))},[])]);var l=r.map(function(o){return o.reduce(function(c,d,h){return"".concat(c).concat(h===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return r.length===1?"".concat(l,"Z"):l},ZV=function(t,n,r){var l=Ds(t,r);return"".concat(l.slice(-1)==="Z"?l.slice(0,-1):l,"L").concat(Ds(n.reverse(),r).slice(1))},WV=function(t){var n=t.points,r=t.className,l=t.baseLinePoints,o=t.connectNulls,c=HV(t,IV);if(!n||!n.length)return null;var d=qe("recharts-polygon",r);if(l&&l.length){var h=c.stroke&&c.stroke!=="none",p=ZV(n,l,o);return Y.createElement("g",{className:d},Y.createElement("path",Tl({},Ce(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:p})),h?Y.createElement("path",Tl({},Ce(c,!0),{fill:"none",d:Ds(n,o)})):null,h?Y.createElement("path",Tl({},Ce(c,!0),{fill:"none",d:Ds(l,o)})):null)}var v=Ds(n,o);return Y.createElement("path",Tl({},Ce(c,!0),{fill:v.slice(-1)==="Z"?c.fill:"none",className:d,d:v}))};function Yx(){return Yx=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var iF=function(t,n,r,l,o,c){return"M".concat(t,",").concat(o,"v").concat(l,"M").concat(c,",").concat(n,"h").concat(r)},lF=function(t){var n=t.x,r=n===void 0?0:n,l=t.y,o=l===void 0?0:l,c=t.top,d=c===void 0?0:c,h=t.left,p=h===void 0?0:h,v=t.width,m=v===void 0?0:v,g=t.height,j=g===void 0?0:g,S=t.className,_=rF(t,QV),x=JV({x:r,y:o,top:d,left:p,width:m,height:j},_);return!ve(r)||!ve(o)||!ve(m)||!ve(j)||!ve(d)||!ve(p)?null:Y.createElement("path",Vx({},Ce(x,!0),{className:qe("recharts-cross",S),d:iF(r,o,m,j,d,p)}))},db,$T;function oF(){if($T)return db;$T=1;var e=Xd(),t=Uk(),n=Er();function r(l,o){return l&&l.length?e(l,n(o,2),t):void 0}return db=r,db}var sF=oF();const uF=rt(sF);var hb,qT;function cF(){if(qT)return hb;qT=1;var e=Xd(),t=Er(),n=Ik();function r(l,o){return l&&l.length?e(l,t(o,2),n):void 0}return hb=r,hb}var fF=cF();const dF=rt(fF);var hF=["cx","cy","angle","ticks","axisLine"],pF=["ticks","tick","angle","tickFormatter","stroke"];function Fl(e){"@babel/helpers - typeof";return Fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fl(e)}function $s(){return $s=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function vF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BT(e,t){for(var n=0;nHT?c=l==="outer"?"start":"end":o<-HT?c=l==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var r=this.props,l=r.cx,o=r.cy,c=r.radius,d=r.axisLine,h=r.axisLineType,p=vi(vi({},Ce(this.props,!1)),{},{fill:"none"},Ce(d,!1));if(h==="circle")return Y.createElement(A1,xi({className:"recharts-polar-angle-axis-line"},p,{cx:l,cy:o,r:c}));var v=this.props.ticks,m=v.map(function(g){return mt(l,o,c,g.coordinate)});return Y.createElement(WV,xi({className:"recharts-polar-angle-axis-line"},p,{points:m}))}},{key:"renderTicks",value:function(){var r=this,l=this.props,o=l.ticks,c=l.tick,d=l.tickLine,h=l.tickFormatter,p=l.stroke,v=Ce(this.props,!1),m=Ce(c,!1),g=vi(vi({},v),{},{fill:"none"},Ce(d,!1)),j=o.map(function(S,_){var x=r.getTickLineCoord(S),O=r.getTickTextAnchor(S),w=vi(vi(vi({textAnchor:O},v),{},{stroke:"none",fill:p},m),{},{index:_,payload:S,x:x.x2,y:x.y2});return Y.createElement(tt,xi({className:qe("recharts-polar-angle-axis-tick",vR(c)),key:"tick-".concat(S.coordinate)},Ti(r.props,S,_)),d&&Y.createElement("line",xi({className:"recharts-polar-angle-axis-tick-line"},g,x)),c&&t.renderTickItem(c,w,h?h(S.value,_):S.value))});return Y.createElement(tt,{className:"recharts-polar-angle-axis-ticks"},j)}},{key:"render",value:function(){var r=this.props,l=r.ticks,o=r.radius,c=r.axisLine;return o<=0||!l||!l.length?null:Y.createElement(tt,{className:qe("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,l,o){var c;return Y.isValidElement(r)?c=Y.cloneElement(r,l):ke(r)?c=r(l):c=Y.createElement(Ci,xi({},l,{className:"recharts-polar-angle-axis-tick-value"}),o),c}}])})(T.PureComponent);ah(ih,"displayName","PolarAngleAxis");ah(ih,"axisType","angleAxis");ah(ih,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var pb,GT;function MF(){if(GT)return pb;GT=1;var e=U3(),t=e(Object.getPrototypeOf,Object);return pb=t,pb}var mb,YT;function kF(){if(YT)return mb;YT=1;var e=oa(),t=MF(),n=sa(),r="[object Object]",l=Function.prototype,o=Object.prototype,c=l.toString,d=o.hasOwnProperty,h=c.call(Object);function p(v){if(!n(v)||e(v)!=r)return!1;var m=t(v);if(m===null)return!0;var g=d.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&c.call(g)==h}return mb=p,mb}var RF=kF();const PF=rt(RF);var vb,VT;function DF(){if(VT)return vb;VT=1;var e=oa(),t=sa(),n="[object Boolean]";function r(l){return l===!0||l===!1||t(l)&&e(l)==n}return vb=r,vb}var $F=DF();const qF=rt($F);function fu(e){"@babel/helpers - typeof";return fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fu(e)}function ad(){return ad=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:g,x:h,y:p},to:{upperWidth:v,lowerWidth:m,height:g,x:h,y:p},duration:_,animationEasing:S,isActive:O},function(E){var M=E.upperWidth,A=E.lowerWidth,C=E.height,k=E.x,z=E.y;return Y.createElement(la,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:_,easing:S},Y.createElement("path",ad({},Ce(n,!0),{className:w,d:ZT(k,z,M,A,C),ref:r})))}):Y.createElement("g",null,Y.createElement("path",ad({},Ce(n,!0),{className:w,d:ZT(h,p,v,m,g)})))},KF=["option","shapeType","propTransformer","activeClassName","isActive"];function du(e){"@babel/helpers - typeof";return du=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},du(e)}function XF(e,t){if(e==null)return{};var n=ZF(e,t),r,l;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ZF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function WT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function id(e){for(var t=1;t0?qn(E,"paddingAngle",0):0;if(A){var k=qa(A.endAngle-A.startAngle,E.endAngle-E.startAngle),z=ht(ht({},E),{},{startAngle:w+C,endAngle:w+k(_)+C});x.push(z),w=z.endAngle}else{var B=E.endAngle,Z=E.startAngle,G=qa(0,B-Z),H=G(_),W=ht(ht({},E),{},{startAngle:w+C,endAngle:w+H+C});x.push(W),w=W.endAngle}}),Y.createElement(tt,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var l=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var c=++l.state.sectorToFocus%l.sectorRefs.length;l.sectorRefs[c].focus(),l.setState({sectorToFocus:c});break}case"ArrowRight":{var d=--l.state.sectorToFocus<0?l.sectorRefs.length-1:l.state.sectorToFocus%l.sectorRefs.length;l.sectorRefs[d].focus(),l.setState({sectorToFocus:d});break}case"Escape":{l.sectorRefs[l.state.sectorToFocus].blur(),l.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,l=r.sectors,o=r.isAnimationActive,c=this.state.prevSectors;return o&&l&&l.length&&(!c||!Qd(c,l))?this.renderSectorsWithAnimation():this.renderSectorsStatically(l)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,l=this.props,o=l.hide,c=l.sectors,d=l.className,h=l.label,p=l.cx,v=l.cy,m=l.innerRadius,g=l.outerRadius,j=l.isAnimationActive,S=this.state.isAnimationFinished;if(o||!c||!c.length||!ve(p)||!ve(v)||!ve(m)||!ve(g))return null;var _=qe("recharts-pie",d);return Y.createElement(tt,{tabIndex:this.props.rootTabIndex,className:_,ref:function(O){r.pieRef=O}},this.renderSectors(),h&&this.renderLabels(c),Ft.renderCallByParent(this.props,null,!1),(!j||S)&&Ha.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,l){return l.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==l.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:l.curSectors,isAnimationFinished:!0}:r.sectors!==l.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,l){return r>l?"start":r=360?w:w-1)*h,M=x-w*j-E,A=l.reduce(function(z,B){var Z=sn(B,O,0);return z+(ve(Z)?Z:0)},0),C;if(A>0){var k;C=l.map(function(z,B){var Z=sn(z,O,0),G=sn(z,v,B),H=(ve(Z)?Z:0)/A,W;B?W=k.endAngle+cn(_)*h*(Z!==0?1:0):W=c;var Q=W+cn(_)*((Z!==0?j:0)+H*M),D=(W+Q)/2,P=(S.innerRadius+S.outerRadius)/2,$=[{name:G,value:Z,payload:z,dataKey:O,type:g}],U=mt(S.cx,S.cy,P,D);return k=ht(ht(ht({percent:H,cornerRadius:o,name:G,tooltipPayload:$,midAngle:D,middleRadius:P,tooltipPosition:U},z),S),{},{value:sn(z,O),startAngle:W,endAngle:Q,payload:z,paddingAngle:cn(_)*h}),k})}return ht(ht({},S),{},{sectors:C,data:l})});var yb,tC;function yK(){if(tC)return yb;tC=1;var e=Math.ceil,t=Math.max;function n(r,l,o,c){for(var d=-1,h=t(e((l-r)/(o||1)),0),p=Array(h);h--;)p[c?h:++d]=r,r+=o;return p}return yb=n,yb}var gb,nC;function PR(){if(nC)return gb;nC=1;var e=rk(),t=1/0,n=17976931348623157e292;function r(l){if(!l)return l===0?l:0;if(l=e(l),l===t||l===-t){var o=l<0?-1:1;return o*n}return l===l?l:0}return gb=r,gb}var bb,rC;function gK(){if(rC)return bb;rC=1;var e=yK(),t=Ud(),n=PR();function r(l){return function(o,c,d){return d&&typeof d!="number"&&t(o,c,d)&&(c=d=void 0),o=n(o),c===void 0?(c=o,o=0):c=n(c),d=d===void 0?o0&&r.handleDrag(l.changedTouches[0])}),Pn(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var l=r.props,o=l.endIndex,c=l.onDragEnd,d=l.startIndex;c==null||c({endIndex:o,startIndex:d})}),r.detachDragEndListener()}),Pn(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Pn(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Pn(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Pn(r,"handleSlideDragStart",function(l){var o=uC(l)?l.changedTouches[0]:l;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return CK(t,e),AK(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var l=r.startX,o=r.endX,c=this.state.scaleValues,d=this.props,h=d.gap,p=d.data,v=p.length-1,m=Math.min(l,o),g=Math.max(l,o),j=t.getIndexInRange(c,m),S=t.getIndexInRange(c,g);return{startIndex:j-j%h,endIndex:S===v?v:S-S%h}}},{key:"getTextOfTick",value:function(r){var l=this.props,o=l.data,c=l.tickFormatter,d=l.dataKey,h=sn(o[r],d,r);return ke(c)?c(h,r):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var l=this.state,o=l.slideMoveStartX,c=l.startX,d=l.endX,h=this.props,p=h.x,v=h.width,m=h.travellerWidth,g=h.startIndex,j=h.endIndex,S=h.onChange,_=r.pageX-o;_>0?_=Math.min(_,p+v-m-d,p+v-m-c):_<0&&(_=Math.max(_,p-c,p-d));var x=this.getIndex({startX:c+_,endX:d+_});(x.startIndex!==g||x.endIndex!==j)&&S&&S(x),this.setState({startX:c+_,endX:d+_,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,l){var o=uC(l)?l.changedTouches[0]:l;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var l=this.state,o=l.brushMoveStartX,c=l.movingTravellerId,d=l.endX,h=l.startX,p=this.state[c],v=this.props,m=v.x,g=v.width,j=v.travellerWidth,S=v.onChange,_=v.gap,x=v.data,O={startX:this.state.startX,endX:this.state.endX},w=r.pageX-o;w>0?w=Math.min(w,m+g-j-p):w<0&&(w=Math.max(w,m-p)),O[c]=p+w;var E=this.getIndex(O),M=E.startIndex,A=E.endIndex,C=function(){var z=x.length-1;return c==="startX"&&(d>h?M%_===0:A%_===0)||dh?A%_===0:M%_===0)||d>h&&A===z};this.setState(Pn(Pn({},c,p+w),"brushMoveStartX",r.pageX),function(){S&&C()&&S(E)})}},{key:"handleTravellerMoveKeyboard",value:function(r,l){var o=this,c=this.state,d=c.scaleValues,h=c.startX,p=c.endX,v=this.state[l],m=d.indexOf(v);if(m!==-1){var g=m+r;if(!(g===-1||g>=d.length)){var j=d[g];l==="startX"&&j>=p||l==="endX"&&j<=h||this.setState(Pn({},l,j),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,l=r.x,o=r.y,c=r.width,d=r.height,h=r.fill,p=r.stroke;return Y.createElement("rect",{stroke:p,fill:h,x:l,y:o,width:c,height:d})}},{key:"renderPanorama",value:function(){var r=this.props,l=r.x,o=r.y,c=r.width,d=r.height,h=r.data,p=r.children,v=r.padding,m=T.Children.only(p);return m?Y.cloneElement(m,{x:l,y:o,width:c,height:d,margin:v,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(r,l){var o,c,d=this,h=this.props,p=h.y,v=h.travellerWidth,m=h.height,g=h.traveller,j=h.ariaLabel,S=h.data,_=h.startIndex,x=h.endIndex,O=Math.max(r,this.props.x),w=jb(jb({},Ce(this.props,!1)),{},{x:O,y:p,width:v,height:m}),E=j||"Min value: ".concat((o=S[_])===null||o===void 0?void 0:o.name,", Max value: ").concat((c=S[x])===null||c===void 0?void 0:c.name);return Y.createElement(tt,{tabIndex:0,role:"slider","aria-label":E,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[l],onTouchStart:this.travellerDragStartHandlers[l],onKeyDown:function(A){["ArrowLeft","ArrowRight"].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),d.handleTravellerMoveKeyboard(A.key==="ArrowRight"?1:-1,l))},onFocus:function(){d.setState({isTravellerFocused:!0})},onBlur:function(){d.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(g,w))}},{key:"renderSlide",value:function(r,l){var o=this.props,c=o.y,d=o.height,h=o.stroke,p=o.travellerWidth,v=Math.min(r,l)+p,m=Math.max(Math.abs(l-r)-p,0);return Y.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x:v,y:c,width:m,height:d})}},{key:"renderText",value:function(){var r=this.props,l=r.startIndex,o=r.endIndex,c=r.y,d=r.height,h=r.travellerWidth,p=r.stroke,v=this.state,m=v.startX,g=v.endX,j=5,S={pointerEvents:"none",fill:p};return Y.createElement(tt,{className:"recharts-brush-texts"},Y.createElement(Ci,sd({textAnchor:"end",verticalAnchor:"middle",x:Math.min(m,g)-j,y:c+d/2},S),this.getTextOfTick(l)),Y.createElement(Ci,sd({textAnchor:"start",verticalAnchor:"middle",x:Math.max(m,g)+h+j,y:c+d/2},S),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,l=r.data,o=r.className,c=r.children,d=r.x,h=r.y,p=r.width,v=r.height,m=r.alwaysShowText,g=this.state,j=g.startX,S=g.endX,_=g.isTextActive,x=g.isSlideMoving,O=g.isTravellerMoving,w=g.isTravellerFocused;if(!l||!l.length||!ve(d)||!ve(h)||!ve(p)||!ve(v)||p<=0||v<=0)return null;var E=qe("recharts-brush",o),M=Y.Children.count(c)===1,A=wK("userSelect","none");return Y.createElement(tt,{className:E,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:A},this.renderBackground(),M&&this.renderPanorama(),this.renderSlide(j,S),this.renderTravellerLayer(j,"startX"),this.renderTravellerLayer(S,"endX"),(_||x||O||w||m)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var l=r.x,o=r.y,c=r.width,d=r.height,h=r.stroke,p=Math.floor(o+d/2)-1;return Y.createElement(Y.Fragment,null,Y.createElement("rect",{x:l,y:o,width:c,height:d,fill:h,stroke:"none"}),Y.createElement("line",{x1:l+1,y1:p,x2:l+c-1,y2:p,fill:"none",stroke:"#fff"}),Y.createElement("line",{x1:l+1,y1:p+2,x2:l+c-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,l){var o;return Y.isValidElement(r)?o=Y.cloneElement(r,l):ke(r)?o=r(l):o=t.renderDefaultTraveller(l),o}},{key:"getDerivedStateFromProps",value:function(r,l){var o=r.data,c=r.width,d=r.x,h=r.travellerWidth,p=r.updateId,v=r.startIndex,m=r.endIndex;if(o!==l.prevData||p!==l.prevUpdateId)return jb({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:d,prevWidth:c},o&&o.length?kK({data:o,width:c,x:d,travellerWidth:h,startIndex:v,endIndex:m}):{scale:null,scaleValues:null});if(l.scale&&(c!==l.prevWidth||d!==l.prevX||h!==l.prevTravellerWidth)){l.scale.range([d,d+c-h]);var g=l.scale.domain().map(function(j){return l.scale(j)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:d,prevWidth:c,startX:l.scale(r.startIndex),endX:l.scale(r.endIndex),scaleValues:g}}return null}},{key:"getIndexInRange",value:function(r,l){for(var o=r.length,c=0,d=o-1;d-c>1;){var h=Math.floor((c+d)/2);r[h]>l?d=h:c=h}return l>=r[d]?d:c}}])})(T.PureComponent);Pn(Wl,"displayName","Brush");Pn(Wl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var _b,cC;function RK(){if(cC)return _b;cC=1;var e=W0();function t(n,r){var l;return e(n,function(o,c,d){return l=r(o,c,d),!l}),!!l}return _b=t,_b}var Sb,fC;function PK(){if(fC)return Sb;fC=1;var e=P3(),t=Er(),n=RK(),r=wn(),l=Ud();function o(c,d,h){var p=r(c)?e:n;return h&&l(c,d,h)&&(d=void 0),p(c,t(d,3))}return Sb=o,Sb}var DK=PK();const $K=rt(DK);var wr=function(t,n){var r=t.alwaysShow,l=t.ifOverflow;return r&&(l="extendDomain"),l===n},wb,dC;function qK(){if(dC)return wb;dC=1;var e=Q3();function t(n,r,l){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:l,writable:!0}):n[r]=l}return wb=t,wb}var Ob,hC;function zK(){if(hC)return Ob;hC=1;var e=qK(),t=Z3(),n=Er();function r(l,o){var c={};return o=n(o,3),t(l,function(d,h,p){e(c,h,o(d,h,p))}),c}return Ob=r,Ob}var LK=zK();const BK=rt(LK);var Ab,pC;function UK(){if(pC)return Ab;pC=1;function e(t,n){for(var r=-1,l=t==null?0:t.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ZK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function WK(e,t){var n=e.x,r=e.y,l=XK(e,YK),o="".concat(n),c=parseInt(o,10),d="".concat(r),h=parseInt(d,10),p="".concat(t.height||l.height),v=parseInt(p,10),m="".concat(t.width||l.width),g=parseInt(m,10);return Os(Os(Os(Os(Os({},t),l),c?{x:c}:{}),h?{y:h}:{}),{},{height:v,width:g,name:t.name,radius:t.radius})}function gC(e){return Y.createElement(MR,Wx({shapeType:"rectangle",propTransformer:WK,activeClassName:"recharts-active-bar"},e))}var QK=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,l){if(typeof t=="number")return t;var o=ve(r)||bq(r);return o?t(r,l):(o||ki(),n)}},JK=["value","background"],LR;function Ql(e){"@babel/helpers - typeof";return Ql=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ql(e)}function eX(e,t){if(e==null)return{};var n=tX(e,t),r,l;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tX(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cd(){return cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(D)0&&Math.abs(Q)0&&(W=Math.min((de||0)-(Q[ge-1]||0),W))}),Number.isFinite(W)){var D=W/H,P=_.layout==="vertical"?r.height:r.width;if(_.padding==="gap"&&(k=D*P/2),_.padding==="no-gap"){var $=fn(t.barCategoryGap,D*P),U=D*P/2;k=U-$-(U-$)/P*$}}}l==="xAxis"?z=[r.left+(E.left||0)+(k||0),r.left+r.width-(E.right||0)-(k||0)]:l==="yAxis"?z=h==="horizontal"?[r.top+r.height-(E.bottom||0),r.top+(E.top||0)]:[r.top+(E.top||0)+(k||0),r.top+r.height-(E.bottom||0)-(k||0)]:z=_.range,A&&(z=[z[1],z[0]]);var ie=uR(_,o,g),fe=ie.scale,L=ie.realScaleType;fe.domain(O).range(z),cR(fe);var F=fR(fe,cr(cr({},_),{},{realScaleType:L}));l==="xAxis"?(G=x==="top"&&!M||x==="bottom"&&M,B=r.left,Z=m[C]-G*_.height):l==="yAxis"&&(G=x==="left"&&!M||x==="right"&&M,B=m[C]-G*_.width,Z=r.top);var q=cr(cr(cr({},_),F),{},{realScaleType:L,x:B,y:Z,scale:fe,width:l==="xAxis"?r.width:_.width,height:l==="yAxis"?r.height:_.height});return q.bandSize=Kf(q,F),!_.hide&&l==="xAxis"?m[C]+=(G?-1:1)*q.height:_.hide||(m[C]+=(G?-1:1)*q.width),cr(cr({},j),{},sh({},S,q))},{})},HR=function(t,n){var r=t.x,l=t.y,o=n.x,c=n.y;return{x:Math.min(r,o),y:Math.min(l,c),width:Math.abs(o-r),height:Math.abs(c-l)}},hX=function(t){var n=t.x1,r=t.y1,l=t.x2,o=t.y2;return HR({x:n,y:r},{x:l,y:o})},GR=(function(){function e(t){uX(this,e),this.scale=t}return cX(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}case"end":{var d=this.bandwidth?this.bandwidth():0;return this.scale(n)+d}default:return this.scale(n)}if(l){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),l=r[0],o=r[r.length-1];return l<=o?n>=l&&n<=o:n>=o&&n<=l}}],[{key:"create",value:function(n){return new e(n)}}])})();sh(GR,"EPS",1e-4);var N1=function(t){var n=Object.keys(t).reduce(function(r,l){return cr(cr({},r),{},sh({},l,GR.create(t[l])))},{});return cr(cr({},n),{},{apply:function(l){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=o.bandAware,d=o.position;return BK(l,function(h,p){return n[p].apply(h,{bandAware:c,position:d})})},isInRange:function(l){return zR(l,function(o,c){return n[c].isInRange(o)})}})};function pX(e){return(e%180+180)%180}var mX=function(t){var n=t.width,r=t.height,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=pX(l),c=o*Math.PI/180,d=Math.atan(r/n),h=c>d&&c-1?h[p?o[v]:v]:void 0}}return Tb=r,Tb}var Cb,wC;function yX(){if(wC)return Cb;wC=1;var e=PR();function t(n){var r=e(n),l=r%1;return r===r?l?r-l:r:0}return Cb=t,Cb}var Mb,OC;function gX(){if(OC)return Mb;OC=1;var e=Y3(),t=Er(),n=yX(),r=Math.max;function l(o,c,d){var h=o==null?0:o.length;if(!h)return-1;var p=d==null?0:n(d);return p<0&&(p=r(h+p,0)),e(o,t(c,3),p)}return Mb=l,Mb}var kb,AC;function bX(){if(AC)return kb;AC=1;var e=vX(),t=gX(),n=e(t);return kb=n,kb}var xX=bX();const jX=rt(xX);var _X=o3();const SX=rt(_X);var wX=SX(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),E1=T.createContext(void 0),T1=T.createContext(void 0),YR=T.createContext(void 0),VR=T.createContext({}),FR=T.createContext(void 0),KR=T.createContext(0),XR=T.createContext(0),NC=function(t){var n=t.state,r=n.xAxisMap,l=n.yAxisMap,o=n.offset,c=t.clipPathId,d=t.children,h=t.width,p=t.height,v=wX(o);return Y.createElement(E1.Provider,{value:r},Y.createElement(T1.Provider,{value:l},Y.createElement(VR.Provider,{value:o},Y.createElement(YR.Provider,{value:v},Y.createElement(FR.Provider,{value:c},Y.createElement(KR.Provider,{value:p},Y.createElement(XR.Provider,{value:h},d)))))))},OX=function(){return T.useContext(FR)},ZR=function(t){var n=T.useContext(E1);n==null&&ki();var r=n[t];return r==null&&ki(),r},AX=function(){var t=T.useContext(E1);return La(t)},NX=function(){var t=T.useContext(T1),n=jX(t,function(r){return zR(r.domain,Number.isFinite)});return n||La(t)},WR=function(t){var n=T.useContext(T1);n==null&&ki();var r=n[t];return r==null&&ki(),r},EX=function(){var t=T.useContext(YR);return t},TX=function(){return T.useContext(VR)},C1=function(){return T.useContext(XR)},M1=function(){return T.useContext(KR)};function Jl(e){"@babel/helpers - typeof";return Jl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jl(e)}function CX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MX(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*l)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-l)<=0}function dZ(e,t){return aP(e,t+1)}function hZ(e,t,n,r,l){for(var o=(r||[]).slice(),c=t.start,d=t.end,h=0,p=1,v=c,m=function(){var S=r==null?void 0:r[h];if(S===void 0)return{v:aP(r,p)};var _=h,x,O=function(){return x===void 0&&(x=n(S,_)),x},w=S.coordinate,E=h===0||md(e,w,O,v,d);E||(h=0,v=c,p+=1),E&&(v=w+e*(O()/2+l),h+=p)},g;p<=o.length;)if(g=m(),g)return g.v;return[]}function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function DC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function ln(e){for(var t=1;t0?j.coordinate-x*e:j.coordinate})}else o[g]=j=ln(ln({},j),{},{tickCoord:j.coordinate});var O=md(e,j.tickCoord,_,d,h);O&&(h=j.tickCoord-e*(_()/2+l),o[g]=ln(ln({},j),{},{isShow:!0}))},v=c-1;v>=0;v--)p(v);return o}function gZ(e,t,n,r,l,o){var c=(r||[]).slice(),d=c.length,h=t.start,p=t.end;if(o){var v=r[d-1],m=n(v,d-1),g=e*(v.coordinate+e*m/2-p);c[d-1]=v=ln(ln({},v),{},{tickCoord:g>0?v.coordinate-g*e:v.coordinate});var j=md(e,v.tickCoord,function(){return m},h,p);j&&(p=v.tickCoord-e*(m/2+l),c[d-1]=ln(ln({},v),{},{isShow:!0}))}for(var S=o?d-1:d,_=function(w){var E=c[w],M,A=function(){return M===void 0&&(M=n(E,w)),M};if(w===0){var C=e*(E.coordinate-e*A()/2-h);c[w]=E=ln(ln({},E),{},{tickCoord:C<0?E.coordinate-C*e:E.coordinate})}else c[w]=E=ln(ln({},E),{},{tickCoord:E.coordinate});var k=md(e,E.tickCoord,A,h,p);k&&(h=E.tickCoord+e*(A()/2+l),c[w]=ln(ln({},E),{},{isShow:!0}))},x=0;x=2?cn(l[1].coordinate-l[0].coordinate):1,O=fZ(o,x,j);return h==="equidistantPreserveStart"?hZ(x,O,_,l,c):(h==="preserveStart"||h==="preserveStartEnd"?g=gZ(x,O,_,l,c,h==="preserveStartEnd"):g=yZ(x,O,_,l,c),g.filter(function(w){return w.isShow}))}var bZ=["viewBox"],xZ=["viewBox"],jZ=["ticks"];function no(e){"@babel/helpers - typeof";return no=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},no(e)}function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _Z(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function SZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qC(e,t){for(var n=0;n0?h(this.props):h(j)),c<=0||d<=0||!S||!S.length?null:Y.createElement(tt,{className:qe("recharts-cartesian-axis",p),ref:function(x){r.layerReference=x}},o&&this.renderAxisLine(),this.renderTicks(S,this.state.fontSize,this.state.letterSpacing),Ft.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,l,o){var c,d=qe(l.className,"recharts-cartesian-axis-tick-value");return Y.isValidElement(r)?c=Y.cloneElement(r,Bt(Bt({},l),{},{className:d})):ke(r)?c=r(Bt(Bt({},l),{},{className:d})):c=Y.createElement(Ci,Ml({},l,{className:"recharts-cartesian-axis-tick-value"}),o),c}}])})(T.Component);D1(xo,"displayName","CartesianAxis");D1(xo,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var CZ=["x1","y1","x2","y2","key"],MZ=["offset"];function Ri(e){"@babel/helpers - typeof";return Ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ri(e)}function zC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function on(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function DZ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $Z=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,l=t.x,o=t.y,c=t.width,d=t.height,h=t.ry;return Y.createElement("rect",{x:l,y:o,ry:h,width:c,height:d,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function oP(e,t){var n;if(Y.isValidElement(e))n=Y.cloneElement(e,t);else if(ke(e))n=e(t);else{var r=t.x1,l=t.y1,o=t.x2,c=t.y2,d=t.key,h=LC(t,CZ),p=Ce(h,!1);p.offset;var v=LC(p,MZ);n=Y.createElement("line",wi({},v,{x1:r,y1:l,x2:o,y2:c,fill:"none",key:d}))}return n}function qZ(e){var t=e.x,n=e.width,r=e.horizontal,l=r===void 0?!0:r,o=e.horizontalPoints;if(!l||!o||!o.length)return null;var c=o.map(function(d,h){var p=on(on({},e),{},{x1:t,y1:d,x2:t+n,y2:d,key:"line-".concat(h),index:h});return oP(l,p)});return Y.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function zZ(e){var t=e.y,n=e.height,r=e.vertical,l=r===void 0?!0:r,o=e.verticalPoints;if(!l||!o||!o.length)return null;var c=o.map(function(d,h){var p=on(on({},e),{},{x1:d,y1:t,x2:d,y2:t+n,key:"line-".concat(h),index:h});return oP(l,p)});return Y.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function LZ(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,l=e.y,o=e.width,c=e.height,d=e.horizontalPoints,h=e.horizontal,p=h===void 0?!0:h;if(!p||!t||!t.length)return null;var v=d.map(function(g){return Math.round(g+l-l)}).sort(function(g,j){return g-j});l!==v[0]&&v.unshift(0);var m=v.map(function(g,j){var S=!v[j+1],_=S?l+c-g:v[j+1]-g;if(_<=0)return null;var x=j%t.length;return Y.createElement("rect",{key:"react-".concat(j),y:g,x:r,height:_,width:o,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return Y.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function BZ(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,l=e.fillOpacity,o=e.x,c=e.y,d=e.width,h=e.height,p=e.verticalPoints;if(!n||!r||!r.length)return null;var v=p.map(function(g){return Math.round(g+o-o)}).sort(function(g,j){return g-j});o!==v[0]&&v.unshift(0);var m=v.map(function(g,j){var S=!v[j+1],_=S?o+d-g:v[j+1]-g;if(_<=0)return null;var x=j%r.length;return Y.createElement("rect",{key:"react-".concat(j),x:g,y:c,width:_,height:h,stroke:"none",fill:r[x],fillOpacity:l,className:"recharts-cartesian-grid-bg"})});return Y.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var UZ=function(t,n){var r=t.xAxis,l=t.width,o=t.height,c=t.offset;return sR(P1(on(on(on({},xo.defaultProps),r),{},{ticks:Jr(r,!0),viewBox:{x:0,y:0,width:l,height:o}})),c.left,c.left+c.width,n)},IZ=function(t,n){var r=t.yAxis,l=t.width,o=t.height,c=t.offset;return sR(P1(on(on(on({},xo.defaultProps),r),{},{ticks:Jr(r,!0),viewBox:{x:0,y:0,width:l,height:o}})),c.top,c.top+c.height,n)},Al={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function gu(e){var t,n,r,l,o,c,d=C1(),h=M1(),p=TX(),v=on(on({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Al.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:Al.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:Al.horizontal,horizontalFill:(l=e.horizontalFill)!==null&&l!==void 0?l:Al.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:Al.vertical,verticalFill:(c=e.verticalFill)!==null&&c!==void 0?c:Al.verticalFill,x:ve(e.x)?e.x:p.left,y:ve(e.y)?e.y:p.top,width:ve(e.width)?e.width:p.width,height:ve(e.height)?e.height:p.height}),m=v.x,g=v.y,j=v.width,S=v.height,_=v.syncWithTicks,x=v.horizontalValues,O=v.verticalValues,w=AX(),E=NX();if(!ve(j)||j<=0||!ve(S)||S<=0||!ve(m)||m!==+m||!ve(g)||g!==+g)return null;var M=v.verticalCoordinatesGenerator||UZ,A=v.horizontalCoordinatesGenerator||IZ,C=v.horizontalPoints,k=v.verticalPoints;if((!C||!C.length)&&ke(A)){var z=x&&x.length,B=A({yAxis:E?on(on({},E),{},{ticks:z?x:E.ticks}):void 0,width:d,height:h,offset:p},z?!0:_);hr(Array.isArray(B),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ri(B),"]")),Array.isArray(B)&&(C=B)}if((!k||!k.length)&&ke(M)){var Z=O&&O.length,G=M({xAxis:w?on(on({},w),{},{ticks:Z?O:w.ticks}):void 0,width:d,height:h,offset:p},Z?!0:_);hr(Array.isArray(G),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ri(G),"]")),Array.isArray(G)&&(k=G)}return Y.createElement("g",{className:"recharts-cartesian-grid"},Y.createElement($Z,{fill:v.fill,fillOpacity:v.fillOpacity,x:v.x,y:v.y,width:v.width,height:v.height,ry:v.ry}),Y.createElement(qZ,wi({},v,{offset:p,horizontalPoints:C,xAxis:w,yAxis:E})),Y.createElement(zZ,wi({},v,{offset:p,verticalPoints:k,xAxis:w,yAxis:E})),Y.createElement(LZ,wi({},v,{horizontalPoints:C})),Y.createElement(BZ,wi({},v,{verticalPoints:k})))}gu.displayName="CartesianGrid";function ro(e){"@babel/helpers - typeof";return ro=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ro(e)}function HZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GZ(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function MW(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RW(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?c:t&&t.length&&ve(l)&&ve(o)?t.slice(l,o+1):[]};function xP(e){return e==="number"?[0,"auto"]:void 0}var p0=function(t,n,r,l){var o=t.graphicalItems,c=t.tooltipAxis,d=hh(n,t);return r<0||!o||!o.length||r>=d.length?null:o.reduce(function(h,p){var v,m=(v=p.props.data)!==null&&v!==void 0?v:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(c.dataKey&&!c.allowDuplicatedCategory){var j=m===void 0?d:m;g=Xb(j,c.dataKey,l)}else g=m&&m[r]||d[r];return g?[].concat(lo(h),[hR(p,g)]):h},[])},VC=function(t,n,r,l){var o=l||{x:t.chartX,y:t.chartY},c=YW(o,r),d=t.orderedTooltipTicks,h=t.tooltipAxis,p=t.tooltipTicks,v=NH(c,d,p,h);if(v>=0&&p){var m=p[v]&&p[v].value,g=p0(t,n,v,m),j=VW(r,d,v,o);return{activeTooltipIndex:v,activeLabel:m,activePayload:g,activeCoordinate:j}}return null},FW=function(t,n){var r=n.axes,l=n.graphicalItems,o=n.axisType,c=n.axisIdKey,d=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,v=t.layout,m=t.children,g=t.stackOffset,j=oR(v,o);return r.reduce(function(S,_){var x,O=_.type.defaultProps!==void 0?oe(oe({},_.type.defaultProps),_.props):_.props,w=O.type,E=O.dataKey,M=O.allowDataOverflow,A=O.allowDuplicatedCategory,C=O.scale,k=O.ticks,z=O.includeHidden,B=O[c];if(S[B])return S;var Z=hh(t.data,{graphicalItems:l.filter(function(F){var q,de=c in F.props?F.props[c]:(q=F.type.defaultProps)===null||q===void 0?void 0:q[c];return de===B}),dataStartIndex:h,dataEndIndex:p}),G=Z.length,H,W,Q;bW(O.domain,M,w)&&(H=Tx(O.domain,null,M),j&&(w==="number"||C!=="auto")&&(Q=Rs(Z,E,"category")));var D=xP(w);if(!H||H.length===0){var P,$=(P=O.domain)!==null&&P!==void 0?P:D;if(E){if(H=Rs(Z,E,w),w==="category"&&j){var U=jq(H);A&&U?(W=H,H=od(0,G)):A||(H=WE($,H,_).reduce(function(F,q){return F.indexOf(q)>=0?F:[].concat(lo(F),[q])},[]))}else if(w==="category")A?H=H.filter(function(F){return F!==""&&!ze(F)}):H=WE($,H,_).reduce(function(F,q){return F.indexOf(q)>=0||q===""||ze(q)?F:[].concat(lo(F),[q])},[]);else if(w==="number"){var ie=kH(Z,l.filter(function(F){var q,de,ge=c in F.props?F.props[c]:(q=F.type.defaultProps)===null||q===void 0?void 0:q[c],we="hide"in F.props?F.props.hide:(de=F.type.defaultProps)===null||de===void 0?void 0:de.hide;return ge===B&&(z||!we)}),E,o,v);ie&&(H=ie)}j&&(w==="number"||C!=="auto")&&(Q=Rs(Z,E,"category"))}else j?H=od(0,G):d&&d[B]&&d[B].hasStack&&w==="number"?H=g==="expand"?[0,1]:dR(d[B].stackGroups,h,p):H=lR(Z,l.filter(function(F){var q=c in F.props?F.props[c]:F.type.defaultProps[c],de="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return q===B&&(z||!de)}),w,v,!0);if(w==="number")H=f0(m,H,B,o,k),$&&(H=Tx($,H,M));else if(w==="category"&&$){var fe=$,L=H.every(function(F){return fe.indexOf(F)>=0});L&&(H=fe)}}return oe(oe({},S),{},Ee({},B,oe(oe({},O),{},{axisType:o,domain:H,categoricalDomain:Q,duplicateDomain:W,originalDomain:(x=O.domain)!==null&&x!==void 0?x:D,isCategorical:j,layout:v})))},{})},KW=function(t,n){var r=n.graphicalItems,l=n.Axis,o=n.axisType,c=n.axisIdKey,d=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,v=t.layout,m=t.children,g=hh(t.data,{graphicalItems:r,dataStartIndex:h,dataEndIndex:p}),j=g.length,S=oR(v,o),_=-1;return r.reduce(function(x,O){var w=O.type.defaultProps!==void 0?oe(oe({},O.type.defaultProps),O.props):O.props,E=w[c],M=xP("number");if(!x[E]){_++;var A;return S?A=od(0,j):d&&d[E]&&d[E].hasStack?(A=dR(d[E].stackGroups,h,p),A=f0(m,A,E,o)):(A=Tx(M,lR(g,r.filter(function(C){var k,z,B=c in C.props?C.props[c]:(k=C.type.defaultProps)===null||k===void 0?void 0:k[c],Z="hide"in C.props?C.props.hide:(z=C.type.defaultProps)===null||z===void 0?void 0:z.hide;return B===E&&!Z}),"number",v),l.defaultProps.allowDataOverflow),A=f0(m,A,E,o)),oe(oe({},x),{},Ee({},E,oe(oe({axisType:o},l.defaultProps),{},{hide:!0,orientation:qn(HW,"".concat(o,".").concat(_%2),null),domain:A,originalDomain:M,isCategorical:S,layout:v})))}return x},{})},XW=function(t,n){var r=n.axisType,l=r===void 0?"xAxis":r,o=n.AxisComp,c=n.graphicalItems,d=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,v=t.children,m="".concat(l,"Id"),g=er(v,o),j={};return g&&g.length?j=FW(t,{axes:g,graphicalItems:c,axisType:l,axisIdKey:m,stackGroups:d,dataStartIndex:h,dataEndIndex:p}):c&&c.length&&(j=KW(t,{Axis:o,graphicalItems:c,axisType:l,axisIdKey:m,stackGroups:d,dataStartIndex:h,dataEndIndex:p})),j},ZW=function(t){var n=La(t),r=Jr(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Q0(r,function(l){return l.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Kf(n,r)}},FC=function(t){var n=t.children,r=t.defaultShowTooltip,l=Dn(n,Wl),o=0,c=0;return t.data&&t.data.length!==0&&(c=t.data.length-1),l&&l.props&&(l.props.startIndex>=0&&(o=l.props.startIndex),l.props.endIndex>=0&&(c=l.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!r}},WW=function(t){return!t||!t.length?!1:t.some(function(n){var r=ea(n&&n.type);return r&&r.indexOf("Bar")>=0})},KC=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},QW=function(t,n){var r=t.props,l=t.graphicalItems,o=t.xAxisMap,c=o===void 0?{}:o,d=t.yAxisMap,h=d===void 0?{}:d,p=r.width,v=r.height,m=r.children,g=r.margin||{},j=Dn(m,Wl),S=Dn(m,Oi),_=Object.keys(h).reduce(function(A,C){var k=h[C],z=k.orientation;return!k.mirror&&!k.hide?oe(oe({},A),{},Ee({},z,A[z]+k.width)):A},{left:g.left||0,right:g.right||0}),x=Object.keys(c).reduce(function(A,C){var k=c[C],z=k.orientation;return!k.mirror&&!k.hide?oe(oe({},A),{},Ee({},z,qn(A,"".concat(z))+k.height)):A},{top:g.top||0,bottom:g.bottom||0}),O=oe(oe({},x),_),w=O.bottom;j&&(O.bottom+=j.props.height||Wl.defaultProps.height),S&&n&&(O=CH(O,l,r,n));var E=p-O.left-O.right,M=v-O.top-O.bottom;return oe(oe({brushBottom:w},O),{},{width:Math.max(E,0),height:Math.max(M,0)})},JW=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},jP=function(t){var n=t.chartName,r=t.GraphicalChild,l=t.defaultTooltipEventType,o=l===void 0?"axis":l,c=t.validateTooltipEventTypes,d=c===void 0?["axis"]:c,h=t.axisComponents,p=t.legendContent,v=t.formatAxisMap,m=t.defaultProps,g=function(O,w){var E=w.graphicalItems,M=w.stackGroups,A=w.offset,C=w.updateId,k=w.dataStartIndex,z=w.dataEndIndex,B=O.barSize,Z=O.layout,G=O.barGap,H=O.barCategoryGap,W=O.maxBarSize,Q=KC(Z),D=Q.numericAxisName,P=Q.cateAxisName,$=WW(E),U=[];return E.forEach(function(ie,fe){var L=hh(O.data,{graphicalItems:[ie],dataStartIndex:k,dataEndIndex:z}),F=ie.type.defaultProps!==void 0?oe(oe({},ie.type.defaultProps),ie.props):ie.props,q=F.dataKey,de=F.maxBarSize,ge=F["".concat(D,"Id")],we=F["".concat(P,"Id")],$e={},Ge=h.reduce(function(ir,Tr){var jo=w["".concat(Tr.axisType,"Map")],rn=F["".concat(Tr.axisType,"Id")];jo&&jo[rn]||Tr.axisType==="zAxis"||ki();var Ru=jo[rn];return oe(oe({},ir),{},Ee(Ee({},Tr.axisType,Ru),"".concat(Tr.axisType,"Ticks"),Jr(Ru)))},$e),me=Ge[P],Te=Ge["".concat(P,"Ticks")],Me=M&&M[ge]&&M[ge].hasStack&&UH(ie,M[ge].stackGroups),he=ea(ie.type).indexOf("Bar")>=0,st=Kf(me,Te),ae=[],Ke=$&&EH({barSize:B,stackGroups:M,totalSize:JW(Ge,P)});if(he){var St,nn,ar=ze(de)?W:de,yr=(St=(nn=Kf(me,Te,!0))!==null&&nn!==void 0?nn:ar)!==null&&St!==void 0?St:0;ae=TH({barGap:G,barCategoryGap:H,bandSize:yr!==st?yr:st,sizeList:Ke[we],maxBarSize:ar}),yr!==st&&(ae=ae.map(function(ir){return oe(oe({},ir),{},{position:oe(oe({},ir.position),{},{offset:ir.position.offset-yr/2})})}))}var fa=ie&&ie.type&&ie.type.getComposedData;fa&&U.push({props:oe(oe({},fa(oe(oe({},Ge),{},{displayedData:L,props:O,dataKey:q,item:ie,bandSize:st,barPosition:ae,offset:A,stackedData:Me,layout:Z,dataStartIndex:k,dataEndIndex:z}))),{},Ee(Ee(Ee({key:ie.key||"item-".concat(fe)},D,Ge[D]),P,Ge[P]),"animationId",C)),childIndex:Rq(ie,O.children),item:ie})}),U},j=function(O,w){var E=O.props,M=O.dataStartIndex,A=O.dataEndIndex,C=O.updateId;if(!dO({props:E}))return null;var k=E.children,z=E.layout,B=E.stackOffset,Z=E.data,G=E.reverseStackOrder,H=KC(z),W=H.numericAxisName,Q=H.cateAxisName,D=er(k,r),P=LH(Z,D,"".concat(W,"Id"),"".concat(Q,"Id"),B,G),$=h.reduce(function(F,q){var de="".concat(q.axisType,"Map");return oe(oe({},F),{},Ee({},de,XW(E,oe(oe({},q),{},{graphicalItems:D,stackGroups:q.axisType===W&&P,dataStartIndex:M,dataEndIndex:A}))))},{}),U=QW(oe(oe({},$),{},{props:E,graphicalItems:D}),w==null?void 0:w.legendBBox);Object.keys($).forEach(function(F){$[F]=v(E,$[F],U,F.replace("Map",""),n)});var ie=$["".concat(Q,"Map")],fe=ZW(ie),L=g(E,oe(oe({},$),{},{dataStartIndex:M,dataEndIndex:A,updateId:C,graphicalItems:D,stackGroups:P,offset:U}));return oe(oe({formattedGraphicalItems:L,graphicalItems:D,offset:U,stackGroups:P},fe),$)},S=(function(x){function O(w){var E,M,A;return kW(this,O),A=DW(this,O,[w]),Ee(A,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ee(A,"accessibilityManager",new gW),Ee(A,"handleLegendBBoxUpdate",function(C){if(C){var k=A.state,z=k.dataStartIndex,B=k.dataEndIndex,Z=k.updateId;A.setState(oe({legendBBox:C},j({props:A.props,dataStartIndex:z,dataEndIndex:B,updateId:Z},oe(oe({},A.state),{},{legendBBox:C}))))}}),Ee(A,"handleReceiveSyncEvent",function(C,k,z){if(A.props.syncId===C){if(z===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(k)}}),Ee(A,"handleBrushChange",function(C){var k=C.startIndex,z=C.endIndex;if(k!==A.state.dataStartIndex||z!==A.state.dataEndIndex){var B=A.state.updateId;A.setState(function(){return oe({dataStartIndex:k,dataEndIndex:z},j({props:A.props,dataStartIndex:k,dataEndIndex:z,updateId:B},A.state))}),A.triggerSyncEvent({dataStartIndex:k,dataEndIndex:z})}}),Ee(A,"handleMouseEnter",function(C){var k=A.getMouseInfo(C);if(k){var z=oe(oe({},k),{},{isTooltipActive:!0});A.setState(z),A.triggerSyncEvent(z);var B=A.props.onMouseEnter;ke(B)&&B(z,C)}}),Ee(A,"triggeredAfterMouseMove",function(C){var k=A.getMouseInfo(C),z=k?oe(oe({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(z),A.triggerSyncEvent(z);var B=A.props.onMouseMove;ke(B)&&B(z,C)}),Ee(A,"handleItemMouseEnter",function(C){A.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Ee(A,"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),Ee(A,"handleMouseMove",function(C){C.persist(),A.throttleTriggeredAfterMouseMove(C)}),Ee(A,"handleMouseLeave",function(C){A.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};A.setState(k),A.triggerSyncEvent(k);var z=A.props.onMouseLeave;ke(z)&&z(k,C)}),Ee(A,"handleOuterEvent",function(C){var k=kq(C),z=qn(A.props,"".concat(k));if(k&&ke(z)){var B,Z;/.*touch.*/i.test(k)?Z=A.getMouseInfo(C.changedTouches[0]):Z=A.getMouseInfo(C),z((B=Z)!==null&&B!==void 0?B:{},C)}}),Ee(A,"handleClick",function(C){var k=A.getMouseInfo(C);if(k){var z=oe(oe({},k),{},{isTooltipActive:!0});A.setState(z),A.triggerSyncEvent(z);var B=A.props.onClick;ke(B)&&B(z,C)}}),Ee(A,"handleMouseDown",function(C){var k=A.props.onMouseDown;if(ke(k)){var z=A.getMouseInfo(C);k(z,C)}}),Ee(A,"handleMouseUp",function(C){var k=A.props.onMouseUp;if(ke(k)){var z=A.getMouseInfo(C);k(z,C)}}),Ee(A,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Ee(A,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&A.handleMouseDown(C.changedTouches[0])}),Ee(A,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&A.handleMouseUp(C.changedTouches[0])}),Ee(A,"handleDoubleClick",function(C){var k=A.props.onDoubleClick;if(ke(k)){var z=A.getMouseInfo(C);k(z,C)}}),Ee(A,"handleContextMenu",function(C){var k=A.props.onContextMenu;if(ke(k)){var z=A.getMouseInfo(C);k(z,C)}}),Ee(A,"triggerSyncEvent",function(C){A.props.syncId!==void 0&&Db.emit($b,A.props.syncId,C,A.eventEmitterSymbol)}),Ee(A,"applySyncEvent",function(C){var k=A.props,z=k.layout,B=k.syncMethod,Z=A.state.updateId,G=C.dataStartIndex,H=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)A.setState(oe({dataStartIndex:G,dataEndIndex:H},j({props:A.props,dataStartIndex:G,dataEndIndex:H,updateId:Z},A.state)));else if(C.activeTooltipIndex!==void 0){var W=C.chartX,Q=C.chartY,D=C.activeTooltipIndex,P=A.state,$=P.offset,U=P.tooltipTicks;if(!$)return;if(typeof B=="function")D=B(U,C);else if(B==="value"){D=-1;for(var ie=0;ie=0){var Me,he;if(W.dataKey&&!W.allowDuplicatedCategory){var st=typeof W.dataKey=="function"?Te:"payload.".concat(W.dataKey.toString());Me=Xb(ie,st,D),he=fe&&L&&Xb(L,st,D)}else Me=ie==null?void 0:ie[Q],he=fe&&L&&L[Q];if(we||ge){var ae=C.props.activeIndex!==void 0?C.props.activeIndex:Q;return[T.cloneElement(C,oe(oe(oe({},B.props),Ge),{},{activeIndex:ae})),null,null]}if(!ze(Me))return[me].concat(lo(A.renderActivePoints({item:B,activePoint:Me,basePoint:he,childIndex:Q,isRange:fe})))}else{var Ke,St=(Ke=A.getItemByXY(A.state.activeCoordinate))!==null&&Ke!==void 0?Ke:{graphicalItem:me},nn=St.graphicalItem,ar=nn.item,yr=ar===void 0?C:ar,fa=nn.childIndex,ir=oe(oe(oe({},B.props),Ge),{},{activeIndex:fa});return[T.cloneElement(yr,ir),null,null]}return fe?[me,null,null]:[me,null]}),Ee(A,"renderCustomized",function(C,k,z){return T.cloneElement(C,oe(oe({key:"recharts-customized-".concat(z)},A.props),A.state))}),Ee(A,"renderMap",{CartesianGrid:{handler:hf,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:hf},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:hf},YAxis:{handler:hf},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((E=w.id)!==null&&E!==void 0?E:Nu("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=ak(A.triggeredAfterMouseMove,(M=w.throttleDelay)!==null&&M!==void 0?M:1e3/60),A.state={},A}return zW(O,x),PW(O,[{key:"componentDidMount",value:function(){var E,M;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(M=this.props.margin.top)!==null&&M!==void 0?M:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var E=this.props,M=E.children,A=E.data,C=E.height,k=E.layout,z=Dn(M,xn);if(z){var B=z.props.defaultIndex;if(!(typeof B!="number"||B<0||B>this.state.tooltipTicks.length-1)){var Z=this.state.tooltipTicks[B]&&this.state.tooltipTicks[B].value,G=p0(this.state,A,B,Z),H=this.state.tooltipTicks[B].coordinate,W=(this.state.offset.top+C)/2,Q=k==="horizontal",D=Q?{x:H,y:W}:{y:H,x:W},P=this.state.formattedGraphicalItems.find(function(U){var ie=U.item;return ie.type.name==="Scatter"});P&&(D=oe(oe({},D),P.props.points[B].tooltipPosition),G=P.props.points[B].tooltipPayload);var $={activeTooltipIndex:B,isTooltipActive:!0,activeLabel:Z,activePayload:G,activeCoordinate:D};this.setState($),this.renderCursor(z),this.accessibilityManager.setIndex(B)}}}},{key:"getSnapshotBeforeUpdate",value:function(E,M){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==M.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==E.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==E.margin){var A,C;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(E){Wb([Dn(E.children,xn)],[Dn(this.props.children,xn)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var E=Dn(this.props.children,xn);if(E&&typeof E.props.shared=="boolean"){var M=E.props.shared?"axis":"item";return d.indexOf(M)>=0?M:o}return o}},{key:"getMouseInfo",value:function(E){if(!this.container)return null;var M=this.container,A=M.getBoundingClientRect(),C=b9(A),k={chartX:Math.round(E.pageX-C.left),chartY:Math.round(E.pageY-C.top)},z=A.width/M.offsetWidth||1,B=this.inRange(k.chartX,k.chartY,z);if(!B)return null;var Z=this.state,G=Z.xAxisMap,H=Z.yAxisMap,W=this.getTooltipEventType(),Q=VC(this.state,this.props.data,this.props.layout,B);if(W!=="axis"&&G&&H){var D=La(G).scale,P=La(H).scale,$=D&&D.invert?D.invert(k.chartX):null,U=P&&P.invert?P.invert(k.chartY):null;return oe(oe({},k),{},{xValue:$,yValue:U},Q)}return Q?oe(oe({},k),Q):null}},{key:"inRange",value:function(E,M){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,k=E/A,z=M/A;if(C==="horizontal"||C==="vertical"){var B=this.state.offset,Z=k>=B.left&&k<=B.left+B.width&&z>=B.top&&z<=B.top+B.height;return Z?{x:k,y:z}:null}var G=this.state,H=G.angleAxisMap,W=G.radiusAxisMap;if(H&&W){var Q=La(H);return eT({x:k,y:z},Q)}return null}},{key:"parseEventsOfWrapper",value:function(){var E=this.props.children,M=this.getTooltipEventType(),A=Dn(E,xn),C={};A&&M==="axis"&&(A.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Sf(this.props,this.handleOuterEvent);return oe(oe({},k),C)}},{key:"addListener",value:function(){Db.on($b,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Db.removeListener($b,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(E,M,A){for(var C=this.state.formattedGraphicalItems,k=0,z=C.length;k{l(null),ce.get("/dashboard").then(n).catch(l)};if(T.useEffect(o,[]),r)return u.jsx(Oe,{error:r,onRetry:o});if(!t)return u.jsx(Ze,{});const{stats:c}=t,d=t.hoursByMonth.map(v=>({...v,maand:v.month.slice(5)})),h=t.revenueByMonth.map(v=>({...v,maand:v.month.slice(5)})),p=t.engagementByType.map(v=>({name:tQ[v.type]||v.type,value:v.cnt}));return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Dashboard"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Overzicht van je consultancy-praktijk"})]}),u.jsx(ft,{to:"/clients",children:u.jsxs("span",{className:"text-[13px] text-accent hover:underline flex items-center gap-1",children:["Alle cliënten ",u.jsx(A0,{className:"w-3.5 h-3.5"})]})})]}),u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3",children:[u.jsx(tn,{icon:T0,label:"Cliënten",value:c.totalClients,sub:`${c.activeClients} actief · ${c.leads} leads`,color:"accent",iconColor:Zr("users",e)}),u.jsx(tn,{icon:N0,label:"Lopende engagements",value:c.activeEngagements,color:"blue",iconColor:Zr("briefcase",e)}),u.jsx(tn,{icon:KM,label:"Open taken",value:c.totalTasks-c.completedTasks,sub:c.overdueTasks>0?`${c.overdueTasks} te laat`:void 0,color:c.overdueTasks>0?"red":"green",iconColor:Zr("check-circle",e)}),u.jsx(tn,{icon:Ba,label:"Uren totaal",value:ye.hours(c.totalHours),sub:`${ye.hours(c.billableHours)} facturabel`,color:"purple",iconColor:Zr("clock",e)}),u.jsx(tn,{icon:zs,label:"Openstaand",value:ye.euro(c.totalOutstanding),color:"yellow",iconColor:Zr("receipt",e)}),u.jsx(tn,{icon:Td,label:"Betaald",value:ye.euro(c.totalPaid),color:"green",iconColor:Zr("wallet",e)})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[u.jsx(Ae,{title:"Uren per maand",subtitle:"Totaal vs facturabel (6 mnd)",className:"xl:col-span-2",children:u.jsx("div",{className:"h-56",children:u.jsx(Cs,{width:"100%",height:"100%",children:u.jsxs(xd,{data:d,children:[u.jsx(gu,{strokeDasharray:"3 3",stroke:"#1f2a44",vertical:!1}),u.jsx(Pi,{dataKey:"maand",tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(Di,{tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(xn,{...zb,cursor:{fill:"rgba(0,212,255,0.06)"}}),u.jsx(_n,{dataKey:"hours",name:"Totaal",fill:"#58a6ff",radius:[4,4,0,0]}),u.jsx(_n,{dataKey:"billable",name:"Facturabel",fill:"#00d4ff",radius:[4,4,0,0]})]})})})}),u.jsx(Ae,{title:"Engagements per type",children:u.jsx("div",{className:"h-56",children:p.length===0?u.jsx("div",{className:"h-full flex items-center justify-center text-muted text-[13px]",children:"Nog geen engagements"}):u.jsx(Cs,{width:"100%",height:"100%",children:u.jsxs(eQ,{children:[u.jsx(ca,{data:p,dataKey:"value",nameKey:"name",innerRadius:50,outerRadius:75,paddingAngle:3,children:p.map((v,m)=>u.jsx(Id,{fill:XC[m%XC.length]},m))}),u.jsx(xn,{...zb}),u.jsx(Oi,{iconSize:8,wrapperStyle:{fontSize:11,color:"#8b9bb8"}})]})})})})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:[u.jsx(Ae,{title:"Recente engagements",actions:u.jsx(ft,{to:"/engagements",className:"text-[12px] text-accent hover:underline",children:"Alles"}),className:"xl:col-span-1",children:t.recentEngagements.length===0?u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen engagements"}):u.jsx("div",{className:"space-y-2",children:t.recentEngagements.slice(0,6).map(v=>u.jsxs(ft,{to:`/engagements/${v.id}`,className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:v.title}),u.jsx("div",{className:"text-[11px] text-muted",children:v.client_name})]}),u.jsx(Tt,{status:v.status,labels:ZC})]},v.id))})}),u.jsx(Ae,{title:"Taken op de plank",actions:u.jsx(ft,{to:"/tasks",className:"text-[12px] text-accent hover:underline",children:"Alles"}),className:"xl:col-span-1",children:t.upcomingTasks.length===0?u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Geen open taken"}):u.jsx("div",{className:"space-y-2",children:t.upcomingTasks.slice(0,6).map(v=>u.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:v.title}),u.jsxs("div",{className:"text-[11px] text-muted",children:[v.client_name," · ",v.due_date?ye.date(v.due_date):"geen deadline"]})]}),u.jsx(nt,{color:ZC&&v.priority==="critical"?"red":v.priority==="high"?"yellow":"blue",children:v.priority})]},v.id))})}),u.jsx(Ae,{title:"Slim advies",subtitle:"Automatisch gegenereerd",className:"xl:col-span-1",children:t.activeAdvice.length===0?u.jsxs("div",{className:"text-muted text-[13px] py-4 text-center flex flex-col items-center gap-2",children:[u.jsx(ZM,{className:"w-5 h-5"})," Alles onder controle"]}):u.jsx("div",{className:"space-y-2",children:t.activeAdvice.slice(0,5).map(v=>u.jsxs("div",{className:"flex items-start gap-2.5 px-2.5 py-2 rounded-lg hover:bg-card-hover",children:[u.jsx(e3,{className:`w-4 h-4 mt-0.5 shrink-0 ${v.priority==="critical"?"text-red":v.priority==="high"?"text-yellow":"text-blue"}`}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[12px]",children:v.advice_text}),u.jsx("div",{className:"text-[11px] text-muted mt-0.5",children:v.client_name})]})]},v.id))})})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[u.jsx(Ae,{title:"Omzet per maand",subtitle:"Betaald vs openstaand (6 mnd)",children:u.jsx("div",{className:"h-52",children:u.jsx(Cs,{width:"100%",height:"100%",children:u.jsxs(xd,{data:h,children:[u.jsx(gu,{strokeDasharray:"3 3",stroke:"#1f2a44",vertical:!1}),u.jsx(Pi,{dataKey:"maand",tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(Di,{tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1,tickFormatter:v=>`€${v}`}),u.jsx(xn,{...zb,formatter:v=>ye.euro(v),cursor:{fill:"rgba(0,212,255,0.06)"}}),u.jsx(_n,{dataKey:"paid",name:"Betaald",fill:"#3fb950",radius:[4,4,0,0]}),u.jsx(_n,{dataKey:"outstanding",name:"Openstaand",fill:"#d29922",radius:[4,4,0,0]})]})})})}),u.jsx(Ae,{title:"Recente activiteit",actions:u.jsxs(ft,{to:"/settings?tab=audit",className:"text-[12px] text-accent hover:underline flex items-center gap-1",children:[u.jsx(U$,{className:"w-3.5 h-3.5"})," Audit-log"]}),padding:!1,children:u.jsx("div",{className:"p-4",children:u.jsx(Dt,{columns:[{label:"Wie",key:"username"},{label:"Actie",key:"action"},{label:"Wanneer",render:v=>u.jsx("span",{className:"text-muted",children:ye.datetime(v.created_at)})}],rows:t.recentAudit,keyFn:v=>v.id,empty:u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen activiteit"})})})})]})]})}const _P={lead:"Lead",active:"Actief",paused:"Gepauzeerd",archived:"Gearchiveerd"},rQ=[{key:"",label:"Alle"},{key:"lead",label:"Leads"},{key:"active",label:"Actief"},{key:"paused",label:"Gepauzeerd"},{key:"archived",label:"Gearchiveerd"}],WC={name:"",industry:"",website:"",contact_name:"",contact_email:"",contact_phone:"",status:"lead",source:"",notes:""};function aQ({open:e,onClose:t,client:n,onSaved:r,onDelete:l}){const[o,c]=T.useState(WC),[d,h]=T.useState(!1),[p,v]=T.useState(null);T.useEffect(()=>{e&&(v(null),c(n?{name:n.name||"",industry:n.industry||"",website:n.website||"",contact_name:n.contact_name||"",contact_email:n.contact_email||"",contact_phone:n.contact_phone||"",status:n.status||"lead",source:n.source||"",notes:n.notes||""}:WC))},[e,n]);const m=j=>S=>c(_=>({..._,[j]:S.target.value})),g=async j=>{j.preventDefault(),h(!0),v(null);try{n?await ce.put(`/clients/${n.id}`,o):await ce.post("/clients",o),r()}catch(S){v(S)}finally{h(!1)}};return u.jsx(_t,{open:e,onClose:t,title:n?"Cliënt bewerken":"Nieuwe cliënt",wide:!0,children:u.jsxs("form",{onSubmit:g,className:"space-y-3",children:[u.jsx(Oe,{error:p}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[u.jsx(te,{label:"Bedrijfsnaam *",className:"md:col-span-2",children:u.jsx("input",{className:X,value:o.name,onChange:m("name"),required:!0,autoFocus:!0})}),u.jsx(te,{label:"Branche",children:u.jsx("input",{className:X,value:o.industry,onChange:m("industry")})}),u.jsx(te,{label:"Website",children:u.jsx("input",{className:X,value:o.website,onChange:m("website"),placeholder:"https://..."})}),u.jsx(te,{label:"Contactpersoon",children:u.jsx("input",{className:X,value:o.contact_name,onChange:m("contact_name")})}),u.jsx(te,{label:"E-mail",children:u.jsx("input",{type:"email",className:X,value:o.contact_email,onChange:m("contact_email")})}),u.jsx(te,{label:"Telefoon",children:u.jsx("input",{className:X,value:o.contact_phone,onChange:m("contact_phone")})}),u.jsx(te,{label:"Status",children:u.jsx("select",{className:X,value:o.status,onChange:m("status"),children:Object.entries(_P).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})}),u.jsx(te,{label:"Bron",className:"md:col-span-2",children:u.jsx("input",{className:X,value:o.source,onChange:m("source"),placeholder:"Bijv. referral, website, netwerk"})}),u.jsx(te,{label:"Notities",className:"md:col-span-2",children:u.jsx("textarea",{className:X,rows:3,value:o.notes,onChange:m("notes")})})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsx("div",{children:n&&l&&u.jsxs(pe,{type:"button",variant:"danger",onClick:l,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:d,children:n?"Opslaan":"Aanmaken"})]})]})]})})}function iQ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(""),[c,d]=T.useState(""),[h,p]=T.useState(""),[v,m]=T.useState({open:!1,client:null}),g=()=>{r(null),ce.get("/clients"+Ga({status:l,search:h})).then(t).catch(r)};T.useEffect(g,[l,h]);const j=x=>{x.preventDefault(),p(c.trim())},S=()=>m({open:!1,client:null}),_=async()=>{const x=v.client;if(x&&window.confirm(`Cliënt "${x.name}" verwijderen? Dit kan niet ongedaan worden gemaakt.`))try{await ce.del(`/clients/${x.id}`),S(),g()}catch(O){r(O)}};return u.jsxs("div",{className:"space-y-4 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Cliënten"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Beheer je klantrelaties"})]}),u.jsxs(pe,{onClick:()=>m({open:!0,client:null}),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuwe cliënt"]})]}),u.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u.jsxs("form",{onSubmit:j,className:"flex gap-2",children:[u.jsx("input",{className:X+" w-64",placeholder:"Zoeken op naam, contact of branche...",value:c,onChange:x=>d(x.target.value)}),u.jsxs(pe,{type:"submit",variant:"secondary",children:[u.jsx(JM,{className:"w-4 h-4"})," Zoeken"]})]}),u.jsx("div",{className:"flex gap-1 flex-wrap",children:rQ.map(x=>u.jsx("button",{onClick:()=>o(x.key),className:`px-3 py-1.5 rounded-lg text-[12px] transition-colors ${l===x.key?"bg-accent-soft text-accent font-medium":"text-muted hover:text-text hover:bg-card"}`,children:x.label},x.key))})]}),n&&u.jsx(Oe,{error:n,onRetry:g}),!e&&!n&&u.jsx(Ze,{}),e&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:u.jsx(Dt,{columns:[{label:"Naam",render:x=>u.jsx(ft,{to:`/clients/${x.id}`,className:"font-medium text-text hover:text-accent transition-colors",children:x.name})},{label:"Contactpersoon",render:x=>x.contact_name||u.jsx("span",{className:"text-muted",children:"-"})},{label:"E-mail",render:x=>x.contact_email||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Branche",render:x=>x.industry||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Status",render:x=>u.jsx(Tt,{status:x.status,labels:_P})},{label:"Engagements",render:x=>x.engagement_count},{label:"Laatst bijgewerkt",render:x=>u.jsx("span",{className:"text-muted",children:ye.date(x.updated_at)})},{label:"",render:x=>u.jsx("div",{className:"flex items-center justify-end",children:u.jsx("button",{onClick:()=>m({open:!0,client:x}),className:"p-1.5 rounded-md text-muted hover:text-text hover:bg-bg-soft",title:"Bewerken",children:u.jsx(Ya,{className:"w-3.5 h-3.5"})})})}],rows:e,keyFn:x=>x.id,empty:u.jsx(Ar,{icon:T0,title:"Geen cliënten gevonden",hint:"Pas de filters aan of voeg een nieuwe cliënt toe."})})})}),u.jsx(aQ,{open:v.open,client:v.client,onClose:S,onSaved:()=>{S(),g()},onDelete:_})]})}const oo={assessment:"Assessment",architecture:"Architectuur",implementation:"Implementatie",monitoring:"Monitoring",consulting:"Consulting",training:"Training"},so={planned:"Gepland",in_progress:"Lopend",completed:"Afgerond",on_hold:"On hold"},Lb="bg-bg-soft border border-border rounded-lg px-3 py-2 text-[13px] focus:outline-none focus:border-accent/60 transition-colors",QC={client_id:"",type:"assessment",title:"",description:"",start_date:"",end_date:""};function SP({open:e,onClose:t,clients:n=[],clientId:r,onSaved:l}){const[o,c]=T.useState(QC),[d,h]=T.useState(!1),[p,v]=T.useState(null);T.useEffect(()=>{e&&(v(null),c({...QC,client_id:r?String(r):""}))},[e,r]);const m=j=>S=>c(_=>({..._,[j]:S.target.value})),g=async j=>{j.preventDefault(),h(!0),v(null);try{await ce.post("/engagements",{...o,client_id:r||o.client_id}),l()}catch(S){v(S)}finally{h(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Nieuw engagement",children:u.jsxs("form",{onSubmit:g,className:"space-y-3",children:[u.jsx(Oe,{error:p}),!r&&u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{className:X,value:o.client_id,onChange:m("client_id"),required:!0,children:[u.jsx("option",{value:"",children:"— Kies een cliënt —"}),n.map(j=>u.jsx("option",{value:j.id,children:j.name},j.id))]})}),u.jsx(te,{label:"Type *",children:u.jsx("select",{className:X,value:o.type,onChange:m("type"),required:!0,children:Object.entries(oo).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})}),u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:o.title,onChange:m("title"),required:!0,autoFocus:!0})}),u.jsx(te,{label:"Omschrijving",children:u.jsx("textarea",{className:X,rows:3,value:o.description,onChange:m("description")})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Startdatum",children:u.jsx("input",{type:"date",className:X,value:o.start_date,onChange:m("start_date")})}),u.jsx(te,{label:"Einddatum",children:u.jsx("input",{type:"date",className:X,value:o.end_date,onChange:m("end_date")})})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:d,children:"Aanmaken"})]})]})})}function lQ(){const[e,t]=T.useState(null),[n,r]=T.useState([]),[l,o]=T.useState(null),[c,d]=T.useState({type:"",status:"",client_id:""}),[h,p]=T.useState(!1),v=()=>{o(null),ce.get("/engagements"+Ga(c)).then(t).catch(o)};T.useEffect(v,[c.type,c.status,c.client_id]),T.useEffect(()=>{ce.get("/clients").then(r).catch(()=>{})},[]);const m=g=>j=>d(S=>({...S,[g]:j.target.value}));return u.jsxs("div",{className:"space-y-4 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Engagements"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Alle opdrachten en projecten"})]}),u.jsxs(pe,{onClick:()=>p(!0),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw engagement"]})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsxs("select",{className:Lb,value:c.type,onChange:m("type"),children:[u.jsx("option",{value:"",children:"Alle types"}),Object.entries(oo).map(([g,j])=>u.jsx("option",{value:g,children:j},g))]}),u.jsxs("select",{className:Lb,value:c.status,onChange:m("status"),children:[u.jsx("option",{value:"",children:"Alle statussen"}),Object.entries(so).map(([g,j])=>u.jsx("option",{value:g,children:j},g))]}),u.jsxs("select",{className:Lb,value:c.client_id,onChange:m("client_id"),children:[u.jsx("option",{value:"",children:"Alle cliënten"}),n.map(g=>u.jsx("option",{value:g.id,children:g.name},g.id))]})]}),l&&u.jsx(Oe,{error:l,onRetry:v}),!e&&!l&&u.jsx(Ze,{}),e&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:u.jsx(Dt,{columns:[{label:"Titel",render:g=>u.jsx(ft,{to:`/engagements/${g.id}`,className:"font-medium text-text hover:text-accent transition-colors",children:g.title})},{label:"Cliënt",render:g=>u.jsx(ft,{to:`/clients/${g.client_id}`,className:"text-muted hover:text-accent transition-colors",children:g.client_name})},{label:"Type",render:g=>oo[g.type]||g.type},{label:"Status",render:g=>u.jsx(Tt,{status:g.status,labels:so})},{label:"Taken",render:g=>g.task_count},{label:"Start",render:g=>u.jsx("span",{className:"text-muted",children:ye.date(g.start_date)})},{label:"Eind",render:g=>u.jsx("span",{className:"text-muted",children:ye.date(g.end_date)})}],rows:e,keyFn:g=>g.id,empty:u.jsx(Ar,{icon:N0,title:"Geen engagements gevonden",hint:"Pas de filters aan of maak een nieuw engagement aan."})})})}),u.jsx(SP,{open:h,onClose:()=>p(!1),clients:n,onSaved:()=>{p(!1),v()}})]})}const wP={lead:"Lead",active:"Actief",paused:"Gepauzeerd",archived:"Gearchiveerd"},oQ={draft:"Concept",sent:"Verzonden",paid:"Betaald",overdue:"Verlopen",cancelled:"Geannuleerd"},JC={name:"",industry:"",website:"",contact_name:"",contact_email:"",contact_phone:"",status:"lead",source:"",notes:""};function sQ({open:e,onClose:t,client:n,onSaved:r,onDelete:l}){const[o,c]=T.useState(JC),[d,h]=T.useState(!1),[p,v]=T.useState(null);T.useEffect(()=>{e&&(v(null),c(n?{name:n.name||"",industry:n.industry||"",website:n.website||"",contact_name:n.contact_name||"",contact_email:n.contact_email||"",contact_phone:n.contact_phone||"",status:n.status||"lead",source:n.source||"",notes:n.notes||""}:JC))},[e,n]);const m=j=>S=>c(_=>({..._,[j]:S.target.value})),g=async j=>{j.preventDefault(),h(!0),v(null);try{await ce.put(`/clients/${n.id}`,o),r()}catch(S){v(S)}finally{h(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Cliënt bewerken",wide:!0,children:u.jsxs("form",{onSubmit:g,className:"space-y-3",children:[u.jsx(Oe,{error:p}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[u.jsx(te,{label:"Bedrijfsnaam *",className:"md:col-span-2",children:u.jsx("input",{className:X,value:o.name,onChange:m("name"),required:!0,autoFocus:!0})}),u.jsx(te,{label:"Branche",children:u.jsx("input",{className:X,value:o.industry,onChange:m("industry")})}),u.jsx(te,{label:"Website",children:u.jsx("input",{className:X,value:o.website,onChange:m("website"),placeholder:"https://..."})}),u.jsx(te,{label:"Contactpersoon",children:u.jsx("input",{className:X,value:o.contact_name,onChange:m("contact_name")})}),u.jsx(te,{label:"E-mail",children:u.jsx("input",{type:"email",className:X,value:o.contact_email,onChange:m("contact_email")})}),u.jsx(te,{label:"Telefoon",children:u.jsx("input",{className:X,value:o.contact_phone,onChange:m("contact_phone")})}),u.jsx(te,{label:"Status",children:u.jsx("select",{className:X,value:o.status,onChange:m("status"),children:Object.entries(wP).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})}),u.jsx(te,{label:"Bron",className:"md:col-span-2",children:u.jsx("input",{className:X,value:o.source,onChange:m("source"),placeholder:"Bijv. referral, website, netwerk"})}),u.jsx(te,{label:"Notities",className:"md:col-span-2",children:u.jsx("textarea",{className:X,rows:3,value:o.notes,onChange:m("notes")})})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsxs(pe,{type:"button",variant:"danger",onClick:l,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:d,children:"Opslaan"})]})]})]})})}const uQ={critical:"text-red",high:"text-yellow",medium:"text-blue",low:"text-muted"};function cQ(){const{id:e}=_u(),t=mr(),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState("overzicht"),[h,p]=T.useState(!1),[v,m]=T.useState(!1),[g,j]=T.useState(""),[S,_]=T.useState(!1),[x,O]=T.useState(null),w=()=>{o(null),ce.get(`/clients/${e}`).then(r).catch(o)};if(T.useEffect(w,[e]),!n)return l?u.jsx(Oe,{error:l,onRetry:w}):u.jsx(Ze,{});const{client:E,engagements:M,assessments:A,advice:C,diagrams:k,notes:z,timeEntries:B,invoices:Z}=n,G=B.reduce((U,ie)=>U+(ie.hours||0),0),H=E.website?/^https?:\/\//i.test(E.website)?E.website:`https://${E.website}`:null,W=async U=>{try{await ce.post(`/clients/${e}/advice/${U}/dismiss`),w()}catch(ie){o(ie)}},Q=async U=>{if(U.preventDefault(),!!g.trim()){_(!0),O(null);try{await ce.post(`/clients/${e}/notes`,{content:g.trim()}),j(""),w()}catch(ie){O(ie)}finally{_(!1)}}},D=async U=>{if(window.confirm("Deze notitie verwijderen?"))try{await ce.del(`/clients/${e}/notes/${U}`),w()}catch(ie){o(ie)}},P=async()=>{if(window.confirm(`Cliënt "${E.name}" verwijderen? Dit kan niet ongedaan worden gemaakt.`))try{await ce.del(`/clients/${E.id}`),t("/clients")}catch(U){o(U),p(!1)}},$=[{key:"overzicht",label:"Overzicht"},{key:"engagements",label:`Engagements (${M.length})`},{key:"notities",label:`Notities (${z.length})`},{key:"uren",label:`Uren (${B.length})`},{key:"facturen",label:`Facturen (${Z.length})`}];return u.jsxs("div",{className:"space-y-4 fade-in",children:[l&&u.jsx(Oe,{error:l,onRetry:w}),u.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:E.name}),u.jsx(Tt,{status:E.status,labels:wP})]}),u.jsxs("div",{className:"flex items-center gap-4 mt-1.5 text-[12px] text-muted flex-wrap",children:[E.industry&&u.jsx("span",{children:E.industry}),H&&u.jsxs("a",{href:H,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 text-accent hover:underline",children:[u.jsx(N8,{className:"w-3.5 h-3.5"})," ",E.website]})]}),u.jsxs("div",{className:"flex items-center gap-4 mt-1 text-[12px] text-muted flex-wrap",children:[E.contact_name&&u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(t3,{className:"w-3.5 h-3.5"})," ",E.contact_name]}),E.contact_email&&u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Nd,{className:"w-3.5 h-3.5"})," ",E.contact_email]}),E.contact_phone&&u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(V8,{className:"w-3.5 h-3.5"})," ",E.contact_phone]})]})]}),u.jsxs("div",{className:"flex gap-2 shrink-0",children:[u.jsxs(ft,{to:"/clients",className:"inline-flex items-center gap-1.5 rounded-lg px-3.5 py-2 text-[13px] bg-card border border-border text-text hover:bg-card-hover transition-colors",children:[u.jsx(wu,{className:"w-3.5 h-3.5"})," Terug"]}),u.jsxs(pe,{variant:"secondary",onClick:()=>p(!0),children:[u.jsx(Ya,{className:"w-3.5 h-3.5"})," Bewerken"]})]})]}),u.jsx("div",{className:"flex gap-1 border-b border-border-soft overflow-x-auto",children:$.map(U=>u.jsx("button",{onClick:()=>d(U.key),className:`px-3 py-2 text-[13px] whitespace-nowrap border-b-2 -mb-px transition-colors ${c===U.key?"border-accent text-text font-medium":"border-transparent text-muted hover:text-text"}`,children:U.label},U.key))}),c==="overzicht"&&u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[u.jsx(Ae,{title:"Actief advies",subtitle:"Automatisch gegenereerd",className:"xl:col-span-2",children:C.length===0?u.jsxs("div",{className:"text-muted text-[13px] py-4 text-center flex flex-col items-center gap-2",children:[u.jsx(ZM,{className:"w-5 h-5"})," Alles onder controle"]}):u.jsx("div",{className:"space-y-2",children:C.map(U=>u.jsxs("div",{className:"flex items-start gap-2.5 px-2.5 py-2 rounded-lg bg-bg-soft",children:[u.jsx(e3,{className:`w-4 h-4 mt-0.5 shrink-0 ${uQ[U.priority]||"text-blue"}`}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-[12px]",children:U.advice_text}),u.jsx("div",{className:"text-[11px] text-muted mt-0.5",children:ye.datetime(U.created_at)})]}),u.jsx("button",{onClick:()=>W(U.id),className:"p-1 rounded text-muted hover:text-text shrink-0",title:"Advies afronden",children:u.jsx(C0,{className:"w-3.5 h-3.5"})})]},U.id))})}),u.jsx(Ae,{title:"Notities",children:E.notes?u.jsx("p",{className:"text-[13px] whitespace-pre-wrap",children:E.notes}):u.jsx("div",{className:"text-muted text-[13px] py-2",children:"Geen notities"})}),u.jsx(Ae,{title:"Diagrammen",actions:u.jsx(ft,{to:"/diagrams",className:"text-[12px] text-accent hover:underline",children:"Alles"}),children:k.length===0?u.jsx("div",{className:"text-muted text-[13px] py-2",children:"Nog geen diagrammen"}):u.jsx("div",{className:"space-y-1.5",children:k.map(U=>u.jsxs(ft,{to:"/diagrams",className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:U.name}),u.jsx("div",{className:"text-[11px] text-muted",children:U.diagram_type})]}),u.jsx("span",{className:"text-[12px] text-muted shrink-0",children:ye.date(U.updated_at)})]},U.id))})}),u.jsx(Ae,{title:`Assessments (${A.length})`,className:"xl:col-span-2",children:A.length===0?u.jsx("div",{className:"text-muted text-[13px] py-2",children:"Nog geen assessments"}):u.jsx("div",{className:"space-y-1.5",children:A.map(U=>u.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsxs("span",{className:"text-[13px] font-medium",children:["Assessment #",U.id]}),u.jsx("span",{className:"text-[12px] text-muted",children:ye.datetime(U.created_at)})]},U.id))})})]}),c==="engagements"&&u.jsx(Ae,{title:"Engagements",actions:u.jsxs(pe,{size:"sm",onClick:()=>m(!0),children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Nieuw engagement"]}),children:u.jsx(Dt,{columns:[{label:"Titel",render:U=>u.jsx(ft,{to:`/engagements/${U.id}`,className:"font-medium text-text hover:text-accent transition-colors",children:U.title})},{label:"Type",render:U=>oo[U.type]||U.type},{label:"Status",render:U=>u.jsx(Tt,{status:U.status,labels:so})},{label:"Start",render:U=>u.jsx("span",{className:"text-muted",children:ye.date(U.start_date)})}],rows:M,keyFn:U=>U.id,empty:u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen engagements"})})}),c==="notities"&&u.jsxs(Ae,{title:"Notities",children:[u.jsxs("form",{onSubmit:Q,className:"mb-4 space-y-2",children:[x&&u.jsx(Oe,{error:x}),u.jsxs("div",{className:"flex items-end gap-2",children:[u.jsx("textarea",{className:X,rows:2,placeholder:"Schrijf een notitie...",value:g,onChange:U=>j(U.target.value)}),u.jsx(pe,{type:"submit",loading:S,className:"shrink-0",children:"Toevoegen"})]})]}),z.length===0?u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen notities"}):u.jsx("div",{className:"space-y-1.5",children:z.map(U=>u.jsxs("div",{className:"flex items-start justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] whitespace-pre-wrap",children:U.content}),u.jsxs("div",{className:"text-[11px] text-muted mt-0.5",children:[U.created_by," · ",ye.datetime(U.created_at)]})]}),u.jsx("button",{onClick:()=>D(U.id),className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-bg-soft shrink-0",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]},U.id))})]}),c==="uren"&&u.jsxs(Ae,{title:"Urenregistratie",subtitle:`Totaal: ${ye.hours(G)}`,children:[u.jsx(Dt,{columns:[{label:"Datum",render:U=>ye.date(U.date)},{label:"Gebruiker",render:U=>U.username||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Uren",render:U=>ye.hours(U.hours)},{label:"Omschrijving",render:U=>U.description||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Facturabel",render:U=>u.jsx(nt,{color:U.billable?"green":"muted",children:U.billable?"Ja":"Nee"})},{label:"Tarief",render:U=>u.jsx("span",{className:"text-muted",children:ye.euro(U.hourly_rate)})}],rows:B,keyFn:U=>U.id,empty:u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen uren geregistreerd"})}),B.length>0&&u.jsxs("div",{className:"text-right text-[13px] mt-3 pt-3 border-t border-border-soft",children:["Totaal: ",u.jsx("span",{className:"font-semibold",children:ye.hours(G)})]})]}),c==="facturen"&&u.jsx(Ae,{title:"Facturen",children:u.jsx(Dt,{columns:[{label:"Nummer",render:U=>u.jsx(ft,{to:`/invoices/${U.id}`,className:"font-medium text-text hover:text-accent transition-colors",children:U.number})},{label:"Datum",render:U=>u.jsx("span",{className:"text-muted",children:ye.date(U.date)})},{label:"Totaal",render:U=>ye.euro(U.total)},{label:"Status",render:U=>u.jsx(Tt,{status:U.status,labels:oQ})}],rows:Z,keyFn:U=>U.id,empty:u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen facturen"})})}),u.jsx(sQ,{open:h,client:E,onClose:()=>p(!1),onSaved:()=>{p(!1),w()},onDelete:P}),u.jsx(SP,{open:v,onClose:()=>m(!1),clientId:E.id,onSaved:()=>{m(!1),w()}})]})}const jd={todo:"Te doen",in_progress:"Bezig",done:"Klaar",cancelled:"Geannuleerd"},ph={critical:"Kritiek",high:"Hoog",medium:"Gemiddeld",low:"Laag"},fQ=["todo","in_progress","done","cancelled"],Nl=["todo","in_progress","done"],eM={engagement_id:"",title:"",priority:"medium",due_date:""};function dQ({open:e,onClose:t,engagements:n,onSaved:r}){const[l,o]=T.useState(eM),[c,d]=T.useState(!1),[h,p]=T.useState(null);T.useEffect(()=>{e&&(p(null),o(eM))},[e]);const v=g=>j=>o(S=>({...S,[g]:j.target.value})),m=async g=>{g.preventDefault(),d(!0),p(null);try{await ce.post("/tasks",{...l,due_date:l.due_date||null}),r()}catch(j){p(j)}finally{d(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Nieuwe taak",children:u.jsxs("form",{onSubmit:m,className:"space-y-3",children:[u.jsx(Oe,{error:h}),u.jsx(te,{label:"Engagement *",children:u.jsxs("select",{className:X,value:l.engagement_id,onChange:v("engagement_id"),required:!0,children:[u.jsx("option",{value:"",children:"— Kies een engagement —"}),n.map(g=>u.jsxs("option",{value:g.id,children:[g.title," — ",g.client_name]},g.id))]})}),u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:l.title,onChange:v("title"),required:!0,autoFocus:!0})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Prioriteit",children:u.jsx("select",{className:X,value:l.priority,onChange:v("priority"),children:Object.entries(ph).map(([g,j])=>u.jsx("option",{value:g,children:j},g))})}),u.jsx(te,{label:"Deadline",children:u.jsx("input",{type:"date",className:X,value:l.due_date,onChange:v("due_date")})})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:c,children:"Aanmaken"})]})]})})}function hQ({task:e,onMove:t,onDelete:n}){const r=new Date().toISOString().slice(0,10),l=e.due_date&&e.due_date0&&u.jsx("button",{onClick:()=>t(e,Nl[o-1]),className:"p-1 rounded text-muted hover:text-text hover:bg-bg-soft",title:`Naar '${jd[Nl[o-1]]}'`,children:u.jsx(wu,{className:"w-3.5 h-3.5"})}),o>=0&&ot(e,Nl[o+1]),className:"p-1 rounded text-muted hover:text-text hover:bg-bg-soft",title:`Naar '${jd[Nl[o+1]]}'`,children:u.jsx(A0,{className:"w-3.5 h-3.5"})})]}),u.jsx("button",{onClick:()=>n(e),className:"p-1 rounded text-muted hover:text-red hover:bg-bg-soft",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]})]})}function pQ(){const[e,t]=T.useState(null),[n,r]=T.useState([]),[l,o]=T.useState(null),[c,d]=T.useState(!1),h=()=>{o(null),ce.get("/tasks").then(t).catch(o)};T.useEffect(h,[]),T.useEffect(()=>{ce.get("/engagements").then(r).catch(()=>{})},[]);const p=async(m,g)=>{try{await ce.post(`/tasks/${m.id}/status`,{status:g}),h()}catch(j){o(j)}},v=async m=>{if(window.confirm(`Taak "${m.title}" verwijderen?`))try{await ce.del(`/tasks/${m.id}`),h()}catch(g){o(g)}};return u.jsxs("div",{className:"space-y-4 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Taken"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Kanban-overzicht van alle taken"})]}),u.jsxs(pe,{onClick:()=>d(!0),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuwe taak"]})]}),l&&u.jsx(Oe,{error:l,onRetry:h}),!e&&!l&&u.jsx(Ze,{}),e&&e.length===0&&u.jsx(Ar,{icon:p6,title:"Nog geen taken",hint:"Maak je eerste taak aan om te beginnen.",action:u.jsxs(pe,{onClick:()=>d(!0),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuwe taak"]})}),e&&e.length>0&&u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-3 items-start",children:fQ.map(m=>{const g=e.filter(j=>j.status===m);return u.jsxs("div",{className:"bg-bg-soft border border-border-soft rounded-xl p-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between px-1 pb-2",children:[u.jsx("span",{className:"text-[12px] font-semibold",children:jd[m]}),u.jsx(nt,{color:"muted",children:g.length})]}),u.jsxs("div",{className:"space-y-2",children:[g.map(j=>u.jsx(hQ,{task:j,onMove:p,onDelete:v},j.id)),g.length===0&&u.jsx("div",{className:"text-center text-[11px] text-muted py-4",children:"Geen taken"})]})]},m)})}),u.jsx(dQ,{open:c,onClose:()=>d(!1),engagements:n,onSaved:()=>{d(!1),h()}})]})}const mQ="bg-bg-soft border border-border rounded-lg px-3 py-2 text-[13px] focus:outline-none focus:border-accent/60 transition-colors",vQ="bg-bg-soft border border-border rounded-lg px-2 py-1 text-[12px] focus:outline-none focus:border-accent/60 transition-colors shrink-0",yQ={type:"assessment",title:"",description:"",start_date:"",end_date:"",status:"planned",outcome:""};function gQ({open:e,onClose:t,engagement:n,onSaved:r}){const[l,o]=T.useState(yQ),[c,d]=T.useState(!1),[h,p]=T.useState(null);T.useEffect(()=>{!e||!n||(p(null),o({type:n.type||"assessment",title:n.title||"",description:n.description||"",start_date:n.start_date||"",end_date:n.end_date||"",status:n.status||"planned",outcome:n.outcome||""}))},[e,n]);const v=g=>j=>o(S=>({...S,[g]:j.target.value})),m=async g=>{g.preventDefault(),d(!0),p(null);try{await ce.put(`/engagements/${n.id}`,l),r()}catch(j){p(j)}finally{d(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Engagement bewerken",children:u.jsxs("form",{onSubmit:m,className:"space-y-3",children:[u.jsx(Oe,{error:h}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Type *",children:u.jsx("select",{className:X,value:l.type,onChange:v("type"),required:!0,children:Object.entries(oo).map(([g,j])=>u.jsx("option",{value:g,children:j},g))})}),u.jsx(te,{label:"Status",children:u.jsx("select",{className:X,value:l.status,onChange:v("status"),children:Object.entries(so).map(([g,j])=>u.jsx("option",{value:g,children:j},g))})})]}),u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:l.title,onChange:v("title"),required:!0,autoFocus:!0})}),u.jsx(te,{label:"Omschrijving",children:u.jsx("textarea",{className:X,rows:3,value:l.description,onChange:v("description")})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Startdatum",children:u.jsx("input",{type:"date",className:X,value:l.start_date,onChange:v("start_date")})}),u.jsx(te,{label:"Einddatum",children:u.jsx("input",{type:"date",className:X,value:l.end_date,onChange:v("end_date")})})]}),u.jsx(te,{label:"Resultaat (outcome)",children:u.jsx("textarea",{className:X,rows:2,value:l.outcome,onChange:v("outcome")})}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:c,children:"Opslaan"})]})]})})}function bQ({open:e,onClose:t,engagementId:n,onSaved:r}){const l={title:"",priority:"medium",due_date:""},[o,c]=T.useState(l),[d,h]=T.useState(!1),[p,v]=T.useState(null);T.useEffect(()=>{e&&(v(null),c(l))},[e]);const m=j=>S=>c(_=>({..._,[j]:S.target.value})),g=async j=>{j.preventDefault(),h(!0),v(null);try{await ce.post("/tasks",{...o,engagement_id:n,due_date:o.due_date||null}),r()}catch(S){v(S)}finally{h(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Taak toevoegen",children:u.jsxs("form",{onSubmit:g,className:"space-y-3",children:[u.jsx(Oe,{error:p}),u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:o.title,onChange:m("title"),required:!0,autoFocus:!0})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Prioriteit",children:u.jsx("select",{className:X,value:o.priority,onChange:m("priority"),children:Object.entries(ph).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})}),u.jsx(te,{label:"Deadline",children:u.jsx("input",{type:"date",className:X,value:o.due_date,onChange:m("due_date")})})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:d,children:"Aanmaken"})]})]})})}function xQ(){const{id:e}=_u(),t=mr(),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState(!1),[h,p]=T.useState(!1),v=()=>{o(null),ce.get(`/engagements/${e}`).then(r).catch(o)};if(T.useEffect(v,[e]),!n)return l?u.jsx(Oe,{error:l,onRetry:v}):u.jsx(Ze,{});const{engagement:m,tasks:g,timeEntries:j}=n,S=async w=>{try{await ce.post(`/engagements/${e}/status`,{status:w.target.value}),v()}catch(E){o(E)}},_=async()=>{if(window.confirm(`Engagement "${m.title}" verwijderen? Dit kan niet ongedaan worden gemaakt.`))try{await ce.del(`/engagements/${e}`),t("/engagements")}catch(w){o(w)}},x=async(w,E)=>{try{await ce.post(`/tasks/${w}/status`,{status:E}),v()}catch(M){o(M)}},O=async w=>{if(window.confirm(`Taak "${w.title}" verwijderen?`))try{await ce.del(`/tasks/${w.id}`),v()}catch(E){o(E)}};return u.jsxs("div",{className:"space-y-4 fade-in",children:[l&&u.jsx(Oe,{error:l,onRetry:v}),u.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:m.title}),u.jsx(Tt,{status:m.status,labels:so}),u.jsx(nt,{color:"accent",children:oo[m.type]||m.type})]}),u.jsxs("div",{className:"flex items-center gap-3 mt-1.5 text-[13px] text-muted flex-wrap",children:[u.jsx(ft,{to:`/clients/${m.client_id}`,className:"text-accent hover:underline",children:m.client_name}),u.jsxs("span",{children:[ye.date(m.start_date)," – ",ye.date(m.end_date)]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0 flex-wrap",children:[u.jsx("select",{className:mQ,value:m.status,onChange:S,title:"Status wijzigen",children:Object.entries(so).map(([w,E])=>u.jsx("option",{value:w,children:E},w))}),u.jsxs(pe,{variant:"secondary",onClick:()=>d(!0),children:[u.jsx(Ya,{className:"w-3.5 h-3.5"})," Bewerken"]}),u.jsxs(pe,{variant:"danger",onClick:_,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})]})]}),(m.description||m.outcome)&&u.jsxs(Ae,{title:"Details",children:[m.description&&u.jsx("p",{className:"text-[13px] whitespace-pre-wrap",children:m.description}),m.outcome&&u.jsxs("div",{className:m.description?"mt-3 pt-3 border-t border-border-soft":"",children:[u.jsx("div",{className:"text-[12px] text-muted mb-1",children:"Resultaat"}),u.jsx("p",{className:"text-[13px] whitespace-pre-wrap",children:m.outcome})]})]}),u.jsx(Ae,{title:`Taken (${g.length})`,actions:u.jsxs(pe,{size:"sm",onClick:()=>p(!0),children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Taak toevoegen"]}),children:g.length===0?u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen taken"}):u.jsx("div",{className:"space-y-1.5",children:g.map(w=>u.jsxs("div",{className:"flex items-center gap-3 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:[u.jsx("select",{className:vQ,value:w.status,onChange:E=>x(w.id,E.target.value),children:Object.entries(jd).map(([E,M])=>u.jsx("option",{value:E,children:M},E))}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:w.title}),w.due_date&&u.jsxs("div",{className:"text-[11px] text-muted",children:["Deadline: ",ye.date(w.due_date)]})]}),u.jsx(Tt,{status:w.priority,labels:ph}),u.jsx("button",{onClick:()=>O(w),className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-bg-soft shrink-0",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]},w.id))})}),u.jsx(Ae,{title:`Uren (${j.length})`,children:u.jsx(Dt,{columns:[{label:"Datum",render:w=>ye.date(w.date)},{label:"Gebruiker",render:w=>w.username||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Uren",render:w=>ye.hours(w.hours)},{label:"Omschrijving",render:w=>w.description||u.jsx("span",{className:"text-muted",children:"-"})},{label:"Facturabel",render:w=>u.jsx(nt,{color:w.billable?"green":"muted",children:w.billable?"Ja":"Nee"})}],rows:j,keyFn:w=>w.id,empty:u.jsx("div",{className:"text-muted text-[13px] py-4 text-center",children:"Nog geen uren geregistreerd"})})}),u.jsx(gQ,{open:c,engagement:m,onClose:()=>d(!1),onSaved:()=>{d(!1),v()}}),u.jsx(bQ,{open:h,engagementId:m.id,onClose:()=>p(!1),onSaved:()=>{p(!1),v()}})]})}const jQ=["ma","di","wo","do","vr","za","zo"],bf={meeting:"Afspraak",call:"Telefoongesprek",deadline:"Deadline",workshop:"Workshop",review:"Review",other:"Overig"},Bb={meeting:"accent",call:"blue",deadline:"red",workshop:"purple",review:"yellow",other:"muted"};function Rl(e){return String(e).padStart(2,"0")}function pf(e){return`${e.getFullYear()}-${Rl(e.getMonth()+1)}-${Rl(e.getDate())}`}function m0(e){if(!e)return null;const t=new Date(String(e).replace(" ","T"));return isNaN(t)?null:t}function tM(e){const t=m0(e);return t?`${t.getFullYear()}-${Rl(t.getMonth()+1)}-${Rl(t.getDate())}T${Rl(t.getHours())}:${Rl(t.getMinutes())}`:""}function _Q(e){const t=new Date(e.getFullYear(),e.getMonth(),1),n=(t.getDay()+6)%7,r=new Date(t);r.setDate(t.getDate()-n);const l=[],o=new Date(r);do l.push(new Date(o)),o.setDate(o.getDate()+1);while(o.getMonth()===e.getMonth()||l.length%7!==0);return l}const nM={title:"",event_type:"meeting",start_time:"",end_time:"",all_day:!1,client_id:"",color:"#58a6ff",description:""};function SQ({form:e,setForm:t,clients:n}){const r=(l,o)=>t(c=>({...c,[l]:o}));return u.jsxs("div",{className:"space-y-3",children:[u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:e.title,onChange:l=>r("title",l.target.value),placeholder:"Bijv. kickoff meeting"})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Type",children:u.jsx("select",{className:X,value:e.event_type,onChange:l=>r("event_type",l.target.value),children:Object.entries(bf).map(([l,o])=>u.jsx("option",{value:l,children:o},l))})}),u.jsx(te,{label:"Cliënt (optioneel)",children:u.jsxs("select",{className:X,value:e.client_id,onChange:l=>r("client_id",l.target.value),children:[u.jsx("option",{value:"",children:"— Geen —"}),n.map(l=>u.jsx("option",{value:l.id,children:l.name},l.id))]})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Start *",children:u.jsx("input",{type:"datetime-local",className:X,value:e.start_time,onChange:l=>r("start_time",l.target.value)})}),u.jsx(te,{label:"Einde *",children:u.jsx("input",{type:"datetime-local",className:X,value:e.end_time,onChange:l=>r("end_time",l.target.value)})})]}),u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:e.all_day,onChange:l=>r("all_day",l.target.checked),className:"accent-[#00d4ff]"}),"Hele dag"]}),u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:["Kleur",u.jsx("input",{type:"color",value:e.color,onChange:l=>r("color",l.target.value),className:"w-8 h-8 rounded cursor-pointer bg-transparent border border-border"})]})]}),u.jsx(te,{label:"Beschrijving",children:u.jsx("textarea",{className:X,rows:3,value:e.description,onChange:l=>r("description",l.target.value)})})]})}function wQ(){const[e,t]=T.useState(()=>{const P=new Date;return P.setDate(1),P}),[n,r]=T.useState(null),[l,o]=T.useState([]),[c,d]=T.useState(null),[h,p]=T.useState(!1),[v,m]=T.useState(nM),[g,j]=T.useState(null),[S,_]=T.useState(!1),[x,O]=T.useState(null),[w,E]=T.useState(null),M=()=>{d(null),ce.get("/calendar").then(r).catch(d)};T.useEffect(M,[]),T.useEffect(()=>{ce.get("/clients").then(o).catch(()=>{})},[]);const A=T.useMemo(()=>_Q(e),[e]),C=A.length/7,k=pf(new Date),z=T.useMemo(()=>{const P={};for(const $ of n||[]){const U=m0($.start_time),ie=m0($.end_time)||U;if(!U)continue;const fe=new Date(U.getFullYear(),U.getMonth(),U.getDate()),L=new Date(ie.getFullYear(),ie.getMonth(),ie.getDate());for(;fe<=L;){const F=pf(fe);(P[F]=P[F]||[]).push($),fe.setDate(fe.getDate()+1)}}return P},[n]),B=P=>{const $=new Date(e);$.setMonth($.getMonth()+P),t($)},Z=()=>{const P=new Date;P.setDate(1),t(P)},G=P=>{const $=pf(P);j(null),m({...nM,start_time:`${$}T09:00`,end_time:`${$}T10:00`}),O(null),p(!0)},H=P=>{E(null),j(P.id),m({title:P.title||"",event_type:P.event_type||"meeting",start_time:tM(P.start_time),end_time:tM(P.end_time),all_day:!!P.all_day,client_id:P.client_id||"",color:P.color||"#58a6ff",description:P.description||""}),O(null),p(!0)},W=async()=>{if(!v.title.trim())return O("Titel is verplicht");if(!v.start_time||!v.end_time)return O("Start- en eindtijd zijn verplicht");_(!0),O(null);try{const P={...v,client_id:v.client_id||null};g?await ce.put(`/calendar/${g}`,P):await ce.post("/calendar",P),p(!1),M()}catch(P){O(P.message)}finally{_(!1)}},Q=async P=>{if(window.confirm(`Event "${P.title}" verwijderen?`))try{await ce.del(`/calendar/${P.id}`),E(null),M()}catch($){alert($.message)}};if(c)return u.jsx(Oe,{error:c,onRetry:M});if(!n)return u.jsx(Ze,{});const D=e.toLocaleDateString("nl-NL",{month:"long",year:"numeric"});return u.jsxs("div",{className:"space-y-4 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Kalender"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5 capitalize",children:D})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(pe,{variant:"secondary",size:"sm",onClick:()=>B(-1),children:u.jsx(VM,{className:"w-4 h-4"})}),u.jsx(pe,{variant:"secondary",size:"sm",onClick:Z,children:"Vandaag"}),u.jsx(pe,{variant:"secondary",size:"sm",onClick:()=>B(1),children:u.jsx(FM,{className:"w-4 h-4"})}),u.jsxs(pe,{size:"sm",onClick:()=>G(new Date),children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Nieuw event"]})]})]}),u.jsxs(Ae,{padding:!1,className:"overflow-hidden",children:[u.jsx("div",{className:"grid grid-cols-7 border-b border-border-soft",children:jQ.map(P=>u.jsx("div",{className:"px-2 py-2 text-[11px] font-medium text-muted text-center uppercase tracking-wide",children:P},P))}),u.jsx("div",{className:"grid grid-cols-7",style:{gridTemplateRows:`repeat(${C}, minmax(96px, auto))`},children:A.map(P=>{const $=pf(P),U=z[$]||[],ie=P.getMonth()===e.getMonth(),fe=$===k;return u.jsxs("div",{onClick:()=>G(P),className:`border-b border-r border-border-soft/50 p-1.5 cursor-pointer hover:bg-card-hover transition-colors min-h-[96px] ${ie?"":"bg-bg-soft/40"}`,children:[u.jsx("div",{className:"flex justify-end mb-1",children:u.jsx("span",{className:`text-[11px] w-6 h-6 flex items-center justify-center rounded-full ${fe?"ring-2 ring-accent text-accent font-bold":ie?"text-text":"text-muted"}`,children:P.getDate()})}),u.jsxs("div",{className:"space-y-0.5",children:[U.slice(0,3).map(L=>u.jsxs("button",{onClick:F=>{F.stopPropagation(),E(L)},className:"w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-left text-[11px] leading-tight",style:{backgroundColor:`${L.color||"#58a6ff"}33`,color:L.color||"#58a6ff"},children:[u.jsx("span",{className:"truncate flex-1",children:L.title}),u.jsx("span",{className:"hidden xl:inline shrink-0",children:u.jsx(nt,{color:Bb[L.event_type]||"muted",children:bf[L.event_type]||L.event_type})})]},L.id)),U.length>3&&u.jsxs("div",{className:"text-[10px] text-muted px-1.5",children:["+",U.length-3," meer"]})]})]},$)})})]}),u.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u.jsx("span",{className:"text-[12px] text-muted",children:"Legenda:"}),Object.entries(bf).map(([P,$])=>u.jsx(nt,{color:Bb[P],children:$},P))]}),u.jsxs(_t,{open:h,onClose:()=>p(!1),title:g?"Event bewerken":"Nieuw event",children:[u.jsx(SQ,{form:v,setForm:m,clients:l}),x&&u.jsx("div",{className:"text-red text-[12px] mt-3",children:x}),u.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[u.jsx(pe,{variant:"secondary",onClick:()=>p(!1),children:"Annuleren"}),u.jsx(pe,{onClick:W,loading:S,children:g?"Opslaan":"Toevoegen"})]})]}),u.jsx(_t,{open:!!w,onClose:()=>E(null),title:(w==null?void 0:w.title)||"",children:w&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx(nt,{color:Bb[w.event_type]||"muted",children:bf[w.event_type]||w.event_type}),!!w.all_day&&u.jsx(nt,{color:"blue",children:"Hele dag"}),u.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-muted",children:[u.jsx("span",{className:"w-3 h-3 rounded-full inline-block",style:{backgroundColor:w.color||"#58a6ff"}}),w.color]})]}),u.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-muted",children:[u.jsx(Ba,{className:"w-4 h-4 shrink-0"}),u.jsxs("span",{children:[ye.datetime(w.start_time)," — ",ye.datetime(w.end_time)]})]}),w.client_name&&u.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-muted",children:[u.jsx(t3,{className:"w-4 h-4 shrink-0"}),u.jsx("span",{children:w.client_name})]}),w.description&&u.jsx("p",{className:"text-[13px] whitespace-pre-wrap",children:w.description}),u.jsxs("div",{className:"flex justify-between pt-2 border-t border-border-soft",children:[u.jsxs(pe,{variant:"danger",size:"sm",onClick:()=>Q(w),children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]}),u.jsxs(pe,{size:"sm",onClick:()=>H(w),children:[u.jsx(Ya,{className:"w-3.5 h-3.5"})," Bewerken"]})]})]})})]})}const rM={to:"",cc:"",bcc:"",subject:"",text:""},aM={email:"",name:"",imap_host:"",imap_port:993,imap_secure:!0,imap_user:"",imap_pass:"",smtp_host:"",smtp_port:587,smtp_secure:!0,smtp_user:"",smtp_pass:""};function OQ({tabs:e,active:t,onChange:n}){return u.jsx("div",{className:"flex gap-1 border-b border-border-soft",children:e.map(r=>u.jsx("button",{onClick:()=>n(r.key),className:`px-3.5 py-2 text-[13px] font-medium border-b-2 -mb-px transition-colors ${t===r.key?"border-accent text-accent":"border-transparent text-muted hover:text-text"}`,children:r.label},r.key))})}function AQ(){const[e,t]=T.useState("inbox"),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState(!1),[h,p]=T.useState(null),[v,m]=T.useState(!1),[g,j]=T.useState(rM),[S,_]=T.useState(!1),[x,O]=T.useState(null),[w,E]=T.useState(null),[M,A]=T.useState(!1),[C,k]=T.useState(null),[z,B]=T.useState(null),[Z,G]=T.useState(null),[H,W]=T.useState(!1),[Q,D]=T.useState(null),[P,$]=T.useState(aM),[U,ie]=T.useState(!1),[fe,L]=T.useState(null),F=()=>{o(null),ce.get("/email/messages").then(r).catch(o)},q=()=>{G(null),ce.get("/email/accounts").then(B).catch(G)};T.useEffect(()=>{F(),q()},[]);const de=(ae,Ke)=>{p({type:ae,text:Ke}),setTimeout(()=>p(null),6e3)},ge=async()=>{d(!0),p(null);try{await ce.post("/email/sync"),de("green","Inbox gesynchroniseerd"),F()}catch(ae){de("red",ae.message||String(ae))}finally{d(!1)}},we=()=>{j(rM),O(null),m(!0)},$e=async ae=>{ae.preventDefault(),_(!0),O(null);try{await ce.post("/email/send",g),m(!1),de("green","E-mail verzonden")}catch(Ke){O(Ke)}finally{_(!1)}},Ge=ae=>{E(null),k(null),A(!0),ce.get(`/email/messages/${ae.id}`).then(Ke=>{E(Ke),F()}).catch(k).finally(()=>A(!1))},me=()=>{E(null),k(null),A(!1)},Te=()=>{D(null),$(aM),L(null),W(!0)},Me=ae=>{D(ae),$({email:ae.email||"",name:ae.name||"",imap_host:ae.imap_host||"",imap_port:ae.imap_port||993,imap_secure:!!ae.imap_secure,imap_user:ae.imap_user||"",imap_pass:"",smtp_host:ae.smtp_host||"",smtp_port:ae.smtp_port||587,smtp_secure:!!ae.smtp_secure,smtp_user:ae.smtp_user||"",smtp_pass:""}),L(null),W(!0)},he=async ae=>{ae.preventDefault(),ie(!0),L(null);try{await ce.post("/email/accounts",{...P,id:Q?Q.id:void 0}),W(!1),q()}catch(Ke){L(Ke)}finally{ie(!1)}},st=M||!!w||!!C;return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"E-mail"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Postvak IN en e-mailaccounts"})]}),e==="inbox"?u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs(pe,{variant:"secondary",onClick:ge,loading:c,children:[u.jsx(Q8,{className:"w-4 h-4"})," Synchroniseren"]}),u.jsxs(pe,{onClick:we,children:[u.jsx(n2,{className:"w-4 h-4"})," Nieuwe e-mail"]})]}):u.jsxs(pe,{onClick:Te,children:[u.jsx(n2,{className:"w-4 h-4"})," Account toevoegen"]})]}),h&&u.jsx("div",{className:`rounded-lg px-4 py-3 text-[13px] border ${h.type==="green"?"bg-green/10 border-green/30 text-green":"bg-red/10 border-red/30 text-red"}`,children:h.text}),u.jsx(OQ,{tabs:[{key:"inbox",label:"Postvak IN"},{key:"accounts",label:"Accounts"}],active:e,onChange:t}),e==="inbox"&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:l?u.jsx(Oe,{error:l,onRetry:F}):n?u.jsx(Dt,{columns:[{label:"",className:"w-6",render:ae=>ae.seen?null:u.jsx("span",{className:"block w-2 h-2 rounded-full bg-blue",title:"Ongelezen"})},{label:"Van",render:ae=>u.jsx("span",{className:ae.seen?"":"font-semibold",children:ae.from_name||ae.from_addr||"-"})},{label:"Onderwerp",render:ae=>u.jsx("button",{onClick:()=>Ge(ae),className:`text-left text-accent hover:underline ${ae.seen?"":"font-semibold"}`,children:ae.subject||"(geen onderwerp)"})},{label:"Datum",render:ae=>u.jsx("span",{className:"text-muted",children:ye.datetime(ae.date)})},{label:"Account",render:ae=>u.jsx("span",{className:"text-muted",children:ae.account_email})}],rows:n,keyFn:ae=>ae.id,empty:u.jsxs("div",{className:"flex flex-col items-center py-10 text-muted",children:[u.jsx(T8,{className:"w-8 h-8 mb-2"}),u.jsx("div",{className:"text-[13px]",children:"Geen berichten — synchroniseer je inbox"})]})}):u.jsx(Ze,{})})}),e==="accounts"&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:Z?u.jsx(Oe,{error:Z,onRetry:q}):z?u.jsx(Dt,{columns:[{label:"Email",render:ae=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(Nd,{className:"w-3.5 h-3.5 text-muted"}),ae.email]})},{label:"IMAP",render:ae=>u.jsxs("span",{className:"text-muted",children:[ae.imap_host,":",ae.imap_port]})},{label:"SMTP",render:ae=>u.jsxs("span",{className:"text-muted",children:[ae.smtp_host,":",ae.smtp_port]})},{label:"Actief",render:ae=>u.jsx(nt,{color:ae.active?"green":"muted",children:ae.active?"Actief":"Inactief"})}],rows:z,keyFn:ae=>ae.id,onRowClick:Me,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen accounts geconfigureerd"})}):u.jsx(Ze,{})})}),u.jsx(_t,{open:v,onClose:()=>m(!1),title:"Nieuwe e-mail",children:u.jsxs("form",{onSubmit:$e,className:"space-y-3",children:[x&&u.jsx(Oe,{error:x}),u.jsx(te,{label:"Aan *",children:u.jsx("input",{className:X,value:g.to,onChange:ae=>j({...g,to:ae.target.value}),required:!0})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"CC",children:u.jsx("input",{className:X,value:g.cc,onChange:ae=>j({...g,cc:ae.target.value})})}),u.jsx(te,{label:"BCC",children:u.jsx("input",{className:X,value:g.bcc,onChange:ae=>j({...g,bcc:ae.target.value})})})]}),u.jsx(te,{label:"Onderwerp *",children:u.jsx("input",{className:X,value:g.subject,onChange:ae=>j({...g,subject:ae.target.value}),required:!0})}),u.jsx(te,{label:"Bericht",children:u.jsx("textarea",{rows:8,className:X,value:g.text,onChange:ae=>j({...g,text:ae.target.value})})}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>m(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:S,children:"Verzenden"})]})]})}),u.jsxs(_t,{open:st,onClose:me,title:w?w.subject||"(geen onderwerp)":"Bericht laden",wide:!0,children:[M&&u.jsx(Ze,{}),C&&u.jsx(Oe,{error:C}),w&&u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"text-[12px] text-muted space-y-0.5",children:[u.jsxs("div",{children:["Van: ",u.jsx("span",{className:"text-text",children:w.from_name||w.from_addr})]}),u.jsxs("div",{children:["Datum: ",u.jsx("span",{className:"text-text",children:ye.datetime(w.date)})]}),u.jsxs("div",{children:["Account: ",u.jsx("span",{className:"text-text",children:w.account_email})]})]}),u.jsx("div",{className:"border-t border-border-soft pt-3 text-[13px] whitespace-pre-wrap max-h-[50vh] overflow-y-auto",children:w.body_text||"(geen inhoud)"}),u.jsx("div",{className:"flex justify-end pt-1",children:u.jsx(pe,{variant:"secondary",onClick:me,children:"Sluiten"})})]})]}),u.jsx(_t,{open:H,onClose:()=>W(!1),title:Q?"Account bewerken":"Account toevoegen",wide:!0,children:u.jsxs("form",{onSubmit:he,className:"space-y-3",children:[fe&&u.jsx(Oe,{error:fe}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"E-mailadres *",children:u.jsx("input",{type:"email",className:X,value:P.email,onChange:ae=>$({...P,email:ae.target.value}),required:!0})}),u.jsx(te,{label:"Weergavenaam",children:u.jsx("input",{className:X,value:P.name,onChange:ae=>$({...P,name:ae.target.value})})})]}),u.jsx("div",{className:"text-[12px] text-muted font-medium pt-1",children:"IMAP (inkomend)"}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"IMAP host *",className:"col-span-2",children:u.jsx("input",{className:X,value:P.imap_host,onChange:ae=>$({...P,imap_host:ae.target.value}),required:!0})}),u.jsx(te,{label:"Poort",children:u.jsx("input",{type:"number",className:X,value:P.imap_port,onChange:ae=>$({...P,imap_port:ae.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"IMAP gebruiker *",children:u.jsx("input",{className:X,value:P.imap_user,onChange:ae=>$({...P,imap_user:ae.target.value}),required:!0})}),u.jsx(te,{label:"IMAP wachtwoord *",children:u.jsx("input",{type:"password",className:X,value:P.imap_pass,onChange:ae=>$({...P,imap_pass:ae.target.value}),placeholder:Q?"Leeg laten om te behouden":"",required:!Q})})]}),u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:P.imap_secure,onChange:ae=>$({...P,imap_secure:ae.target.checked}),className:"accent-[#00d4ff]"}),"IMAP via SSL/TLS"]}),u.jsx("div",{className:"text-[12px] text-muted font-medium pt-1",children:"SMTP (uitgaand)"}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"SMTP host",className:"col-span-2",children:u.jsx("input",{className:X,value:P.smtp_host,onChange:ae=>$({...P,smtp_host:ae.target.value}),placeholder:"Standaard = IMAP host"})}),u.jsx(te,{label:"Poort",children:u.jsx("input",{type:"number",className:X,value:P.smtp_port,onChange:ae=>$({...P,smtp_port:ae.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"SMTP gebruiker",children:u.jsx("input",{className:X,value:P.smtp_user,onChange:ae=>$({...P,smtp_user:ae.target.value}),placeholder:"Standaard = IMAP gebruiker"})}),u.jsx(te,{label:"SMTP wachtwoord",children:u.jsx("input",{type:"password",className:X,value:P.smtp_pass,onChange:ae=>$({...P,smtp_pass:ae.target.value}),placeholder:Q?"Leeg laten om te behouden":"Standaard = IMAP wachtwoord"})})]}),u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:P.smtp_secure,onChange:ae=>$({...P,smtp_secure:ae.target.checked}),className:"accent-[#00d4ff]"}),"SMTP via SSL/TLS"]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>W(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:U,children:"Opslaan"})]})]})})]})}const $1={planning:"Planning",in_progress:"Bezig",completed:"Afgerond",on_hold:"On hold"},_d={low:"Laag",medium:"Gemiddeld",high:"Hoog",critical:"Kritiek"},iM={name:"",client_id:"",description:"",status:"planning",priority:"medium",budget:"",start_date:"",end_date:""};function OP({open:e,onClose:t,clients:n,project:r,onSaved:l}){const[o,c]=T.useState(iM),[d,h]=T.useState(!1),[p,v]=T.useState(null);T.useEffect(()=>{e&&(v(null),c(r?{name:r.name||"",client_id:r.client_id||"",description:r.description||"",status:r.status||"planning",priority:r.priority||"medium",budget:r.budget??"",start_date:r.start_date||"",end_date:r.end_date||""}:iM))},[e,r]);const m=(j,S)=>c(_=>({..._,[j]:S})),g=async()=>{if(!o.name.trim())return v("Projectnaam is verplicht");h(!0),v(null);try{const j={...o,client_id:o.client_id||null,budget:o.budget===""?null:Number(o.budget),start_date:o.start_date||null,end_date:o.end_date||null};r?await ce.put(`/projects/${r.id}`,j):await ce.post("/projects",j),t(),l==null||l()}catch(j){v(j.message)}finally{h(!1)}};return u.jsxs(_t,{open:e,onClose:t,title:r?"Project bewerken":"Nieuw project",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:o.name,onChange:j=>m("name",j.target.value),placeholder:"Bijv. migratie naar Azure"})}),u.jsx(te,{label:"Cliënt",children:u.jsxs("select",{className:X,value:o.client_id,onChange:j=>m("client_id",j.target.value),children:[u.jsx("option",{value:"",children:"— Geen —"}),n.map(j=>u.jsx("option",{value:j.id,children:j.name},j.id))]})}),u.jsx(te,{label:"Beschrijving",children:u.jsx("textarea",{className:X,rows:3,value:o.description,onChange:j=>m("description",j.target.value)})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Status",children:u.jsx("select",{className:X,value:o.status,onChange:j=>m("status",j.target.value),children:Object.entries($1).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})}),u.jsx(te,{label:"Prioriteit",children:u.jsx("select",{className:X,value:o.priority,onChange:j=>m("priority",j.target.value),children:Object.entries(_d).map(([j,S])=>u.jsx("option",{value:j,children:S},j))})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Budget (€)",children:u.jsx("input",{type:"number",min:"0",step:"0.01",className:X,value:o.budget,onChange:j=>m("budget",j.target.value)})}),u.jsx(te,{label:"Startdatum",children:u.jsx("input",{type:"date",className:X,value:o.start_date,onChange:j=>m("start_date",j.target.value)})}),u.jsx(te,{label:"Einddatum",children:u.jsx("input",{type:"date",className:X,value:o.end_date,onChange:j=>m("end_date",j.target.value)})})]})]}),p&&u.jsx("div",{className:"text-red text-[12px] mt-3",children:p}),u.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[u.jsx(pe,{variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{onClick:g,loading:d,children:r?"Opslaan":"Aanmaken"})]})]})}function NQ(){const[e,t]=T.useState(null),[n,r]=T.useState([]),[l,o]=T.useState(null),[c,d]=T.useState(!1),h=()=>{o(null),ce.get("/projects").then(t).catch(o)};return T.useEffect(h,[]),T.useEffect(()=>{ce.get("/clients").then(r).catch(()=>{})},[]),l?u.jsx(Oe,{error:l,onRetry:h}):e?u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Projecten"}),u.jsxs("p",{className:"text-[13px] text-muted mt-0.5",children:[e.length," project",e.length===1?"":"en"]})]}),u.jsxs(pe,{onClick:()=>d(!0),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw project"]})]}),e.length===0?u.jsx(Ae,{children:u.jsx(Ar,{icon:XM,title:"Nog geen projecten",hint:"Maak je eerste project aan om taken en milestones te beheren.",action:u.jsxs(pe,{onClick:()=>d(!0),children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw project"]})})}):u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(p=>{const v=p.task_count>0?Math.round(p.done_count/p.task_count*100):0;return u.jsxs(Ae,{className:"card-hover",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx(ft,{to:`/projects/${p.id}`,className:"font-semibold text-[14px] hover:text-accent transition-colors block truncate",children:p.name}),u.jsx("div",{className:"text-[12px] text-muted mt-0.5",children:p.client_name||"Geen cliënt"})]}),u.jsx(Tt,{status:p.status,labels:$1})]}),u.jsxs("div",{className:"mt-4",children:[u.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted mb-1",children:[u.jsx("span",{children:"Voortgang"}),u.jsxs("span",{children:[p.done_count,"/",p.task_count," taken · ",v,"%"]})]}),u.jsx("div",{className:"h-1.5 rounded-full bg-bg-soft overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${v}%`}})})]}),u.jsxs("div",{className:"flex items-center justify-between mt-4 text-[12px] text-muted",children:[u.jsxs("span",{children:[ye.date(p.start_date)," — ",ye.date(p.end_date)]}),p.budget!=null&&u.jsx("span",{className:"font-medium text-text",children:ye.euro(p.budget)})]})]},p.id)})}),u.jsx(OP,{open:c,onClose:()=>d(!1),clients:n,onSaved:h})]}):u.jsx(Ze,{})}const EQ=[{key:"todo",label:"Te doen"},{key:"in_progress",label:"Bezig"},{key:"done",label:"Klaar"}],mf=["todo","in_progress","done"],TQ={pending:"Open",done:"Behaald",completed:"Behaald",missed:"Gemist"},Ub={title:"",description:"",assignee_id:"",priority:"medium",due_date:""};function CQ({task:e,onMove:t,onProgress:n,onDelete:r}){const l=mf.indexOf(e.status);return u.jsxs("div",{className:"bg-bg-soft border border-border-soft rounded-lg p-3 space-y-2",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsx("div",{className:"text-[13px] font-medium leading-snug",children:e.title}),u.jsx("button",{onClick:()=>r(e),className:"p-1 rounded text-muted hover:text-red hover:bg-red/10 shrink-0",title:"Taak verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx(nt,{color:M0[e.priority]||"muted",children:_d[e.priority]||e.priority}),e.assignee_name&&u.jsx("span",{className:"text-[11px] text-muted",children:e.assignee_name}),e.due_date&&u.jsxs("span",{className:"text-[11px] text-muted",children:["· ",ye.date(e.due_date)]})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted mb-1",children:[u.jsx("span",{children:"Voortgang"}),u.jsxs("span",{children:[e.progress||0,"%"]})]}),u.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:e.progress||0,onChange:o=>n(e,Number(o.target.value)),className:"w-full h-1.5 accent-[#00d4ff] cursor-pointer"})]}),u.jsxs("div",{className:"flex items-center justify-between pt-1",children:[u.jsx("button",{disabled:l<=0,onClick:()=>t(e,mf[l-1]),className:"p-1 rounded text-muted hover:text-text hover:bg-card disabled:opacity-30 disabled:cursor-not-allowed",title:"Naar vorige status",children:u.jsx(VM,{className:"w-4 h-4"})}),u.jsx(Tt,{status:e.status,labels:{todo:"Te doen",in_progress:"Bezig",done:"Klaar"}}),u.jsx("button",{disabled:l>=mf.length-1,onClick:()=>t(e,mf[l+1]),className:"p-1 rounded text-muted hover:text-text hover:bg-card disabled:opacity-30 disabled:cursor-not-allowed",title:"Naar volgende status",children:u.jsx(FM,{className:"w-4 h-4"})})]})]})}function MQ(){const{id:e}=_u(),t=mr(),[n,r]=T.useState(null),[l,o]=T.useState([]),[c,d]=T.useState([]),[h,p]=T.useState(null),[v,m]=T.useState(!1),[g,j]=T.useState(!1),[S,_]=T.useState(Ub),[x,O]=T.useState(!1),[w,E]=T.useState(null),M=()=>{p(null),ce.get(`/projects/${e}`).then(r).catch(p)};if(T.useEffect(M,[e]),T.useEffect(()=>{ce.get("/clients").then(o).catch(()=>{}),ce.get("/users").then(d).catch(()=>{})},[]),h)return u.jsx(Oe,{error:h,onRetry:M});if(!n)return u.jsx(Ze,{});const{project:A,tasks:C,milestones:k}=n,z=C.filter(D=>D.status==="done").length,B=C.length>0?Math.round(z/C.length*100):0,Z=async(D,P)=>{try{await ce.post(`/projects/tasks/${D.id}/status`,{status:P}),M()}catch($){alert($.message)}},G=async(D,P)=>{r($=>({...$,tasks:$.tasks.map(U=>U.id===D.id?{...U,progress:P}:U)}));try{await ce.post(`/projects/tasks/${D.id}/progress`,{progress:P})}catch($){alert($.message),M()}},H=async D=>{if(window.confirm(`Taak "${D.title}" verwijderen?`))try{await ce.del(`/projects/tasks/${D.id}`),M()}catch(P){alert(P.message)}},W=async()=>{if(window.confirm(`Project "${A.name}" en alle bijbehorende taken verwijderen?`))try{await ce.del(`/projects/${A.id}`),t("/projects")}catch(D){alert(D.message)}},Q=async()=>{if(!S.title.trim())return E("Titel is verplicht");O(!0),E(null);try{await ce.post(`/projects/${e}/tasks`,{...S,assignee_id:S.assignee_id||null,due_date:S.due_date||null}),j(!1),_(Ub),M()}catch(D){E(D.message)}finally{O(!1)}};return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsxs(ft,{to:"/projects",className:"inline-flex items-center gap-1 text-[12px] text-muted hover:text-accent mb-2",children:[u.jsx(wu,{className:"w-3.5 h-3.5"})," Terug naar projecten"]}),u.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:A.name}),u.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[A.client_id?u.jsx(ft,{to:`/clients/${A.client_id}`,className:"text-[13px] text-accent hover:underline",children:A.client_name}):u.jsx("span",{className:"text-[13px] text-muted",children:"Geen cliënt"}),u.jsx(Tt,{status:A.status,labels:$1}),u.jsx(nt,{color:M0[A.priority]||"muted",children:_d[A.priority]||A.priority}),u.jsxs("span",{className:"text-[12px] text-muted",children:[ye.date(A.start_date)," — ",ye.date(A.end_date)]}),A.budget!=null&&u.jsx("span",{className:"text-[12px] font-medium",children:ye.euro(A.budget)})]}),A.description&&u.jsx("p",{className:"text-[13px] text-muted mt-2 max-w-2xl",children:A.description})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsxs(pe,{variant:"secondary",size:"sm",onClick:()=>m(!0),children:[u.jsx(Ya,{className:"w-3.5 h-3.5"})," Bewerken"]}),u.jsxs(pe,{variant:"danger",size:"sm",onClick:W,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})]})]}),u.jsxs("div",{className:"mt-4",children:[u.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted mb-1",children:[u.jsx("span",{children:"Voortgang project"}),u.jsxs("span",{children:[z,"/",C.length," taken klaar · ",B,"%"]})]}),u.jsx("div",{className:"h-2 rounded-full bg-bg-soft overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent rounded-full transition-all",style:{width:`${B}%`}})})]})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("h2",{className:"text-[15px] font-semibold",children:"Taken"}),u.jsxs(pe,{size:"sm",onClick:()=>{_(Ub),E(null),j(!0)},children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Taak toevoegen"]})]}),u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:EQ.map(D=>{const P=C.filter($=>$.status===D.key);return u.jsxs("div",{className:"bg-card border border-border-soft rounded-xl p-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-1 pb-2",children:[u.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-wide text-muted",children:D.label}),u.jsx("span",{className:"text-[11px] text-muted",children:P.length})]}),u.jsx("div",{className:"space-y-2",children:P.length===0?u.jsx("div",{className:"text-[12px] text-muted text-center py-6",children:"Geen taken"}):P.map($=>u.jsx(CQ,{task:$,onMove:Z,onProgress:G,onDelete:H},$.id))})]},D.key)})})]}),k.length>0&&u.jsx(Ae,{title:"Milestones",subtitle:`${k.length} mijlpaal${k.length===1?"":"en"}`,children:u.jsx("div",{className:"space-y-2",children:k.map(D=>u.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover",children:[u.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[u.jsx(w8,{className:"w-4 h-4 text-accent shrink-0"}),u.jsx("span",{className:"text-[13px] font-medium truncate",children:D.name})]}),u.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[u.jsx("span",{className:"text-[12px] text-muted",children:ye.date(D.target_date)}),u.jsx(Tt,{status:D.status,labels:TQ})]})]},D.id))})}),u.jsx(OP,{open:v,onClose:()=>m(!1),clients:l,project:A,onSaved:M}),u.jsxs(_t,{open:g,onClose:()=>j(!1),title:"Taak toevoegen",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsx(te,{label:"Titel *",children:u.jsx("input",{className:X,value:S.title,onChange:D=>_(P=>({...P,title:D.target.value})),placeholder:"Bijv. inventarisatie uitvoeren"})}),u.jsx(te,{label:"Beschrijving",children:u.jsx("textarea",{className:X,rows:3,value:S.description,onChange:D=>_(P=>({...P,description:D.target.value}))})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Toegewezen aan",children:u.jsxs("select",{className:X,value:S.assignee_id,onChange:D=>_(P=>({...P,assignee_id:D.target.value})),children:[u.jsx("option",{value:"",children:"— Niemand —"}),c.map(D=>u.jsx("option",{value:D.id,children:D.username},D.id))]})}),u.jsx(te,{label:"Prioriteit",children:u.jsx("select",{className:X,value:S.priority,onChange:D=>_(P=>({...P,priority:D.target.value})),children:Object.entries(_d).map(([D,P])=>u.jsx("option",{value:D,children:P},D))})})]}),u.jsx(te,{label:"Deadline",children:u.jsx("input",{type:"date",className:X,value:S.due_date,onChange:D=>_(P=>({...P,due_date:D.target.value}))})})]}),w&&u.jsx("div",{className:"text-red text-[12px] mt-3",children:w}),u.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[u.jsx(pe,{variant:"secondary",onClick:()=>j(!1),children:"Annuleren"}),u.jsx(pe,{onClick:Q,loading:x,children:"Toevoegen"})]})]})]})}const lM=()=>new Date().toISOString().split("T")[0],oM={client_id:"",engagement_id:"",date:"",hours:"",description:"",billable:!0,hourly_rate:150};function kQ({open:e,onClose:t,entry:n,clients:r,engagements:l,onSaved:o}){const[c,d]=T.useState(oM),[h,p]=T.useState(!1),[v,m]=T.useState(null);T.useEffect(()=>{e&&(m(null),d(n?{client_id:n.client_id||"",engagement_id:n.engagement_id||"",date:n.date||lM(),hours:n.hours??"",description:n.description||"",billable:!!n.billable,hourly_rate:n.hourly_rate??150}:{...oM,date:lM()}))},[e,n]);const g=(_,x)=>d(O=>({...O,[_]:x})),j=c.client_id?l.filter(_=>String(_.client_id)===String(c.client_id)):[],S=async _=>{_.preventDefault(),p(!0),m(null);try{const x={...c,client_id:c.client_id||null,engagement_id:c.engagement_id||null};n?await ce.put(`/time/${n.id}`,x):await ce.post("/time",x),o(),t()}catch(x){m(x)}finally{p(!1)}};return u.jsx(_t,{open:e,onClose:t,title:n?"Uren bewerken":"Uren toevoegen",children:u.jsxs("form",{onSubmit:S,className:"space-y-4",children:[u.jsx(Oe,{error:v}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Cliënt",children:u.jsxs("select",{className:X,value:c.client_id,onChange:_=>d(x=>({...x,client_id:_.target.value,engagement_id:""})),children:[u.jsx("option",{value:"",children:"— Geen —"}),r.map(_=>u.jsx("option",{value:_.id,children:_.name},_.id))]})}),u.jsx(te,{label:"Engagement",children:u.jsxs("select",{className:`${X} disabled:opacity-50`,value:c.engagement_id,onChange:_=>g("engagement_id",_.target.value),disabled:!c.client_id,children:[u.jsx("option",{value:"",children:"— Geen —"}),j.map(_=>u.jsxs("option",{value:_.id,children:[_.title," — ",_.client_name]},_.id))]})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Datum *",children:u.jsx("input",{type:"date",required:!0,className:X,value:c.date,onChange:_=>g("date",_.target.value)})}),u.jsx(te,{label:"Uren *",children:u.jsx("input",{type:"number",required:!0,step:"0.25",min:"0",className:X,value:c.hours,onChange:_=>g("hours",_.target.value),placeholder:"bijv. 2.5"})})]}),u.jsx(te,{label:"Omschrijving",children:u.jsx("textarea",{className:X,rows:2,value:c.description,onChange:_=>g("description",_.target.value),placeholder:"Wat heb je gedaan?"})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[u.jsx(te,{label:"Uurtarief",children:u.jsx("input",{type:"number",step:"0.01",min:"0",className:X,value:c.hourly_rate,onChange:_=>g("hourly_rate",_.target.value)})}),u.jsxs("label",{className:"flex items-center gap-2 pb-2 cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"w-4 h-4 accent-accent",checked:c.billable,onChange:_=>g("billable",_.target.checked)}),u.jsx("span",{className:"text-[13px]",children:"Facturabel"})]})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:h,children:n?"Opslaan":"Toevoegen"})]})]})})}function RQ({open:e,onClose:t,clients:n}){const[r,l]=T.useState({client_id:"",date_from:"",date_to:""}),[o,c]=T.useState(!1),[d,h]=T.useState(null),[p,v]=T.useState(null);T.useEffect(()=>{e&&(l({client_id:"",date_from:"",date_to:""}),h(null),v(null))},[e]);const m=(j,S)=>l(_=>({..._,[j]:S})),g=async j=>{j.preventDefault(),c(!0),h(null);try{const S=await ce.post("/time/create-invoice",{client_id:r.client_id,date_from:r.date_from||void 0,date_to:r.date_to||void 0});v(S)}catch(S){h(S)}finally{c(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Factuur maken uit uren",children:p?u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"bg-green/10 border border-green/30 rounded-lg px-4 py-3 text-[13px] text-green",children:["Factuur ",u.jsx("span",{className:"font-semibold",children:p.number})," is aangemaakt uit de facturabele uren."]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(pe,{variant:"secondary",onClick:t,children:"Sluiten"}),u.jsx(ft,{to:`/invoices/${p.id}`,children:u.jsx(pe,{children:"Bekijk factuur"})})]})]}):u.jsxs("form",{onSubmit:g,className:"space-y-4",children:[u.jsx(Oe,{error:d}),u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{required:!0,className:X,value:r.client_id,onChange:j=>m("client_id",j.target.value),children:[u.jsx("option",{value:"",children:"— Kies een cliënt —"}),n.map(j=>u.jsx("option",{value:j.id,children:j.name},j.id))]})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Van datum",children:u.jsx("input",{type:"date",className:X,value:r.date_from,onChange:j=>m("date_from",j.target.value)})}),u.jsx(te,{label:"Tot datum",children:u.jsx("input",{type:"date",className:X,value:r.date_to,onChange:j=>m("date_to",j.target.value)})})]}),u.jsx("p",{className:"text-[12px] text-muted",children:"Alle facturabele uren van deze cliënt (binnen de periode) worden op één conceptfactuur gezet."}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:o,children:"Factuur maken"})]})]})})}function PQ(){const[e,t]=T.useState(null),[n,r]=T.useState([]),[l,o]=T.useState([]),[c,d]=T.useState(null),[h,p]=T.useState({client_id:"",date_from:"",date_to:""}),[v,m]=T.useState({open:!1,entry:null}),[g,j]=T.useState(!1);T.useEffect(()=>{ce.get("/clients").then(r).catch(()=>{}),ce.get("/engagements").then(o).catch(()=>{})},[]);const S=()=>{d(null),ce.get("/time"+Ga(h)).then(t).catch(d)};T.useEffect(S,[h]);const _=T.useMemo(()=>e?e.entries.filter(w=>w.billable).reduce((w,E)=>w+E.hours*(E.hourly_rate||0),0):0,[e]),x=async w=>{if(window.confirm(`${ye.hours(w.hours)} op ${ye.date(w.date)} verwijderen?`))try{await ce.del(`/time/${w.id}`),S()}catch(E){alert(E.message)}},O=(w,E)=>p(M=>({...M,[w]:E}));return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Urenregistratie"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Registreer en factureer je gewerkte uren"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs(pe,{variant:"secondary",onClick:()=>j(!0),children:[u.jsx(E0,{className:"w-3.5 h-3.5"})," Factuur maken uit uren"]}),u.jsxs(pe,{onClick:()=>m({open:!0,entry:null}),children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Uren toevoegen"]})]})]}),c?u.jsx(Oe,{error:c,onRetry:S}):e?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[u.jsx(tn,{icon:Ba,label:"Totaal uren",value:ye.hours(e.totalHours),color:"blue"}),u.jsx(tn,{icon:Ba,label:"Facturabel",value:ye.hours(e.billableHours),color:"green"}),u.jsx(tn,{icon:Ba,label:"Niet-facturabel",value:ye.hours(e.totalHours-e.billableHours),color:"yellow"}),u.jsx(tn,{icon:m8,label:"Geschatte waarde",value:ye.euro(_),sub:"facturabele uren × tarief",color:"accent"})]}),u.jsxs(Ae,{children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-4",children:[u.jsxs("select",{className:`${X} !w-auto`,value:h.client_id,onChange:w=>O("client_id",w.target.value),children:[u.jsx("option",{value:"",children:"Alle cliënten"}),n.map(w=>u.jsx("option",{value:w.id,children:w.name},w.id))]}),u.jsx("input",{type:"date",className:`${X} !w-auto`,value:h.date_from,onChange:w=>O("date_from",w.target.value),title:"Van datum"}),u.jsx("span",{className:"text-muted text-[12px]",children:"t/m"}),u.jsx("input",{type:"date",className:`${X} !w-auto`,value:h.date_to,onChange:w=>O("date_to",w.target.value),title:"Tot datum"}),(h.client_id||h.date_from||h.date_to)&&u.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>p({client_id:"",date_from:"",date_to:""}),children:"Filters wissen"})]}),u.jsx(Dt,{columns:[{label:"Datum",render:w=>u.jsx("span",{className:"text-muted",children:ye.date(w.date)})},{label:"Cliënt",render:w=>w.client_name||"-"},{label:"Engagement",render:w=>w.engagement_title||"-"},{label:"Omschrijving",render:w=>u.jsx("span",{className:"text-muted",children:w.description||"-"})},{label:"Uren",render:w=>ye.hours(w.hours)},{label:"Tarief",render:w=>ye.euro(w.hourly_rate)},{label:"Facturabel",render:w=>w.billable?u.jsx(nt,{color:"green",children:"Ja"}):u.jsx(nt,{color:"muted",children:"Nee"})},{label:"Gebruiker",render:w=>u.jsx("span",{className:"text-muted",children:w.username||"-"})},{label:"Acties",render:w=>u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx("button",{onClick:()=>m({open:!0,entry:w}),className:"p-1.5 rounded-md text-muted hover:text-text hover:bg-bg-soft",title:"Bewerken",children:u.jsx(Ya,{className:"w-3.5 h-3.5"})}),u.jsx("button",{onClick:()=>x(w),className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-red/10",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]})}],rows:e.entries,keyFn:w=>w.id,empty:u.jsx(Ar,{icon:Ba,title:"Geen uren gevonden",hint:"Voeg je eerste tijdregistratie toe of pas de filters aan."})})]})]}):u.jsx(Ze,{}),u.jsx(kQ,{open:v.open,entry:v.entry,clients:n,engagements:l,onClose:()=>m({open:!1,entry:null}),onSaved:S}),u.jsx(RQ,{open:g,onClose:()=>{j(!1),S()},clients:n})]})}const DQ=()=>new Date().toISOString().split("T")[0],$Q={draft:"Concept",sent:"Verzonden",paid:"Betaald",overdue:"Verlopen",cancelled:"Geannuleerd"},Ib={description:"",quantity:1,unit_price:""};function qQ({open:e,onClose:t,clients:n,onSaved:r}){const[l,o]=T.useState({client_id:"",date:"",due_date:"",notes:""}),[c,d]=T.useState([{...Ib}]),[h,p]=T.useState(!1),[v,m]=T.useState(null);T.useEffect(()=>{e&&(o({client_id:"",date:DQ(),due_date:"",notes:""}),d([{...Ib}]),m(null))},[e]);const g=(M,A)=>o(C=>({...C,[M]:A})),j=(M,A,C)=>d(k=>k.map((z,B)=>B===M?{...z,[A]:C}:z)),S=()=>d(M=>[...M,{...Ib}]),_=M=>d(A=>A.filter((C,k)=>k!==M)),x=T.useMemo(()=>c.reduce((M,A)=>M+(parseFloat(A.quantity)||0)*(parseFloat(A.unit_price)||0),0),[c]),O=x*.21,w=x+O,E=async M=>{M.preventDefault(),p(!0),m(null);try{await ce.post("/invoices",{client_id:l.client_id,date:l.date,due_date:l.due_date,notes:l.notes,items:c.filter(A=>A.description.trim()),subtotal:x,tax:O}),r(),t()}catch(A){m(A)}finally{p(!1)}};return u.jsx(_t,{open:e,onClose:t,title:"Nieuwe factuur",wide:!0,children:u.jsxs("form",{onSubmit:E,className:"space-y-4",children:[u.jsx(Oe,{error:v}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{required:!0,className:X,value:l.client_id,onChange:M=>g("client_id",M.target.value),children:[u.jsx("option",{value:"",children:"— Kies een cliënt —"}),n.map(M=>u.jsx("option",{value:M.id,children:M.name},M.id))]})}),u.jsx(te,{label:"Factuurdatum",children:u.jsx("input",{type:"date",className:X,value:l.date,onChange:M=>g("date",M.target.value)})}),u.jsx(te,{label:"Vervaldatum",children:u.jsx("input",{type:"date",className:X,value:l.due_date,onChange:M=>g("due_date",M.target.value)})})]}),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-[12px] text-muted",children:"Factuurregels"}),u.jsxs(pe,{type:"button",variant:"secondary",size:"sm",onClick:S,children:[u.jsx(qt,{className:"w-3 h-3"})," Regel toevoegen"]})]}),u.jsx("div",{className:"space-y-2",children:c.map((M,A)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{className:`${X} flex-1`,placeholder:"Omschrijving",value:M.description,onChange:C=>j(A,"description",C.target.value)}),u.jsx("input",{type:"number",min:"0",step:"0.25",className:`${X} !w-24`,placeholder:"Aantal",value:M.quantity,onChange:C=>j(A,"quantity",C.target.value)}),u.jsx("input",{type:"number",min:"0",step:"0.01",className:`${X} !w-28`,placeholder:"Prijs",value:M.unit_price,onChange:C=>j(A,"unit_price",C.target.value)}),u.jsx("span",{className:"text-[12px] text-muted w-24 text-right shrink-0",children:ye.euro((parseFloat(M.quantity)||0)*(parseFloat(M.unit_price)||0))}),u.jsx("button",{type:"button",onClick:()=>_(A),disabled:c.length===1,className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-red/10 disabled:opacity-30 disabled:cursor-not-allowed shrink-0",title:"Regel verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]},A))})]}),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"w-64 space-y-1.5 text-[13px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-muted",children:"Subtotaal"}),u.jsx("span",{children:ye.euro(x)})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-muted",children:"BTW (21%)"}),u.jsx("span",{children:ye.euro(O)})]}),u.jsxs("div",{className:"flex justify-between font-semibold border-t border-border-soft pt-1.5",children:[u.jsx("span",{children:"Totaal"}),u.jsx("span",{children:ye.euro(w)})]})]})}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{className:X,rows:2,value:l.notes,onChange:M=>g("notes",M.target.value),placeholder:"Bijv. betalingsvoorwaarden"})}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{type:"button",variant:"secondary",onClick:t,children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:h,children:"Factuur aanmaken"})]})]})})}function zQ(){const[e,t]=T.useState(null),[n,r]=T.useState([]),[l,o]=T.useState(null),[c,d]=T.useState(!1),h=mr();T.useEffect(()=>{ce.get("/clients").then(r).catch(()=>{})},[]);const p=()=>{o(null),ce.get("/invoices").then(t).catch(o)};return T.useEffect(p,[]),u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Facturen"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Beheer je facturatie en betalingen"})]}),u.jsxs(pe,{onClick:()=>d(!0),children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Nieuwe factuur"]})]}),l?u.jsx(Oe,{error:l,onRetry:p}):e?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[u.jsx(tn,{icon:zs,label:"Openstaand",value:ye.euro(e.totalOutstanding),color:"yellow"}),u.jsx(tn,{icon:Td,label:"Betaald",value:ye.euro(e.totalPaid),color:"green"}),u.jsx(tn,{icon:E0,label:"Totaal facturen",value:e.invoices.length,color:"accent"})]}),u.jsx(Ae,{children:u.jsx(Dt,{columns:[{label:"Nummer",render:v=>u.jsx(ft,{to:`/invoices/${v.id}`,onClick:m=>m.stopPropagation(),className:"font-medium text-accent hover:underline",children:v.number})},{label:"Cliënt",key:"client_name"},{label:"Datum",render:v=>u.jsx("span",{className:"text-muted",children:ye.date(v.date)})},{label:"Vervaldatum",render:v=>u.jsx("span",{className:"text-muted",children:v.due_date?ye.date(v.due_date):"-"})},{label:"Totaal",render:v=>ye.euro(v.total)},{label:"Status",render:v=>u.jsx(Tt,{status:v.status,labels:$Q})}],rows:e.invoices,keyFn:v=>v.id,onRowClick:v=>h(`/invoices/${v.id}`),empty:u.jsx(Ar,{icon:zs,title:"Nog geen facturen",hint:"Maak je eerste factuur aan of genereer er een uit je uren."})})})]}):u.jsx(Ze,{}),u.jsx(qQ,{open:c,onClose:()=>d(!1),clients:n,onSaved:p})]})}const sM={draft:"Concept",sent:"Verzonden",paid:"Betaald",overdue:"Verlopen",cancelled:"Geannuleerd"};function LQ(){const{id:e}=_u(),t=mr(),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState(null),[h,p]=T.useState(!1),[v,m]=T.useState(!1),g=()=>{o(null),ce.get(`/invoices/${e}`).then(r).catch(o)};T.useEffect(g,[e]);const j=async w=>{m(!0),d(null);try{await ce.post(`/invoices/${e}/status`,{status:w}),g()}catch(E){d({type:"error",msg:E.message})}finally{m(!1)}},S=async()=>{if(window.confirm("Factuur per e-mail versturen naar de cliënt?")){p(!0),d(null);try{await ce.post(`/invoices/${e}/send-email`),d({type:"success",msg:"Factuur is succesvol per e-mail verstuurd."}),g()}catch(w){d({type:"error",msg:w.message})}finally{p(!1)}}},_=async()=>{if(window.confirm(`Factuur ${n.invoice.number} definitief verwijderen?`))try{await ce.del(`/invoices/${e}`),t("/invoices")}catch(w){d({type:"error",msg:w.message})}};if(l)return u.jsx(Oe,{error:l,onRetry:g});if(!n)return u.jsx(Ze,{});const{invoice:x,items:O}=n;return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(ft,{to:"/invoices",children:u.jsxs(pe,{variant:"secondary",size:"sm",children:[u.jsx(wu,{className:"w-3.5 h-3.5"})," Terug"]})}),u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:x.number}),u.jsx(Tt,{status:x.status,labels:sM})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx("select",{className:"bg-bg-soft border border-border rounded-lg px-3 py-2 text-[13px] focus:outline-none focus:border-accent/60 disabled:opacity-50",value:x.status,disabled:v,onChange:w=>j(w.target.value),children:Object.entries(sM).map(([w,E])=>u.jsx("option",{value:w,children:E},w))}),u.jsxs(pe,{variant:"secondary",onClick:S,loading:h,children:[u.jsx(Nd,{className:"w-3.5 h-3.5"})," E-mail versturen"]}),u.jsxs(pe,{variant:"danger",onClick:_,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})]})]}),c&&u.jsx("div",{className:`rounded-lg px-4 py-3 text-[13px] border ${c.type==="success"?"bg-green/10 border-green/30 text-green":"bg-red/10 border-red/30 text-red"}`,children:c.msg}),u.jsx(Ae,{padding:!1,className:"max-w-3xl",children:u.jsxs("div",{className:"p-6 space-y-6",children:[u.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted mb-1",children:"Factuur voor"}),u.jsx("div",{className:"text-[15px] font-semibold",children:x.client_name}),u.jsxs("div",{className:"text-[12px] text-muted mt-1 space-y-0.5",children:[x.contact_name&&u.jsx("div",{children:x.contact_name}),x.contact_email&&u.jsx("div",{children:x.contact_email}),x.website&&u.jsx("div",{children:x.website})]})]}),u.jsxs("div",{className:"text-right text-[13px] space-y-1",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-muted",children:"Factuurnummer: "}),u.jsx("span",{className:"font-medium",children:x.number})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-muted",children:"Factuurdatum: "}),u.jsx("span",{children:ye.date(x.date)})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-muted",children:"Vervaldatum: "}),u.jsx("span",{children:x.due_date?ye.date(x.due_date):"-"})]})]})]}),u.jsx("div",{className:"overflow-x-auto",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"text-left text-muted border-b border-border-soft",children:[u.jsx("th",{className:"pb-2 pr-4 font-medium text-[12px]",children:"Omschrijving"}),u.jsx("th",{className:"pb-2 pr-4 font-medium text-[12px] text-right",children:"Aantal"}),u.jsx("th",{className:"pb-2 pr-4 font-medium text-[12px] text-right",children:"Tarief"}),u.jsx("th",{className:"pb-2 font-medium text-[12px] text-right",children:"Totaal"})]})}),u.jsxs("tbody",{children:[O.map(w=>u.jsxs("tr",{className:"border-b border-border-soft/50",children:[u.jsx("td",{className:"py-2.5 pr-4",children:w.description}),u.jsx("td",{className:"py-2.5 pr-4 text-right text-muted",children:(w.quantity||0).toLocaleString("nl-NL")}),u.jsx("td",{className:"py-2.5 pr-4 text-right text-muted",children:ye.euro(w.unit_price)}),u.jsx("td",{className:"py-2.5 text-right",children:ye.euro(w.total)})]},w.id)),O.length===0&&u.jsx("tr",{children:u.jsx("td",{colSpan:4,className:"py-6 text-center text-muted",children:"Geen factuurregels"})})]})]})}),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"w-64 space-y-1.5 text-[13px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-muted",children:"Subtotaal"}),u.jsx("span",{children:ye.euro(x.subtotal)})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-muted",children:"BTW"}),u.jsx("span",{children:ye.euro(x.tax)})]}),u.jsxs("div",{className:"flex justify-between font-bold text-[15px] border-t border-border-soft pt-1.5",children:[u.jsx("span",{children:"Totaal"}),u.jsx("span",{children:ye.euro(x.total)})]})]})}),x.notes&&u.jsxs("div",{className:"border-t border-border-soft pt-4",children:[u.jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted mb-1",children:"Notities"}),u.jsx("div",{className:"text-[13px] whitespace-pre-wrap",children:x.notes})]})]})})]})}const uM={contentStyle:{backgroundColor:"#131a2a",border:"1px solid #1f2a44",borderRadius:8,fontSize:12},labelStyle:{color:"#8b9bb8"}},xf=new Date().getFullYear(),BQ=[xf-2,xf-1,xf];function UQ(){const[e,t]=T.useState(xf),[n,r]=T.useState(null),[l,o]=T.useState(null),c=()=>{o(null),ce.get("/finance"+Ga({year:e})).then(r).catch(o)};return T.useEffect(c,[e]),u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Financiën"}),u.jsxs("p",{className:"text-[13px] text-muted mt-0.5",children:["Uren en omzet over ",(n==null?void 0:n.year)??e]})]}),u.jsx("select",{className:"bg-bg-soft border border-border rounded-lg px-3 py-2 text-[13px] focus:outline-none focus:border-accent/60",value:e,onChange:d=>t(parseInt(d.target.value)),children:BQ.map(d=>u.jsx("option",{value:d,children:d},d))})]}),l?u.jsx(Oe,{error:l,onRetry:c}):n?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[u.jsx(tn,{icon:Ba,label:"Uren dit jaar",value:ye.hours(n.totals.hoursThisYear),color:"blue"}),u.jsx(tn,{icon:Td,label:"Betaald dit jaar",value:ye.euro(n.totals.paidThisYear),color:"green"}),u.jsx(tn,{icon:zs,label:"Openstaand totaal",value:ye.euro(n.totals.outstanding),color:"yellow"}),u.jsx(tn,{icon:E0,label:"Concept-facturen",value:ye.euro(n.totals.draftTotal),sub:"nog niet verzonden",color:"accent"})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[u.jsx(Ae,{title:"Uren per maand",subtitle:`Totaal vs facturabel (${n.year})`,children:u.jsx("div",{className:"h-56",children:n.timeStats.length===0?u.jsxs("div",{className:"h-full flex items-center justify-center text-muted text-[13px]",children:["Geen uren in ",n.year]}):u.jsx(Cs,{width:"100%",height:"100%",children:u.jsxs(xd,{data:n.timeStats,children:[u.jsx(gu,{strokeDasharray:"3 3",stroke:"#1f2a44",vertical:!1}),u.jsx(Pi,{dataKey:"month",tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(Di,{tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(xn,{...uM,cursor:{fill:"rgba(0,212,255,0.06)"}}),u.jsx(_n,{dataKey:"hours",name:"Totaal",fill:"#58a6ff",radius:[4,4,0,0]}),u.jsx(_n,{dataKey:"billable_hours",name:"Facturabel",fill:"#00d4ff",radius:[4,4,0,0]})]})})})}),u.jsx(Ae,{title:"Omzet per maand",subtitle:`Betaald vs openstaand (${n.year})`,children:u.jsx("div",{className:"h-56",children:n.invoiceStats.length===0?u.jsxs("div",{className:"h-full flex items-center justify-center text-muted text-[13px]",children:["Geen facturen in ",n.year]}):u.jsx(Cs,{width:"100%",height:"100%",children:u.jsxs(xd,{data:n.invoiceStats,children:[u.jsx(gu,{strokeDasharray:"3 3",stroke:"#1f2a44",vertical:!1}),u.jsx(Pi,{dataKey:"month",tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1}),u.jsx(Di,{tick:{fill:"#8b9bb8",fontSize:11},axisLine:!1,tickLine:!1,tickFormatter:d=>`€${d}`}),u.jsx(xn,{...uM,formatter:d=>ye.euro(d),cursor:{fill:"rgba(0,212,255,0.06)"}}),u.jsx(_n,{dataKey:"paid",name:"Betaald",fill:"#3fb950",radius:[4,4,0,0]}),u.jsx(_n,{dataKey:"outstanding",name:"Openstaand",fill:"#d29922",radius:[4,4,0,0]})]})})})})]})]}):u.jsx(Ze,{})]})}const cM={client_id:"",name:"",location:"",datacenter:"",total_units:42,notes:""};function IQ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState([]),[c,d]=T.useState(!1),[h,p]=T.useState(cM),[v,m]=T.useState(!1),[g,j]=T.useState(null),S=()=>{r(null),ce.get("/racks").then(t).catch(r)};T.useEffect(S,[]),T.useEffect(()=>{ce.get("/clients").then(o).catch(()=>{})},[]);const _=()=>{p(cM),j(null),d(!0)},x=async O=>{O.preventDefault(),m(!0),j(null);try{await ce.post("/racks",{...h,total_units:parseInt(h.total_units,10)||42}),d(!1),S()}catch(w){j(w)}finally{m(!1)}};return n?u.jsx(Oe,{error:n,onRetry:S}):e?u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Racks"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Rack-inventaris per cliënt"})]}),u.jsxs(pe,{onClick:_,children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw rack"]})]}),e.length===0?u.jsx(Ae,{children:u.jsx(Ar,{icon:Kb,title:"Nog geen racks",hint:"Maak je eerste rack aan om devices toe te voegen.",action:u.jsxs(pe,{onClick:_,children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw rack"]})})}):u.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(O=>{const w=O.total_units||42,E=O.device_count||0,M=Math.min(100,Math.round(E/w*100));return u.jsxs("div",{className:"bg-card border border-border-soft rounded-xl p-4 card-hover",children:[u.jsxs("div",{className:"flex items-start justify-between gap-2",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx(ft,{to:`/racks/${O.id}`,className:"text-[14px] font-semibold text-accent hover:underline truncate block",children:O.name}),u.jsx("div",{className:"text-[12px] text-muted mt-0.5",children:O.client_name})]}),u.jsx("div",{className:"w-9 h-9 rounded-lg bg-accent-soft flex items-center justify-center shrink-0",children:u.jsx(Kb,{className:"w-[18px] h-[18px] text-accent"})})]}),(O.location||O.datacenter)&&u.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted mt-2",children:[u.jsx(QM,{className:"w-3.5 h-3.5 shrink-0"}),u.jsx("span",{className:"truncate",children:[O.location,O.datacenter].filter(Boolean).join(" · ")})]}),u.jsxs("div",{className:"mt-3",children:[u.jsxs("div",{className:"flex items-center justify-between text-[12px] mb-1",children:[u.jsx("span",{className:"text-muted",children:"Bezetting"}),u.jsxs("span",{children:[E," / ",w,"U bezet"]})]}),u.jsx("div",{className:"h-1.5 bg-bg-soft rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-accent rounded-full",style:{width:`${M}%`}})})]})]},O.id)})}),u.jsx(_t,{open:c,onClose:()=>d(!1),title:"Nieuw rack",children:u.jsxs("form",{onSubmit:x,className:"space-y-3",children:[g&&u.jsx(Oe,{error:g}),u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{className:X,value:h.client_id,onChange:O=>p({...h,client_id:O.target.value}),required:!0,children:[u.jsx("option",{value:"",children:"— Kies cliënt —"}),l.map(O=>u.jsx("option",{value:O.id,children:O.name},O.id))]})}),u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:h.name,onChange:O=>p({...h,name:O.target.value}),required:!0})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Locatie",children:u.jsx("input",{className:X,value:h.location,onChange:O=>p({...h,location:O.target.value})})}),u.jsx(te,{label:"Datacenter",children:u.jsx("input",{className:X,value:h.datacenter,onChange:O=>p({...h,datacenter:O.target.value})})})]}),u.jsx(te,{label:"Aantal U",children:u.jsx("input",{type:"number",min:"1",className:X,value:h.total_units,onChange:O=>p({...h,total_units:O.target.value})})}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{rows:3,className:X,value:h.notes,onChange:O=>p({...h,notes:O.target.value})})}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>d(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:v,children:"Opslaan"})]})]})})]}):u.jsx(Ze,{})}const yi=28,HQ=["server","switch","router","firewall","storage","ups","pdu","other"],Hb={server:"bg-blue/20 border-blue/60 text-blue",switch:"bg-green/20 border-green/60 text-green",firewall:"bg-red/20 border-red/60 text-red",storage:"bg-purple/20 border-purple/60 text-purple",ups:"bg-yellow/20 border-yellow/60 text-yellow"},fM="bg-accent-soft border-accent/60 text-accent",GQ={active:"Actief",standby:"Standby",decommissioned:"Uitgefaseerd"},dM={name:"",device_type:"server",model:"",manufacturer:"",position_u:1,height_u:1,mgmt_ip:"",serial:"",asset_tag:"",status:"active",specs:"",notes:""};function YQ(){const{id:e}=_u(),t=mr(),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState(!1),[h,p]=T.useState(null),[v,m]=T.useState(!1),[g,j]=T.useState(null),[S,_]=T.useState(dM),[x,O]=T.useState(!1),[w,E]=T.useState(null),M=()=>{o(null),ce.get(`/racks/${e}`).then(r).catch(o)};if(T.useEffect(M,[e]),l)return u.jsx(Oe,{error:l,onRetry:M});if(!n)return u.jsx(Ze,{});const{rack:A,devices:C}=n,k=A.total_units||42,z=()=>{p({name:A.name||"",location:A.location||"",datacenter:A.datacenter||"",total_units:k,notes:A.notes||""}),E(null),d(!0)},B=async D=>{D.preventDefault(),O(!0),E(null);try{await ce.put(`/racks/${e}`,{...h,total_units:parseInt(h.total_units,10)||42}),d(!1),M()}catch(P){E(P)}finally{O(!1)}},Z=async()=>{if(window.confirm(`Rack "${A.name}" en alle devices verwijderen?`))try{await ce.del(`/racks/${e}`),t("/racks")}catch(D){alert(D.message||String(D))}},G=()=>{j(null),_(dM),E(null),m(!0)},H=D=>{j(D),_({name:D.name||"",device_type:D.device_type||"server",model:D.model||"",manufacturer:D.manufacturer||"",position_u:D.position_u||1,height_u:D.height_u||1,mgmt_ip:D.mgmt_ip||"",serial:D.serial||"",asset_tag:D.asset_tag||"",status:D.status||"active",specs:D.specs||"",notes:D.notes||""}),E(null),m(!0)},W=async D=>{D.preventDefault(),O(!0),E(null);const P={...S,position_u:parseInt(S.position_u,10),height_u:parseInt(S.height_u,10)||1};try{g?await ce.put(`/racks/devices/${g.id}`,P):await ce.post(`/racks/${e}/devices`,P),m(!1),M()}catch($){E($)}finally{O(!1)}},Q=async()=>{if(g&&window.confirm(`Device "${g.name}" verwijderen?`)){O(!0),E(null);try{await ce.del(`/racks/devices/${g.id}`),m(!1),M()}catch(D){E(D)}finally{O(!1)}}};return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsxs(ft,{to:"/racks",className:"text-[12px] text-muted hover:text-text flex items-center gap-1 mb-1",children:[u.jsx(wu,{className:"w-3.5 h-3.5"})," Terug naar racks"]}),u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:A.name}),u.jsxs("div",{className:"text-[13px] text-muted mt-0.5 flex items-center gap-2 flex-wrap",children:[u.jsx(ft,{to:`/clients/${A.client_id}`,className:"text-accent hover:underline",children:A.client_name}),(A.location||A.datacenter)&&u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(QM,{className:"w-3.5 h-3.5"}),[A.location,A.datacenter].filter(Boolean).join(" · ")]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsxs(pe,{variant:"secondary",onClick:z,children:[u.jsx(Ya,{className:"w-3.5 h-3.5"})," Bewerken"]}),u.jsxs(pe,{variant:"danger",onClick:Z,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})]})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 items-start",children:[u.jsxs(Ae,{title:"Rack-overzicht",subtitle:`${C.length} devices · ${k}U`,actions:u.jsxs(pe,{size:"sm",onClick:G,children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Device"]}),children:[u.jsx("div",{className:"flex justify-center",children:u.jsxs("div",{className:"flex gap-1.5",children:[u.jsx("div",{className:"flex flex-col text-right",style:{width:34},children:Array.from({length:k},(D,P)=>u.jsxs("div",{className:"text-[10px] text-muted flex items-center justify-end pr-1",style:{height:yi},children:["U",P+1]},P))}),u.jsxs("div",{className:"relative border-2 border-border rounded-md bg-bg-soft overflow-hidden",style:{width:260,height:k*yi},children:[Array.from({length:k},(D,P)=>u.jsx("div",{className:"absolute left-0 right-0 border-b border-border-soft/40",style:{top:P*yi,height:yi}},P)),C.map(D=>{const P=Math.max(1,Math.min(D.position_u||1,k)),$=Math.max(1,D.height_u||1),U=Hb[D.device_type]||fM;return u.jsxs("button",{onClick:()=>H(D),title:`${D.name}${D.model?` — ${D.model}`:""} (U${P}${$>1?`–U${P+$-1}`:""})`,className:`absolute left-1 right-1 rounded border px-2 flex flex-col justify-center overflow-hidden text-left hover:brightness-125 transition-all cursor-pointer ${U}`,style:{top:(P-1)*yi+1,height:$*yi-2},children:[u.jsx("span",{className:"text-[11px] font-semibold truncate leading-tight",children:D.name}),D.model&&$*yi>=36&&u.jsx("span",{className:"text-[10px] opacity-75 truncate leading-tight",children:D.model})]},D.id)})]})]})}),u.jsxs("div",{className:"flex items-center gap-3 flex-wrap mt-4 pt-3 border-t border-border-soft",children:[Object.keys(Hb).map(D=>u.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted",children:[u.jsx("span",{className:`w-2.5 h-2.5 rounded-sm border ${Hb[D]}`})," ",D]},D)),u.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted",children:[u.jsx("span",{className:`w-2.5 h-2.5 rounded-sm border ${fM}`})," overig"]})]})]}),u.jsx(Ae,{title:"Devices",subtitle:`${C.length} in dit rack`,children:u.jsx(Dt,{columns:[{label:"Naam",render:D=>u.jsx("span",{className:"text-accent font-medium",children:D.name})},{label:"Type",render:D=>u.jsx(nt,{color:"blue",children:D.device_type})},{label:"Model",render:D=>u.jsx("span",{className:"text-muted",children:D.model||"-"})},{label:"Positie",render:D=>`U${D.position_u}`},{label:"Mgmt IP",render:D=>u.jsx("span",{className:"text-muted",children:D.mgmt_ip||"-"})},{label:"Status",render:D=>u.jsx(Tt,{status:D.status,labels:GQ})}],rows:C,keyFn:D=>D.id,onRowClick:H,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen devices in dit rack"})})})]}),u.jsx(_t,{open:c,onClose:()=>d(!1),title:"Rack bewerken",children:h&&u.jsxs("form",{onSubmit:B,className:"space-y-3",children:[w&&u.jsx(Oe,{error:w}),u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:h.name,onChange:D=>p({...h,name:D.target.value}),required:!0})}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Locatie",children:u.jsx("input",{className:X,value:h.location,onChange:D=>p({...h,location:D.target.value})})}),u.jsx(te,{label:"Datacenter",children:u.jsx("input",{className:X,value:h.datacenter,onChange:D=>p({...h,datacenter:D.target.value})})})]}),u.jsx(te,{label:"Aantal U",children:u.jsx("input",{type:"number",min:"1",className:X,value:h.total_units,onChange:D=>p({...h,total_units:D.target.value})})}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{rows:3,className:X,value:h.notes,onChange:D=>p({...h,notes:D.target.value})})}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>d(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:x,children:"Opslaan"})]})]})}),u.jsx(_t,{open:v,onClose:()=>m(!1),title:g?"Device bewerken":"Device toevoegen",wide:!0,children:u.jsxs("form",{onSubmit:W,className:"space-y-3",children:[w&&u.jsx(Oe,{error:w}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:S.name,onChange:D=>_({...S,name:D.target.value}),required:!0})}),u.jsx(te,{label:"Type",children:u.jsx("select",{className:X,value:S.device_type,onChange:D=>_({...S,device_type:D.target.value}),children:HQ.map(D=>u.jsx("option",{value:D,children:D},D))})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Model",children:u.jsx("input",{className:X,value:S.model,onChange:D=>_({...S,model:D.target.value})})}),u.jsx(te,{label:"Fabrikant",children:u.jsx("input",{className:X,value:S.manufacturer,onChange:D=>_({...S,manufacturer:D.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:`Positie U * (1–${k})`,children:u.jsx("input",{type:"number",min:"1",max:k,className:X,value:S.position_u,onChange:D=>_({...S,position_u:D.target.value}),required:!0})}),u.jsx(te,{label:"Hoogte (U)",children:u.jsx("input",{type:"number",min:"1",max:k,className:X,value:S.height_u,onChange:D=>_({...S,height_u:D.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Mgmt IP",children:u.jsx("input",{className:X,value:S.mgmt_ip,onChange:D=>_({...S,mgmt_ip:D.target.value})})}),u.jsx(te,{label:"Serienummer",children:u.jsx("input",{className:X,value:S.serial,onChange:D=>_({...S,serial:D.target.value})})}),u.jsx(te,{label:"Asset-tag",children:u.jsx("input",{className:X,value:S.asset_tag,onChange:D=>_({...S,asset_tag:D.target.value})})})]}),u.jsx(te,{label:"Status",children:u.jsxs("select",{className:X,value:S.status,onChange:D=>_({...S,status:D.target.value}),children:[u.jsx("option",{value:"active",children:"Actief"}),u.jsx("option",{value:"standby",children:"Standby"}),u.jsx("option",{value:"decommissioned",children:"Uitgefaseerd"})]})}),u.jsx(te,{label:"Specs",children:u.jsx("textarea",{rows:2,className:X,value:S.specs,onChange:D=>_({...S,specs:D.target.value})})}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{rows:2,className:X,value:S.notes,onChange:D=>_({...S,notes:D.target.value})})}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsx("div",{children:g&&u.jsxs(pe,{variant:"danger",type:"button",onClick:Q,loading:x,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>m(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:x,children:"Opslaan"})]})]})]})})]})}const hM={active:"Actief",standby:"Standby",decommissioned:"Uitgefaseerd"},VQ=["switch","router","firewall","loadbalancer","ap","other"],Gb={rack_device:"Rack-device",network_device:"Netwerkdevice",external:"Extern"},FQ=["copper","sfp","sfp+","qsfp","dac","fiber"],pM={client_id:"",name:"",device_type:"switch",model:"",manufacturer:"",ip_address:"",mgmt_ip:"",ports_count:24,os_version:"",status:"active",notes:""},mM={client_id:"",name:"",from_type:"network_device",from_id:"",from_port:"",to_type:"network_device",to_id:"",to_port:"",media_type:"copper",speed:"1GbE",vlan:"",status:"active",notes:""};function KQ({tabs:e,active:t,onChange:n}){return u.jsx("div",{className:"flex gap-1 border-b border-border-soft",children:e.map(r=>u.jsx("button",{onClick:()=>n(r.key),className:`px-3.5 py-2 text-[13px] font-medium border-b-2 -mb-px transition-colors ${t===r.key?"border-accent text-accent":"border-transparent text-muted hover:text-text"}`,children:r.label},r.key))})}function XQ(){const[e,t]=T.useState("devices"),[n,r]=T.useState([]),[l,o]=T.useState(null),[c,d]=T.useState(null),[h,p]=T.useState(!1),[v,m]=T.useState(null),[g,j]=T.useState(pM),[S,_]=T.useState(null),[x,O]=T.useState(null),[w,E]=T.useState(!1),[M,A]=T.useState(null),[C,k]=T.useState(mM),[z,B]=T.useState(!1),[Z,G]=T.useState(null),H=()=>{d(null),ce.get("/networking/devices").then(o).catch(d)},W=()=>{O(null),ce.get("/networking/connections").then(_).catch(O)};T.useEffect(()=>{H(),W()},[]),T.useEffect(()=>{ce.get("/clients").then(r).catch(()=>{})},[]);const Q=()=>{m(null),j(pM),G(null),p(!0)},D=q=>{m(q),j({client_id:q.client_id,name:q.name||"",device_type:q.device_type||"switch",model:q.model||"",manufacturer:q.manufacturer||"",ip_address:q.ip_address||"",mgmt_ip:q.mgmt_ip||"",ports_count:q.ports_count??24,os_version:q.os_version||"",status:q.status||"active",notes:q.notes||""}),G(null),p(!0)},P=async q=>{q.preventDefault(),B(!0),G(null);const de={...g,ports_count:parseInt(g.ports_count,10)||24};try{v?await ce.put(`/networking/devices/${v.id}`,de):await ce.post("/networking/devices",de),p(!1),H()}catch(ge){G(ge)}finally{B(!1)}},$=async()=>{if(v&&window.confirm(`Device "${v.name}" verwijderen?`)){B(!0),G(null);try{await ce.del(`/networking/devices/${v.id}`),p(!1),H()}catch(q){G(q)}finally{B(!1)}}},U=()=>{A(null),k(mM),G(null),E(!0)},ie=q=>{A(q),k({client_id:q.client_id,name:q.name||"",from_type:q.from_type||"network_device",from_id:q.from_id??"",from_port:q.from_port||"",to_type:q.to_type||"network_device",to_id:q.to_id??"",to_port:q.to_port||"",media_type:q.media_type||"copper",speed:q.speed||"1GbE",vlan:q.vlan||"",status:q.status||"active",notes:q.notes||""}),G(null),E(!0)},fe=async q=>{q.preventDefault(),B(!0),G(null);const de={...C,from_id:C.from_id===""?null:parseInt(C.from_id,10),to_id:C.to_id===""?null:parseInt(C.to_id,10)};try{M?await ce.put(`/networking/connections/${M.id}`,de):await ce.post("/networking/connections",de),E(!1),W()}catch(ge){G(ge)}finally{B(!1)}},L=async()=>{if(M&&window.confirm("Deze connectie verwijderen?")){B(!0),G(null);try{await ce.del(`/networking/connections/${M.id}`),E(!1),W()}catch(q){G(q)}finally{B(!1)}}},F=(q,de)=>[Gb[q]||q||"-",de].filter(Boolean).join(" · ");return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Netwerken"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Netwerkdevices en connecties"})]}),e==="devices"?u.jsxs(pe,{onClick:Q,children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuw device"]}):u.jsxs(pe,{onClick:U,children:[u.jsx(qt,{className:"w-4 h-4"})," Nieuwe connectie"]})]}),u.jsx(KQ,{tabs:[{key:"devices",label:"Devices"},{key:"connections",label:"Connecties"}],active:e,onChange:t}),e==="devices"&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:c?u.jsx(Oe,{error:c,onRetry:H}):l?u.jsx(Dt,{columns:[{label:"Naam",render:q=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(Ed,{className:"w-3.5 h-3.5 text-muted"}),q.name]})},{label:"Type",render:q=>u.jsx(nt,{color:"blue",children:q.device_type})},{label:"Cliënt",key:"client_name"},{label:"Model",render:q=>u.jsx("span",{className:"text-muted",children:q.model||"-"})},{label:"IP",render:q=>u.jsx("span",{className:"text-muted",children:q.ip_address||"-"})},{label:"Mgmt IP",render:q=>u.jsx("span",{className:"text-muted",children:q.mgmt_ip||"-"})},{label:"Poorten",render:q=>q.ports_count??"-"},{label:"Status",render:q=>u.jsx(Tt,{status:q.status,labels:hM})}],rows:l,keyFn:q=>q.id,onRowClick:D,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen netwerkdevices"})}):u.jsx(Ze,{})})}),e==="connections"&&u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:x?u.jsx(Oe,{error:x,onRetry:W}):S?u.jsx(Dt,{columns:[{label:"Naam",render:q=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(W$,{className:"w-3.5 h-3.5 text-muted"}),q.name||"-"]})},{label:"Cliënt",key:"client_name"},{label:"Van",render:q=>F(q.from_type,q.from_port)},{label:"Naar",render:q=>F(q.to_type,q.to_port)},{label:"Media",render:q=>u.jsx(nt,{color:"purple",children:q.media_type||"-"})},{label:"Snelheid",render:q=>u.jsx("span",{className:"text-muted",children:q.speed||"-"})},{label:"VLAN",render:q=>u.jsx("span",{className:"text-muted",children:q.vlan||"-"})},{label:"Status",render:q=>u.jsx(Tt,{status:q.status,labels:hM})}],rows:S,keyFn:q=>q.id,onRowClick:ie,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen connecties"})}):u.jsx(Ze,{})})}),u.jsx(_t,{open:h,onClose:()=>p(!1),title:v?"Device bewerken":"Nieuw device",wide:!0,children:u.jsxs("form",{onSubmit:P,className:"space-y-3",children:[Z&&u.jsx(Oe,{error:Z}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{className:X,value:g.client_id,onChange:q=>j({...g,client_id:q.target.value}),required:!0,disabled:!!v,children:[u.jsx("option",{value:"",children:"— Kies cliënt —"}),n.map(q=>u.jsx("option",{value:q.id,children:q.name},q.id))]})}),u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:g.name,onChange:q=>j({...g,name:q.target.value}),required:!0})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Type *",children:u.jsx("select",{className:X,value:g.device_type,onChange:q=>j({...g,device_type:q.target.value}),required:!0,children:VQ.map(q=>u.jsx("option",{value:q,children:q},q))})}),u.jsx(te,{label:"Model",children:u.jsx("input",{className:X,value:g.model,onChange:q=>j({...g,model:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Fabrikant",children:u.jsx("input",{className:X,value:g.manufacturer,onChange:q=>j({...g,manufacturer:q.target.value})})}),u.jsx(te,{label:"Aantal poorten",children:u.jsx("input",{type:"number",min:"0",className:X,value:g.ports_count,onChange:q=>j({...g,ports_count:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"IP-adres",children:u.jsx("input",{className:X,value:g.ip_address,onChange:q=>j({...g,ip_address:q.target.value})})}),u.jsx(te,{label:"Mgmt IP",children:u.jsx("input",{className:X,value:g.mgmt_ip,onChange:q=>j({...g,mgmt_ip:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"OS-versie",children:u.jsx("input",{className:X,value:g.os_version,onChange:q=>j({...g,os_version:q.target.value})})}),u.jsx(te,{label:"Status",children:u.jsxs("select",{className:X,value:g.status,onChange:q=>j({...g,status:q.target.value}),children:[u.jsx("option",{value:"active",children:"Actief"}),u.jsx("option",{value:"standby",children:"Standby"}),u.jsx("option",{value:"decommissioned",children:"Uitgefaseerd"})]})})]}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{rows:2,className:X,value:g.notes,onChange:q=>j({...g,notes:q.target.value})})}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsx("div",{children:v&&u.jsxs(pe,{variant:"danger",type:"button",onClick:$,loading:z,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>p(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:z,children:"Opslaan"})]})]})]})}),u.jsx(_t,{open:w,onClose:()=>E(!1),title:M?"Connectie bewerken":"Nieuwe connectie",wide:!0,children:u.jsxs("form",{onSubmit:fe,className:"space-y-3",children:[Z&&u.jsx(Oe,{error:Z}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Cliënt *",children:u.jsxs("select",{className:X,value:C.client_id,onChange:q=>k({...C,client_id:q.target.value}),required:!0,disabled:!!M,children:[u.jsx("option",{value:"",children:"— Kies cliënt —"}),n.map(q=>u.jsx("option",{value:q.id,children:q.name},q.id))]})}),u.jsx(te,{label:"Naam",children:u.jsx("input",{className:X,value:C.name,onChange:q=>k({...C,name:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Van type *",children:u.jsx("select",{className:X,value:C.from_type,onChange:q=>k({...C,from_type:q.target.value}),required:!0,children:Object.entries(Gb).map(([q,de])=>u.jsx("option",{value:q,children:de},q))})}),u.jsx(te,{label:"Van ID",children:u.jsx("input",{type:"number",min:"0",className:X,value:C.from_id,onChange:q=>k({...C,from_id:q.target.value})})}),u.jsx(te,{label:"Van poort",children:u.jsx("input",{className:X,placeholder:"bijv. Gi0/1",value:C.from_port,onChange:q=>k({...C,from_port:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Naar type *",children:u.jsx("select",{className:X,value:C.to_type,onChange:q=>k({...C,to_type:q.target.value}),required:!0,children:Object.entries(Gb).map(([q,de])=>u.jsx("option",{value:q,children:de},q))})}),u.jsx(te,{label:"Naar ID",children:u.jsx("input",{type:"number",min:"0",className:X,value:C.to_id,onChange:q=>k({...C,to_id:q.target.value})})}),u.jsx(te,{label:"Naar poort",children:u.jsx("input",{className:X,placeholder:"bijv. eth0",value:C.to_port,onChange:q=>k({...C,to_port:q.target.value})})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Mediatype",children:u.jsx("select",{className:X,value:C.media_type,onChange:q=>k({...C,media_type:q.target.value}),children:FQ.map(q=>u.jsx("option",{value:q,children:q},q))})}),u.jsx(te,{label:"Snelheid",children:u.jsx("input",{className:X,value:C.speed,onChange:q=>k({...C,speed:q.target.value})})}),u.jsx(te,{label:"VLAN",children:u.jsx("input",{className:X,value:C.vlan,onChange:q=>k({...C,vlan:q.target.value})})})]}),u.jsx(te,{label:"Status",children:u.jsxs("select",{className:X,value:C.status,onChange:q=>k({...C,status:q.target.value}),children:[u.jsx("option",{value:"active",children:"Actief"}),u.jsx("option",{value:"standby",children:"Standby"}),u.jsx("option",{value:"decommissioned",children:"Uitgefaseerd"})]})}),u.jsx(te,{label:"Notities",children:u.jsx("textarea",{rows:2,className:X,value:C.notes,onChange:q=>k({...C,notes:q.target.value})})}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsx("div",{children:M&&u.jsxs(pe,{variant:"danger",type:"button",onClick:L,loading:z,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>E(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:z,children:"Opslaan"})]})]})]})})]})}const vM={data_architecture:"Data-architectuur",network_topology:"Netwerk-topologie",system_architecture:"Systeem-architectuur",application_flow:"Applicatie-flow",application_landscape:"Applicatie-landscape"},yM={data_architecture:"accent",network_topology:"green",system_architecture:"purple",application_flow:"blue",application_landscape:"pink"};function ZQ(e){var t;return((t=e.data)==null?void 0:t.label)||e.label||e.name||e.id}function WQ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(null),[c,d]=T.useState(!1),[h,p]=T.useState(null),[v,m]=T.useState(!1),g=()=>{r(null),ce.get("/diagrams").then(t).catch(r)};T.useEffect(g,[]);const j=O=>{o(null),p(null),d(!0),ce.get(`/diagrams/${O.id}`).then(o).catch(p).finally(()=>d(!1))},S=()=>{o(null),p(null),d(!1)},_=async()=>{if(l&&window.confirm(`Diagram "${l.name}" verwijderen?`)){m(!0),p(null);try{await ce.del(`/diagrams/${l.id}`),S(),g()}catch(O){p(O)}finally{m(!1)}}};if(n)return u.jsx(Oe,{error:n,onRetry:g});if(!e)return u.jsx(Ze,{});const x=c||!!l||!!h;return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Diagrammen"}),u.jsxs("p",{className:"text-[13px] text-muted mt-0.5",children:["Bewerken van diagrammen kan in de"," ",u.jsx("a",{href:"/architecture",className:"text-accent underline",children:"klassieke editor"})]})]}),u.jsx(Ae,{padding:!1,children:u.jsx("div",{className:"p-4",children:u.jsx(Dt,{columns:[{label:"Naam",render:O=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(S6,{className:"w-3.5 h-3.5 text-muted"}),O.name]})},{label:"Cliënt",key:"client_name"},{label:"Type",render:O=>u.jsx(nt,{color:yM[O.diagram_type]||"muted",children:vM[O.diagram_type]||O.diagram_type})},{label:"Beschrijving",render:O=>u.jsx("span",{className:"text-muted block max-w-xs truncate",children:O.description||"-"})},{label:"Bijgewerkt",render:O=>u.jsx("span",{className:"text-muted",children:ye.datetime(O.updated_at)})}],rows:e,keyFn:O=>O.id,onRowClick:j,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen diagrammen"})})})}),u.jsxs(_t,{open:x,onClose:S,title:l?l.name:"Diagram laden",wide:!0,children:[c&&u.jsx(Ze,{}),h&&u.jsx(Oe,{error:h}),l&&u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-[12px] text-muted",children:[u.jsx(nt,{color:yM[l.diagram_type]||"muted",children:vM[l.diagram_type]||l.diagram_type}),u.jsxs("span",{children:["Bijgewerkt: ",ye.datetime(l.updated_at)]})]}),l.description&&u.jsx("p",{className:"text-[13px] text-muted",children:l.description}),u.jsxs("div",{children:[u.jsxs("h3",{className:"text-[13px] font-semibold mb-2",children:["Nodes (",l.nodes.length,")"]}),l.nodes.length===0?u.jsx("div",{className:"text-muted text-[13px]",children:"Geen nodes"}):u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:l.nodes.map((O,w)=>{var E,M;return u.jsxs("div",{className:"bg-bg-soft border border-border-soft rounded-lg px-3 py-2",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:ZQ(O)}),(O.type||((E=O.data)==null?void 0:E.type))&&u.jsx(nt,{color:"blue",className:"mt-1",children:((M=O.data)==null?void 0:M.type)||O.type})]},O.id||w)})})]}),u.jsxs("div",{children:[u.jsxs("h3",{className:"text-[13px] font-semibold mb-2",children:["Verbindingen (",l.edges.length,")"]}),l.edges.length===0?u.jsx("div",{className:"text-muted text-[13px]",children:"Geen verbindingen"}):u.jsx("div",{className:"space-y-1",children:l.edges.map((O,w)=>u.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted bg-bg-soft border border-border-soft rounded-lg px-3 py-1.5",children:[u.jsx("span",{className:"text-text",children:O.source}),u.jsx(A0,{className:"w-3.5 h-3.5 shrink-0"}),u.jsx("span",{className:"text-text",children:O.target}),O.label&&u.jsx(nt,{color:"muted",className:"ml-1",children:O.label})]},O.id||w))})]}),u.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-border-soft",children:[u.jsxs(pe,{variant:"danger",onClick:_,loading:v,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]}),u.jsx(pe,{variant:"secondary",onClick:S,children:"Sluiten"})]})]})]})]})}function QQ({tabs:e,active:t,onChange:n}){return u.jsx("div",{className:"flex gap-1 border-b border-border-soft",children:e.map(r=>u.jsx("button",{onClick:()=>n(r.key),className:`px-3.5 py-2 text-[13px] font-medium border-b-2 -mb-px transition-colors ${t===r.key?"border-accent text-accent":"border-transparent text-muted hover:text-text"}`,children:r.label},r.key))})}function JQ(e){return e>=70?"green":e>=40?"yellow":"muted"}function eJ(){const[e,t]=T.useState("datacenters"),[n,r]=T.useState(null),[l,o]=T.useState({search:"",vendor:"",region:"",type:"",sort:""}),[c,d]=T.useState(null),[h,p]=T.useState(null),[v,m]=T.useState({search:"",industry:"",data_warehouse:"",city:"",sort:""}),[g,j]=T.useState(null),[S,_]=T.useState(null);return T.useEffect(()=>{ce.get("/market/filters").then(r).catch(()=>r({}))},[]),T.useEffect(()=>{p(null),d(null),ce.get(`/market/datacenters${Ga(l)}`).then(d).catch(p)},[l]),T.useEffect(()=>{_(null),j(null),ce.get(`/market/companies${Ga(v)}`).then(j).catch(_)},[v]),u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Marktverkenning"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Datacenters en tech-bedrijven in de regio"})]}),u.jsx(QQ,{tabs:[{key:"datacenters",label:"Datacenters"},{key:"companies",label:"Tech-bedrijven"}],active:e,onChange:t}),e==="datacenters"&&u.jsx(Ae,{padding:!1,children:u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2",children:[u.jsx("input",{className:X,placeholder:"Zoeken...",value:l.search,onChange:x=>o({...l,search:x.target.value})}),u.jsxs("select",{className:X,value:l.vendor,onChange:x=>o({...l,vendor:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle vendors"}),((n==null?void 0:n.vendors)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:l.region,onChange:x=>o({...l,region:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle regio's"}),((n==null?void 0:n.regions)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:l.type,onChange:x=>o({...l,type:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle types"}),((n==null?void 0:n.types)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:l.sort,onChange:x=>o({...l,sort:x.target.value}),children:[u.jsx("option",{value:"",children:"Sorteer: vermogen"}),u.jsx("option",{value:"name",children:"Sorteer: naam"})]})]}),h?u.jsx(Oe,{error:h}):c?u.jsx(Dt,{columns:[{label:"Naam",render:x=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(X$,{className:"w-3.5 h-3.5 text-muted"}),x.name]})},{label:"Stad",key:"city"},{label:"Regio",render:x=>u.jsx("span",{className:"text-muted",children:x.region||"-"})},{label:"Type",render:x=>u.jsx("span",{className:"text-muted",children:x.type||"-"})},{label:"Operator",render:x=>u.jsx("span",{className:"text-muted",children:x.operator||"-"})},{label:"Tier",render:x=>x.tier?u.jsx(nt,{color:"accent",children:x.tier}):u.jsx("span",{className:"text-muted",children:"-"})},{label:"Vermogen",render:x=>x.power_mw!=null?`${x.power_mw} MW`:"-"},{label:"Vendors",render:x=>u.jsx("span",{className:"text-muted block max-w-[220px] truncate",children:x.network_vendors||"-"})}],rows:c,keyFn:x=>x.id,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Geen datacenters gevonden"})}):u.jsx(Ze,{})]})}),e==="companies"&&u.jsx(Ae,{padding:!1,children:u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2",children:[u.jsx("input",{className:X,placeholder:"Zoeken...",value:v.search,onChange:x=>m({...v,search:x.target.value})}),u.jsxs("select",{className:X,value:v.industry,onChange:x=>m({...v,industry:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle branches"}),((n==null?void 0:n.industries)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:v.data_warehouse,onChange:x=>m({...v,data_warehouse:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle data warehouses"}),((n==null?void 0:n.data_warehouses)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:v.city,onChange:x=>m({...v,city:x.target.value}),children:[u.jsx("option",{value:"",children:"Alle steden"}),((n==null?void 0:n.cities)||[]).map(x=>u.jsx("option",{value:x,children:x},x))]}),u.jsxs("select",{className:X,value:v.sort,onChange:x=>m({...v,sort:x.target.value}),children:[u.jsx("option",{value:"",children:"Sorteer: lead score"}),u.jsx("option",{value:"name",children:"Sorteer: naam"}),u.jsx("option",{value:"employees",children:"Sorteer: werknemers"})]})]}),S?u.jsx(Oe,{error:S}):g?u.jsx(Dt,{columns:[{label:"Naam",render:x=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(b8,{className:"w-3.5 h-3.5 text-muted"}),x.name]})},{label:"Branche",render:x=>u.jsx("span",{className:"text-muted",children:x.industry||"-"})},{label:"Stad",render:x=>u.jsx("span",{className:"text-muted",children:x.city||"-"})},{label:"Werknemers",render:x=>x.employees??"-"},{label:"Data warehouse",render:x=>u.jsx("span",{className:"text-muted block max-w-[160px] truncate",children:x.data_warehouse||"-"})},{label:"BI-tools",render:x=>u.jsx("span",{className:"text-muted block max-w-[140px] truncate",children:x.bi_tools||"-"})},{label:"Cloud",render:x=>u.jsx("span",{className:"text-muted",children:x.cloud_provider||"-"})},{label:"Lead score",render:x=>u.jsx(nt,{color:JQ(x.lead_score),children:x.lead_score??"-"})},{label:"Lead status",render:x=>u.jsx("span",{className:"text-muted",children:x.lead_status||"-"})}],rows:g,keyFn:x=>x.id,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Geen bedrijven gevonden"})}):u.jsx(Ze,{})]})})]})}const tJ=["openrouter","openai","anthropic","deepseek","groq","ollama","azure","custom"],gM={name:"",provider_type:"openrouter",api_key:"",base_url:"",default_model:"",is_active:!0,is_default:!1};function nJ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(!1),[c,d]=T.useState(null),[h,p]=T.useState(gM),[v,m]=T.useState(!1),[g,j]=T.useState(null),[S,_]=T.useState([]),[x,O]=T.useState(""),[w,E]=T.useState(!1),[M,A]=T.useState(null),[C,k]=T.useState([]),[z,B]=T.useState(""),Z=T.useRef(null),G=()=>{r(null),ce.get("/ai/providers").then(t).catch(r)};T.useEffect(G,[]),T.useEffect(()=>{ce.get("/clients").then(k).catch(()=>{})},[]),T.useEffect(()=>{Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[S,w]);const H=()=>{d(null),p(gM),j(null),o(!0)},W=$=>{d($),p({name:$.name||"",provider_type:$.provider_type||"openrouter",api_key:"",base_url:$.base_url||"",default_model:$.default_model||"",is_active:!!$.is_active,is_default:!!$.is_default}),j(null),o(!0)},Q=async $=>{$.preventDefault(),m(!0),j(null);try{await ce.post("/ai/providers",{...h,id:c?c.id:void 0}),o(!1),G()}catch(U){j(U)}finally{m(!1)}},D=async $=>{if(window.confirm(`Provider "${$.name}" verwijderen?`))try{await ce.del(`/ai/providers/${$.id}`),G()}catch(U){alert(U.message||String(U))}},P=async $=>{$==null||$.preventDefault();const U=x.trim();if(!(!U||w)){O(""),A(null),_(ie=>[...ie,{role:"user",content:U}]),E(!0);try{const ie=await ce.post("/ai/chat",{message:U,client_id:z||void 0});_(fe=>[...fe,{role:"assistant",content:ie.content,model:ie.model}])}catch(ie){A(ie)}finally{E(!1)}}};return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"AI"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Providers beheren en chatten met AI"})]}),u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 items-start",children:[u.jsx(Ae,{title:"Providers",subtitle:"Geconfigureerde AI-providers",actions:u.jsxs(pe,{size:"sm",onClick:H,children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Provider toevoegen"]}),children:n?u.jsx(Oe,{error:n,onRetry:G}):e?e.length===0?u.jsx("div",{className:"text-muted text-[13px] py-6 text-center",children:"Nog geen providers geconfigureerd"}):u.jsx("div",{className:"space-y-2",children:e.map($=>u.jsxs("div",{className:"flex items-center gap-3 bg-bg-soft border border-border-soft rounded-lg px-3 py-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${$.is_active?"bg-green":"bg-muted/40"}`,title:$.is_active?"Actief":"Inactief"}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-[13px] font-medium truncate",children:$.name}),u.jsx(nt,{color:"blue",children:$.provider_type}),!!$.is_default&&u.jsx(v6,{className:"w-3.5 h-3.5 text-yellow fill-yellow shrink-0"})]}),u.jsxs("div",{className:"text-[11px] text-muted mt-0.5 truncate",children:[$.default_model||"geen model"," ",$.api_key?`· ${$.api_key}`:""]})]}),u.jsx("button",{onClick:()=>W($),className:"p-1.5 rounded-md text-muted hover:text-text hover:bg-card shrink-0",title:"Bewerken",children:u.jsx(Ya,{className:"w-3.5 h-3.5"})}),u.jsx("button",{onClick:()=>D($),className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-red/10 shrink-0",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})]},$.id))}):u.jsx(Ze,{})}),u.jsxs(Ae,{title:"AI Chat",subtitle:"Stel een vraag aan de actieve provider",padding:!1,className:"flex flex-col",children:[u.jsx("div",{className:"px-4 pt-3",children:u.jsxs("select",{className:X,value:z,onChange:$=>B($.target.value),children:[u.jsx("option",{value:"",children:"Geen cliënt-context"}),C.map($=>u.jsxs("option",{value:$.id,children:["Koppel aan: ",$.name]},$.id))]})}),u.jsxs("div",{ref:Z,className:"flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-[320px] max-h-[480px]",children:[S.length===0&&!w&&u.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-muted py-12",children:[u.jsx(V$,{className:"w-8 h-8 mb-2"}),u.jsx("div",{className:"text-[13px]",children:"Start een gesprek met de AI"})]}),S.map(($,U)=>$.role==="user"?u.jsx("div",{className:"flex justify-end",children:u.jsx("div",{className:"max-w-[80%] bg-accent text-bg rounded-2xl rounded-br-sm px-3.5 py-2 text-[13px] whitespace-pre-wrap",children:$.content})},U):u.jsx("div",{className:"flex justify-start",children:u.jsxs("div",{className:"max-w-[80%]",children:[u.jsx("div",{className:"bg-card border border-border-soft rounded-2xl rounded-bl-sm px-3.5 py-2 text-[13px] whitespace-pre-wrap",children:$.content}),$.model&&u.jsx("div",{className:"text-[10px] text-muted mt-1 ml-1",children:$.model})]})},U)),w&&u.jsx("div",{className:"flex justify-start",children:u.jsxs("div",{className:"bg-card border border-border-soft rounded-2xl rounded-bl-sm px-4 py-3 flex items-center gap-1.5",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted animate-bounce",style:{animationDelay:"0ms"}}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted animate-bounce",style:{animationDelay:"150ms"}}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-muted animate-bounce",style:{animationDelay:"300ms"}})]})})]}),M&&u.jsx("div",{className:"px-4 pb-2",children:u.jsx(Oe,{error:M})}),u.jsxs("form",{onSubmit:P,className:"flex items-center gap-2 p-3 border-t border-border-soft",children:[u.jsx("input",{className:X,placeholder:"Typ je bericht...",value:x,onChange:$=>O($.target.value),disabled:w}),u.jsxs(pe,{type:"submit",loading:w,disabled:!x.trim(),children:[u.jsx(r6,{className:"w-4 h-4"})," Verstuur"]})]})]})]}),u.jsx(_t,{open:l,onClose:()=>o(!1),title:c?"Provider bewerken":"Provider toevoegen",children:u.jsxs("form",{onSubmit:Q,className:"space-y-3",children:[g&&u.jsx(Oe,{error:g}),u.jsx(te,{label:"Naam *",children:u.jsx("input",{className:X,value:h.name,onChange:$=>p({...h,name:$.target.value}),required:!0})}),u.jsx(te,{label:"Type",children:u.jsx("select",{className:X,value:h.provider_type,onChange:$=>p({...h,provider_type:$.target.value}),children:tJ.map($=>u.jsx("option",{value:$,children:$},$))})}),u.jsx(te,{label:"API-key",children:u.jsx("input",{type:"password",className:X,value:h.api_key,onChange:$=>p({...h,api_key:$.target.value}),placeholder:c?"Leeg laten om te behouden":"sk-..."})}),u.jsx(te,{label:"Base URL",children:u.jsx("input",{className:X,value:h.base_url,onChange:$=>p({...h,base_url:$.target.value}),placeholder:"https://..."})}),u.jsx(te,{label:"Standaard model",children:u.jsx("input",{className:X,value:h.default_model,onChange:$=>p({...h,default_model:$.target.value})})}),u.jsxs("div",{className:"flex items-center gap-5",children:[u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:h.is_active,onChange:$=>p({...h,is_active:$.target.checked}),className:"accent-[#00d4ff]"}),"Actief"]}),u.jsxs("label",{className:"flex items-center gap-2 text-[13px] cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:h.is_default,onChange:$=>p({...h,is_default:$.target.checked}),className:"accent-[#00d4ff]"}),"Standaard provider"]})]}),u.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>o(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:v,children:"Opslaan"})]})]})})]})}const rJ={info:"blue",warning:"yellow",error:"red",success:"green",advice:"purple",reminder:"accent",system:"muted"};function aJ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(!1),c=()=>{r(null),ce.get("/notifications").then(t).catch(r)};T.useEffect(c,[]);const d=async()=>{o(!0);try{await ce.post("/notifications/read-all"),c()}catch(m){alert(m.message)}finally{o(!1)}},h=async m=>{if(!m.read)try{await ce.post(`/notifications/${m.id}/read`),c()}catch(g){alert(g.message)}};if(n)return u.jsx(Oe,{error:n,onRetry:c});if(!e)return u.jsx(Ze,{});const{notifications:p,unread:v}=e;return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Notificaties"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:v>0?`${v} ongelezen`:"Alles gelezen"})]}),v>0&&u.jsxs(pe,{variant:"secondary",onClick:d,loading:l,children:[u.jsx(r8,{className:"w-4 h-4"})," Alles als gelezen markeren"]})]}),p.length===0?u.jsx(Ae,{children:u.jsx(Ar,{icon:YM,title:"Geen notificaties",hint:"Je bent helemaal bij."})}):u.jsx("div",{className:"space-y-2",children:p.map(m=>u.jsx("div",{onClick:()=>h(m),className:`bg-card border border-border-soft rounded-xl px-4 py-3 transition-colors ${m.read?"":"border-l-2 border-l-accent cursor-pointer hover:bg-card-hover"}`,children:u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:`text-[13px] ${m.read?"":"font-medium"}`,children:m.title}),m.message&&u.jsx("div",{className:"text-[12px] text-muted mt-0.5",children:m.message})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[m.type&&u.jsx(nt,{color:rJ[m.type]||"muted",children:m.type}),u.jsx("span",{className:"text-[11px] text-muted whitespace-nowrap",children:ye.datetime(m.created_at)})]})]})},m.id))})]})}const iJ={lead:"Lead",active:"Actief",paused:"Gepauzeerd",archived:"Gearchiveerd"},lJ={todo:"Te doen",in_progress:"Bezig",done:"Klaar",cancelled:"Geannuleerd"};function As({to:e,children:t}){const n=u.jsx("div",{className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg hover:bg-card-hover transition-colors",children:t});return e?u.jsx(ft,{to:e,className:"block",children:n}):n}function oJ(){const[e]=IM(),t=(e.get("q")||"").trim(),[n,r]=T.useState(null),[l,o]=T.useState(null);if(T.useEffect(()=>{if(r(null),o(null),!t){r({clients:[],engagements:[],tasks:[],diagrams:[],notes:[]});return}ce.get(`/search${Ga({q:t})}`).then(r).catch(o)},[t]),l)return u.jsx(Oe,{error:l,onRetry:()=>ce.get(`/search${Ga({q:t})}`).then(r).catch(o)});if(!n)return u.jsx(Ze,{text:`Zoeken naar "${t}"...`});const{clients:c,engagements:d,tasks:h,diagrams:p,notes:v}=n,m=c.length+d.length+h.length+p.length+v.length;return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-xl font-bold tracking-tight",children:["Zoekresultaten voor “",t,"”"]}),u.jsxs("p",{className:"text-[13px] text-muted mt-0.5",children:[m," resultaat",m===1?"":"en"," gevonden"]})]}),m===0?u.jsx(Ae,{children:u.jsx(Ar,{icon:e6,title:"Geen resultaten",hint:`Er is niets gevonden voor "${t}". Probeer een andere zoekterm.`})}):u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[c.length>0&&u.jsx(Ae,{title:"Cliënten",subtitle:`${c.length} gevonden`,children:u.jsx("div",{className:"space-y-1",children:c.map(g=>u.jsxs(As,{to:`/clients/${g.id}`,children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:g.name}),g.industry&&u.jsx("div",{className:"text-[11px] text-muted",children:g.industry})]}),u.jsx(Tt,{status:g.status,labels:iJ})]},g.id))})}),d.length>0&&u.jsx(Ae,{title:"Engagements",subtitle:`${d.length} gevonden`,children:u.jsx("div",{className:"space-y-1",children:d.map(g=>u.jsxs(As,{to:`/engagements/${g.id}`,children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:g.title}),u.jsx("div",{className:"text-[11px] text-muted",children:g.client_name})]}),u.jsx(Tt,{status:g.status,labels:{planned:"Gepland",in_progress:"Lopend",completed:"Afgerond",on_hold:"On hold"}})]},g.id))})}),h.length>0&&u.jsx(Ae,{title:"Taken",subtitle:`${h.length} gevonden`,children:u.jsx("div",{className:"space-y-1",children:h.map(g=>u.jsxs(As,{children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:g.title}),u.jsxs("div",{className:"text-[11px] text-muted",children:[g.client_name,g.engagement_title?` · ${g.engagement_title}`:""]})]}),u.jsx(Tt,{status:g.status,labels:lJ})]},g.id))})}),p.length>0&&u.jsx(Ae,{title:"Diagrammen",subtitle:`${p.length} gevonden`,children:u.jsx("div",{className:"space-y-1",children:p.map(g=>u.jsxs(As,{to:"/diagrams",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] font-medium truncate",children:g.name}),u.jsx("div",{className:"text-[11px] text-muted",children:g.client_name})]}),u.jsx(nt,{color:"purple",children:g.diagram_type})]},g.id))})}),v.length>0&&u.jsx(Ae,{title:"Notities",subtitle:`${v.length} gevonden`,children:u.jsx("div",{className:"space-y-1",children:v.map(g=>u.jsx(As,{to:`/clients/${g.client_id}`,children:u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[13px] truncate",children:g.content.length>120?`${g.content.slice(0,120)}…`:g.content}),u.jsxs("div",{className:"text-[11px] text-muted",children:[g.client_name," · ",ye.date(g.created_at)]})]})},g.id))})})]})]})}const sJ=[{key:"algemeen",label:"Algemeen"},{key:"gebruikers",label:"Gebruikers"},{key:"backups",label:"Backups"},{key:"audit",label:"Audit-log"}],uJ={admin:"accent",consultant:"blue",viewer:"muted"},cJ={admin:"Admin",consultant:"Consultant",viewer:"Viewer"},bM={username:"",password:"",email:"",role:"viewer"};function AP({banner:e}){return e?u.jsx("div",{className:`rounded-lg px-4 py-3 text-[13px] border ${e.type==="green"?"bg-green/10 border-green/30 text-green":"bg-red/10 border-red/30 text-red"}`,children:e.text}):null}function fJ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(!1),[c,d]=T.useState(null),h=()=>{r(null),ce.get("/settings").then(t).catch(r)};T.useEffect(h,[]);const p=async m=>{m.preventDefault(),o(!0),d(null);try{await ce.post("/settings",e),d({type:"green",text:"Instellingen opgeslagen"})}catch(g){d({type:"red",text:g.message||String(g)})}finally{o(!1)}};if(n)return u.jsx(Oe,{error:n,onRetry:h});if(!e)return u.jsx(Ze,{});const v=m=>g=>t({...e,[m]:g.target.value});return u.jsx(Ae,{title:"Algemene instellingen",children:u.jsxs("form",{onSubmit:p,className:"space-y-3 max-w-2xl",children:[u.jsx(AP,{banner:c}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Merknaam",children:u.jsx("input",{className:X,value:e.brand_name||"",onChange:v("brand_name")})}),u.jsx(te,{label:"Taal",children:u.jsxs("select",{className:X,value:e.language||"nl",onChange:v("language"),children:[u.jsx("option",{value:"nl",children:"Nederlands"}),u.jsx("option",{value:"en",children:"English"})]})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"Thema",children:u.jsx("input",{className:X,value:e.theme||"",onChange:v("theme")})}),u.jsx(te,{label:"Showcase URL",children:u.jsx("input",{className:X,value:e.showcase_url||"",onChange:v("showcase_url")})})]}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"Standaard pagina",children:u.jsx("input",{className:X,value:e.default_page||"",onChange:v("default_page")})}),u.jsx(te,{label:"Auto-refresh",children:u.jsxs("select",{className:X,value:String(e.auto_refresh??"0"),onChange:v("auto_refresh"),children:[u.jsx("option",{value:"0",children:"Uit"}),u.jsx("option",{value:"1",children:"Aan"})]})}),u.jsx(te,{label:"Items per pagina",children:u.jsx("input",{type:"number",min:"1",className:X,value:e.items_per_page||"",onChange:v("items_per_page")})})]}),u.jsx("div",{className:"text-[12px] text-muted font-medium pt-1",children:"SMTP (uitgaande e-mail)"}),u.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[u.jsx(te,{label:"SMTP host",className:"col-span-2",children:u.jsx("input",{className:X,value:e.smtp_host||"",onChange:v("smtp_host")})}),u.jsx(te,{label:"SMTP poort",children:u.jsx("input",{className:X,value:e.smtp_port||"",onChange:v("smtp_port")})})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsx(te,{label:"SMTP gebruiker",children:u.jsx("input",{className:X,value:e.smtp_user||"",onChange:v("smtp_user")})}),u.jsx(te,{label:"SMTP wachtwoord",children:u.jsx("input",{type:"password",className:X,value:e.smtp_pass||"",onChange:v("smtp_pass"),placeholder:"••••••••"})})]}),u.jsx(te,{label:"Slack webhook",children:u.jsx("input",{className:X,value:e.slack_webhook||"",onChange:v("slack_webhook")})}),u.jsx("div",{className:"pt-1",children:u.jsx(pe,{type:"submit",loading:l,children:"Opslaan"})})]})})}function dJ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(!1),[c,d]=T.useState(null),[h,p]=T.useState(bM),[v,m]=T.useState(!1),[g,j]=T.useState(null),S=()=>{r(null),ce.get("/users").then(t).catch(r)};T.useEffect(S,[]);const _=()=>{d(null),p(bM),j(null),o(!0)},x=E=>{d(E),p({username:E.username,password:"",email:E.email||"",role:E.role||"viewer"}),j(null),o(!0)},O=async E=>{if(E.preventDefault(),!c&&h.password.length<6){j(new Error("Wachtwoord moet minimaal 6 tekens zijn"));return}m(!0),j(null);try{c?await ce.put(`/users/${c.id}`,{email:h.email,role:h.role,password:h.password||void 0}):await ce.post("/users",h),o(!1),S()}catch(M){j(M)}finally{m(!1)}},w=async()=>{if(c&&window.confirm(`Gebruiker "${c.username}" verwijderen?`)){m(!0),j(null);try{await ce.del(`/users/${c.id}`),o(!1),S()}catch(E){j(E)}finally{m(!1)}}};return n?u.jsx(Oe,{error:n,onRetry:S}):e?u.jsxs(Ae,{title:"Gebruikers",actions:u.jsxs(pe,{size:"sm",onClick:_,children:[u.jsx(qt,{className:"w-3.5 h-3.5"})," Nieuwe gebruiker"]}),children:[u.jsx(Dt,{columns:[{label:"Username",render:E=>u.jsx("span",{className:"font-medium",children:E.username})},{label:"Email",render:E=>u.jsx("span",{className:"text-muted",children:E.email||"-"})},{label:"Rol",render:E=>u.jsx(nt,{color:uJ[E.role]||"muted",children:cJ[E.role]||E.role})},{label:"Aangemaakt",render:E=>u.jsx("span",{className:"text-muted",children:ye.date(E.created_at)})}],rows:e,keyFn:E=>E.id,onRowClick:x}),u.jsx(_t,{open:l,onClose:()=>o(!1),title:c?`Gebruiker "${c.username}" bewerken`:"Nieuwe gebruiker",children:u.jsxs("form",{onSubmit:O,className:"space-y-3",children:[g&&u.jsx(Oe,{error:g}),!c&&u.jsx(te,{label:"Gebruikersnaam *",children:u.jsx("input",{className:X,value:h.username,onChange:E=>p({...h,username:E.target.value}),required:!0})}),u.jsx(te,{label:c?"Nieuw wachtwoord (leeg = behouden)":"Wachtwoord * (min. 6 tekens)",children:u.jsx("input",{type:"password",className:X,value:h.password,onChange:E=>p({...h,password:E.target.value}),required:!c,minLength:c?void 0:6})}),u.jsx(te,{label:"Email",children:u.jsx("input",{type:"email",className:X,value:h.email,onChange:E=>p({...h,email:E.target.value})})}),u.jsx(te,{label:"Rol",children:u.jsxs("select",{className:X,value:h.role,onChange:E=>p({...h,role:E.target.value}),children:[u.jsx("option",{value:"viewer",children:"Viewer"}),u.jsx("option",{value:"consultant",children:"Consultant"}),u.jsx("option",{value:"admin",children:"Admin"})]})}),u.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[u.jsx("div",{children:c&&u.jsxs(pe,{variant:"danger",type:"button",onClick:w,loading:v,children:[u.jsx(zt,{className:"w-3.5 h-3.5"})," Verwijderen"]})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{variant:"secondary",type:"button",onClick:()=>o(!1),children:"Annuleren"}),u.jsx(pe,{type:"submit",loading:v,children:"Opslaan"})]})]})]})})]}):u.jsx(Ze,{})}function hJ(){const[e,t]=T.useState(null),[n,r]=T.useState(null),[l,o]=T.useState(!1),[c,d]=T.useState(null),h=()=>{r(null),ce.get("/backup").then(t).catch(r)};T.useEffect(h,[]);const p=async()=>{o(!0),d(null);try{const m=await ce.post("/backup/create");d({type:"green",text:`Backup gemaakt: ${m.filename}`}),h()}catch(m){d({type:"red",text:m.message||String(m)})}finally{o(!1)}},v=async m=>{if(window.confirm(`Backup "${m.filename}" verwijderen?`)){d(null);try{await ce.post(`/backup/delete/${encodeURIComponent(m.filename)}`),h()}catch(g){d({type:"red",text:g.message||String(g)})}}};return n?u.jsx(Oe,{error:n,onRetry:h}):e?u.jsx(Ae,{title:"Backups",subtitle:"Database- en bestandsbackups",actions:u.jsxs(pe,{size:"sm",onClick:p,loading:l,children:[u.jsx(f8,{className:"w-3.5 h-3.5"})," Backup maken"]}),children:u.jsxs("div",{className:"space-y-3",children:[u.jsx(AP,{banner:c}),u.jsx(Dt,{columns:[{label:"Bestandsnaam",render:m=>u.jsxs("span",{className:"font-medium flex items-center gap-2",children:[u.jsx(h8,{className:"w-3.5 h-3.5 text-muted"}),m.filename]})},{label:"Grootte",render:m=>u.jsx("span",{className:"text-muted",children:m.sizeLabel||m.size||"-"})},{label:"Aangemaakt",render:m=>u.jsx("span",{className:"text-muted",children:ye.datetime(m.created_at)})},{label:"",className:"text-right",render:m=>u.jsx("button",{onClick:()=>v(m),className:"p-1.5 rounded-md text-muted hover:text-red hover:bg-red/10",title:"Verwijderen",children:u.jsx(zt,{className:"w-3.5 h-3.5"})})}],rows:e,keyFn:m=>m.filename,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen backups"})})]})}):u.jsx(Ze,{})}function pJ(){const[e,t]=T.useState(1),[n,r]=T.useState(null),[l,o]=T.useState(null),c=()=>{o(null),ce.get(`/audit?page=${e}`).then(r).catch(o)};return T.useEffect(c,[e]),l?u.jsx(Oe,{error:l,onRetry:c}):n?u.jsxs(Ae,{title:"Audit-log",subtitle:`${n.total} gebeurtenissen`,children:[u.jsx(Dt,{columns:[{label:"Wanneer",render:d=>u.jsx("span",{className:"text-muted whitespace-nowrap",children:ye.datetime(d.created_at)})},{label:"Gebruiker",render:d=>d.username||"-"},{label:"Actie",render:d=>u.jsx(nt,{color:"blue",children:d.action})},{label:"Entiteit",render:d=>u.jsx("span",{className:"text-muted",children:[d.entity_type,d.entity_id].filter(h=>h!=null&&h!=="").join(" #")||"-"})},{label:"Details",render:d=>u.jsx("span",{className:"text-muted block max-w-sm truncate",children:d.details||"-"})}],rows:n.entries,keyFn:d=>d.id,empty:u.jsx("div",{className:"text-center text-muted text-[13px] py-8",children:"Nog geen activiteit"})}),u.jsxs("div",{className:"flex items-center justify-between pt-3 mt-1 border-t border-border-soft",children:[u.jsx(pe,{variant:"secondary",size:"sm",disabled:e<=1,onClick:()=>t(d=>d-1),children:"Vorige"}),u.jsxs("span",{className:"text-[12px] text-muted",children:["Pagina ",n.page," van ",n.totalPages||1]}),u.jsx(pe,{variant:"secondary",size:"sm",disabled:e>=(n.totalPages||1),onClick:()=>t(d=>d+1),children:"Volgende"})]})]}):u.jsx(Ze,{})}function mJ(){const[e,t]=IM(),n=e.get("tab")||"algemeen",r=l=>t({tab:l});return u.jsxs("div",{className:"space-y-5 fade-in",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-bold tracking-tight",children:"Instellingen"}),u.jsx("p",{className:"text-[13px] text-muted mt-0.5",children:"Applicatie-instellingen, gebruikers, backups en audit-log"})]}),u.jsx("div",{className:"flex gap-1 border-b border-border-soft",children:sJ.map(l=>u.jsx("button",{onClick:()=>r(l.key),className:`px-3.5 py-2 text-[13px] font-medium border-b-2 -mb-px transition-colors ${n===l.key?"border-accent text-accent":"border-transparent text-muted hover:text-text"}`,children:l.label},l.key))}),n==="algemeen"&&u.jsx(fJ,{}),n==="gebruikers"&&u.jsx(dJ,{}),n==="backups"&&u.jsx(hJ,{}),n==="audit"&&u.jsx(pJ,{})]})}function vJ(){const{pathname:e}=Sn();return u.jsx(Ar,{icon:u8,title:"Deze module wordt nog gebouwd",hint:`De route ${e} is onderdeel van de nieuwe SPA maar de pagina is nog niet klaar.`})}function yJ(){return u.jsx("div",{className:"h-full flex items-center justify-center",children:u.jsx("div",{className:"w-8 h-8 border-2 border-accent border-t-transparent rounded-full animate-spin"})})}function gJ({children:e}){const{user:t,loading:n}=O0(),r=Sn();return n?u.jsx(yJ,{}):t?e:u.jsx(zM,{to:"/login",state:{from:r},replace:!0})}function bJ(){return u.jsxs(Qw,{children:[u.jsx(ct,{path:"/login",element:u.jsx(k6,{})}),u.jsx(ct,{path:"/*",element:u.jsx(gJ,{children:u.jsx(C6,{children:u.jsxs(Qw,{children:[u.jsx(ct,{path:"/",element:u.jsx(nQ,{})}),u.jsx(ct,{path:"/clients",element:u.jsx(iQ,{})}),u.jsx(ct,{path:"/clients/:id",element:u.jsx(cQ,{})}),u.jsx(ct,{path:"/engagements",element:u.jsx(lQ,{})}),u.jsx(ct,{path:"/engagements/:id",element:u.jsx(xQ,{})}),u.jsx(ct,{path:"/tasks",element:u.jsx(pQ,{})}),u.jsx(ct,{path:"/calendar",element:u.jsx(wQ,{})}),u.jsx(ct,{path:"/email",element:u.jsx(AQ,{})}),u.jsx(ct,{path:"/projects",element:u.jsx(NQ,{})}),u.jsx(ct,{path:"/projects/:id",element:u.jsx(MQ,{})}),u.jsx(ct,{path:"/time",element:u.jsx(PQ,{})}),u.jsx(ct,{path:"/invoices",element:u.jsx(zQ,{})}),u.jsx(ct,{path:"/invoices/:id",element:u.jsx(LQ,{})}),u.jsx(ct,{path:"/finance",element:u.jsx(UQ,{})}),u.jsx(ct,{path:"/racks",element:u.jsx(IQ,{})}),u.jsx(ct,{path:"/racks/:id",element:u.jsx(YQ,{})}),u.jsx(ct,{path:"/networking",element:u.jsx(XQ,{})}),u.jsx(ct,{path:"/diagrams",element:u.jsx(WQ,{})}),u.jsx(ct,{path:"/market",element:u.jsx(eJ,{})}),u.jsx(ct,{path:"/ai",element:u.jsx(nJ,{})}),u.jsx(ct,{path:"/notifications",element:u.jsx(aJ,{})}),u.jsx(ct,{path:"/search",element:u.jsx(oJ,{})}),u.jsx(ct,{path:"/settings",element:u.jsx(mJ,{})}),u.jsx(ct,{path:"*",element:u.jsx(vJ,{})})]})})})})]})}t4.createRoot(document.getElementById("root")).render(u.jsx(Y.StrictMode,{children:u.jsx(w$,{basename:"/app",children:u.jsx(A6,{children:u.jsx(P$,{children:u.jsx(bJ,{})})})})}));
diff --git a/public/spa/assets/index-CQEBt6sl.js b/public/spa/assets/index-CQEBt6sl.js
deleted file mode 100644
index 0bced97..0000000
--- a/public/spa/assets/index-CQEBt6sl.js
+++ /dev/null
@@ -1,451 +0,0 @@
-(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var Zc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Am={exports:{}},hs={};/**
- * @license React
- * react-jsx-runtime.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Dw;function HD(){if(Dw)return hs;Dw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,o){var c=null;if(o!==void 0&&(c=""+o),l.key!==void 0&&(c=""+l.key),"key"in l){o={};for(var d in l)d!=="key"&&(o[d]=l[d])}else o=l;return l=o.ref,{$$typeof:e,type:r,key:c,ref:l!==void 0?l:null,props:o}}return hs.Fragment=t,hs.jsx=n,hs.jsxs=n,hs}var $w;function GD(){return $w||($w=1,Am.exports=HD()),Am.exports}var u=GD(),Nm={exports:{}},Re={};/**
- * @license React
- * react.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var qw;function YD(){if(qw)return Re;qw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function j(L){return L===null||typeof L!="object"?null:(L=g&&L[g]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,x={};function O(L,F,q){this.props=L,this.context=F,this.refs=x,this.updater=q||S}O.prototype.isReactComponent={},O.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,F,"setState")},O.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function w(){}w.prototype=O.prototype;function E(L,F,q){this.props=L,this.context=F,this.refs=x,this.updater=q||S}var M=E.prototype=new w;M.constructor=E,_(M,O.prototype),M.isPureReactComponent=!0;var A=Array.isArray;function C(){}var k={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function B(L,F,q){var de=q.ref;return{$$typeof:e,type:L,key:F,ref:de!==void 0?de:null,props:q}}function Z(L,F){return B(L.type,F,L.props)}function G(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function H(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(q){return F[q]})}var W=/\/+/g;function Q(L,F){return typeof L=="object"&&L!==null&&L.key!=null?H(""+L.key):F.toString(36)}function D(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(C,C):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function P(L,F,q,de,ge){var we=typeof L;(we==="undefined"||we==="boolean")&&(L=null);var $e=!1;if(L===null)$e=!0;else switch(we){case"bigint":case"string":case"number":$e=!0;break;case"object":switch(L.$$typeof){case e:case t:$e=!0;break;case v:return $e=L._init,P($e(L._payload),F,q,de,ge)}}if($e)return ge=ge(L),$e=de===""?"."+Q(L,0):de,A(ge)?(q="",$e!=null&&(q=$e.replace(W,"$&/")+"/"),P(ge,F,q,"",function(Te){return Te})):ge!=null&&(G(ge)&&(ge=Z(ge,q+(ge.key==null||L&&L.key===ge.key?"":(""+ge.key).replace(W,"$&/")+"/")+$e)),F.push(ge)),1;$e=0;var Ge=de===""?".":de+":";if(A(L))for(var me=0;me>>1,fe=P[ie];if(0>>1;iel(q,U))del(ge,q)?(P[ie]=ge,P[de]=U,ie=de):(P[ie]=q,P[F]=U,ie=F);else if(del(ge,U))P[ie]=ge,P[de]=U,ie=de;else break e}}return $}function l(P,$){var U=P.sortIndex-$.sortIndex;return U!==0?U:P.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],p=[],v=1,m=null,g=3,j=!1,S=!1,_=!1,x=!1,O=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function M(P){for(var $=n(p);$!==null;){if($.callback===null)r(p);else if($.startTime<=P)r(p),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(p)}}function A(P){if(_=!1,M(P),!S)if(n(h)!==null)S=!0,C||(C=!0,H());else{var $=n(p);$!==null&&D(A,$.startTime-P)}}var C=!1,k=-1,z=5,B=-1;function Z(){return x?!0:!(e.unstable_now()-BP&&Z());){var ie=m.callback;if(typeof ie=="function"){m.callback=null,g=m.priorityLevel;var fe=ie(m.expirationTime<=P);if(P=e.unstable_now(),typeof fe=="function"){m.callback=fe,M(P),$=!0;break t}m===n(h)&&r(h),M(P)}else r(h);m=n(h)}if(m!==null)$=!0;else{var L=n(p);L!==null&&D(A,L.startTime-P),$=!1}}break e}finally{m=null,g=U,j=!1}$=void 0}}finally{$?H():C=!1}}}var H;if(typeof E=="function")H=function(){E(G)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Q=W.port2;W.port1.onmessage=G,H=function(){Q.postMessage(null)}}else H=function(){O(G,0)};function D(P,$){k=O(function(){P(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125ie?(P.sortIndex=U,t(p,P),n(h)===null&&P===n(p)&&(_?(w(k),k=-1):_=!0,D(A,U-ie))):(P.sortIndex=fe,t(h,P),S||j||(S=!0,C||(C=!0,H()))),P},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(P){var $=g;return function(){var U=g;g=$;try{return P.apply(this,arguments)}finally{g=U}}}})(Cm)),Cm}var Bw;function FD(){return Bw||(Bw=1,Tm.exports=VD()),Tm.exports}var Mm={exports:{}},an={};/**
- * @license React
- * react-dom.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Uw;function KD(){if(Uw)return an;Uw=1;var e=m0();function t(h){var p="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Mm.exports=KD(),Mm.exports}/**
- * @license React
- * react-dom-client.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Hw;function ZD(){if(Hw)return ps;Hw=1;var e=FD(),t=m0(),n=XD();function r(a){var i="https://react.dev/errors/"+a;if(1fe||(a.current=ie[fe],ie[fe]=null,fe--)}function q(a,i){fe++,ie[fe]=a.current,a.current=i}var de=L(null),ge=L(null),we=L(null),$e=L(null);function Ge(a,i){switch(q(we,i),q(ge,a),q(de,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?aw(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=aw(i),a=iw(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}F(de),q(de,a)}function me(){F(de),F(ge),F(we)}function Te(a){a.memoizedState!==null&&q($e,a);var i=de.current,s=iw(i,a.type);i!==s&&(q(ge,a),q(de,s))}function Me(a){ge.current===a&&(F(de),F(ge)),$e.current===a&&(F($e),us._currentValue=U)}var he,st;function ae(a){if(he===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);he=i&&i[1]||"",st=-1)":-1y||I[f]!==ee[y]){var le=`
-`+I[f].replace(" at new "," at ");return a.displayName&&le.includes("")&&(le=le.replace("",a.displayName)),le}while(1<=f&&0<=y);break}}}finally{Ke=!1,Error.prepareStackTrace=s}return(s=a?a.displayName||a.name:"")?ae(s):""}function nn(a,i){switch(a.tag){case 26:case 27:case 5:return ae(a.type);case 16:return ae("Lazy");case 13:return a.child!==i&&i!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return St(a.type,!1);case 11:return St(a.type.render,!1);case 1:return St(a.type,!0);case 31:return ae("Activity");default:return""}}function ar(a){try{var i="",s=null;do i+=nn(a,s),s=a,a=a.return;while(a);return i}catch(f){return`
-Error generating stack: `+f.message+`
-`+f.stack}}var yr=Object.prototype.hasOwnProperty,ca=e.unstable_scheduleCallback,ir=e.unstable_cancelCallback,Tr=e.unstable_shouldYield,xo=e.unstable_requestPaint,rn=e.unstable_now,ku=e.unstable_getCurrentPriorityLevel,$1=e.unstable_ImmediatePriority,q1=e.unstable_UserBlockingPriority,Ru=e.unstable_NormalPriority,wP=e.unstable_LowPriority,z1=e.unstable_IdlePriority,OP=e.log,AP=e.unstable_setDisableYieldValue,jo=null,On=null;function fa(a){if(typeof OP=="function"&&AP(a),On&&typeof On.setStrictMode=="function")try{On.setStrictMode(jo,a)}catch{}}var An=Math.clz32?Math.clz32:TP,NP=Math.log,EP=Math.LN2;function TP(a){return a>>>=0,a===0?32:31-(NP(a)/EP|0)|0}var Pu=256,Du=262144,$u=4194304;function Xa(a){var i=a&42;if(i!==0)return i;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function qu(a,i,s){var f=a.pendingLanes;if(f===0)return 0;var y=0,b=a.suspendedLanes,N=a.pingedLanes;a=a.warmLanes;var R=f&134217727;return R!==0?(f=R&~b,f!==0?y=Xa(f):(N&=R,N!==0?y=Xa(N):s||(s=R&~a,s!==0&&(y=Xa(s))))):(R=f&~b,R!==0?y=Xa(R):N!==0?y=Xa(N):s||(s=f&~a,s!==0&&(y=Xa(s)))),y===0?0:i!==0&&i!==y&&(i&b)===0&&(b=y&-y,s=i&-i,b>=s||b===32&&(s&4194048)!==0)?i:y}function _o(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function CP(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function L1(){var a=$u;return $u<<=1,($u&62914560)===0&&($u=4194304),a}function ph(a){for(var i=[],s=0;31>s;s++)i.push(a);return i}function So(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function MP(a,i,s,f,y,b){var N=a.pendingLanes;a.pendingLanes=s,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=s,a.entangledLanes&=s,a.errorRecoveryDisabledLanes&=s,a.shellSuspendCounter=0;var R=a.entanglements,I=a.expirationTimes,ee=a.hiddenUpdates;for(s=N&~s;0"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var qP=/[\n"\\]/g;function Bn(a){return a.replace(qP,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function xh(a,i,s,f,y,b,N,R){a.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.type=N:a.removeAttribute("type"),i!=null?N==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+Ln(i)):a.value!==""+Ln(i)&&(a.value=""+Ln(i)):N!=="submit"&&N!=="reset"||a.removeAttribute("value"),i!=null?jh(a,N,Ln(i)):s!=null?jh(a,N,Ln(s)):f!=null&&a.removeAttribute("value"),y==null&&b!=null&&(a.defaultChecked=!!b),y!=null&&(a.checked=y&&typeof y!="function"&&typeof y!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?a.name=""+Ln(R):a.removeAttribute("name")}function Q1(a,i,s,f,y,b,N,R){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(a.type=b),i!=null||s!=null){if(!(b!=="submit"&&b!=="reset"||i!=null)){bh(a);return}s=s!=null?""+Ln(s):"",i=i!=null?""+Ln(i):s,R||i===a.value||(a.value=i),a.defaultValue=i}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,a.checked=R?a.checked:!!f,a.defaultChecked=!!f,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(a.name=N),bh(a)}function jh(a,i,s){i==="number"&&Bu(a.ownerDocument)===a||a.defaultValue===""+s||(a.defaultValue=""+s)}function Gi(a,i,s,f){if(a=a.options,i){i={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ah=!1;if(kr)try{var No={};Object.defineProperty(No,"passive",{get:function(){Ah=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{Ah=!1}var ha=null,Nh=null,Iu=null;function ij(){if(Iu)return Iu;var a,i=Nh,s=i.length,f,y="value"in ha?ha.value:ha.textContent,b=y.length;for(a=0;a