=0?1:-1,l=n>=0?1:-1,u=i>=0&&n>=0||i<0&&n<0?1:0,c;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],d=0,p=4;do?o:a[d];c="M".concat(t,",").concat(r+s*f[0]),f[0]>0&&(c+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+l*f[0],",").concat(r)),c+="L ".concat(t+n-l*f[1],",").concat(r),f[1]>0&&(c+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
- `).concat(t+n,",").concat(r+s*f[1])),c+="L ".concat(t+n,",").concat(r+i-s*f[2]),f[2]>0&&(c+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
- `).concat(t+n-l*f[2],",").concat(r+i)),c+="L ".concat(t+l*f[3],",").concat(r+i),f[3]>0&&(c+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
- `).concat(t,",").concat(r+i-s*f[3])),c+="Z"}else if(o>0&&a===+a&&a>0){var v=Math.min(o,a);c="M ".concat(t,",").concat(r+s*v,`
- A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+l*v,",").concat(r,`
- L `).concat(t+n-l*v,",").concat(r,`
- A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n,",").concat(r+s*v,`
- L `).concat(t+n,",").concat(r+i-s*v,`
- A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n-l*v,",").concat(r+i,`
- L `).concat(t+l*v,",").concat(r+i,`
- A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t,",").concat(r+i-s*v," Z")}else c="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return c},aie=function(t,r){if(!t||!r)return!1;var n=t.x,i=t.y,a=r.x,o=r.y,s=r.width,l=r.height;if(Math.abs(s)>0&&Math.abs(l)>0){var u=Math.min(a,a+s),c=Math.max(a,a+s),f=Math.min(o,o+l),d=Math.max(o,o+l);return n>=u&&n<=c&&i>=f&&i<=d}return!1},oie={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Bx=function(t){var r=aE(aE({},oie),t),n=A.useRef(),i=A.useState(-1),a=Qne(i,2),o=a[0],s=a[1];A.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var S=n.current.getTotalLength();S&&s(S)}catch{}},[]);var l=r.x,u=r.y,c=r.width,f=r.height,d=r.radius,p=r.className,v=r.animationEasing,m=r.animationDuration,g=r.animationBegin,y=r.isAnimationActive,b=r.isUpdateAnimationActive;if(l!==+l||u!==+u||c!==+c||f!==+f||c===0||f===0)return null;var x=ue("recharts-rectangle",p);return b?N.createElement(on,{canBegin:o>0,from:{width:c,height:f,x:l,y:u},to:{width:c,height:f,x:l,y:u},duration:m,animationEasing:v,isActive:b},function(S){var w=S.width,O=S.height,P=S.x,E=S.y;return N.createElement(on,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:m,isActive:y,easing:v},N.createElement("path",mh({},te(r,!0),{className:x,d:oE(P,E,w,O,d),ref:n})))}):N.createElement("path",mh({},te(r,!0),{className:x,d:oE(l,u,c,f,d)}))},sie=["points","className","baseLinePoints","connectNulls"];function Ro(){return Ro=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function uie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function sE(e){return hie(e)||die(e)||fie(e)||cie()}function cie(){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 fie(e,t){if(e){if(typeof e=="string")return t0(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t0(e,t)}}function die(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hie(e){if(Array.isArray(e))return t0(e)}function t0(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){lE(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),lE(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},iu=function(t,r){var n=pie(t);r&&(n=[n.reduce(function(a,o){return[].concat(sE(a),sE(o))},[])]);var i=n.map(function(a){return a.reduce(function(o,s,l){return"".concat(o).concat(l===0?"M":"L").concat(s.x,",").concat(s.y)},"")}).join("");return n.length===1?"".concat(i,"Z"):i},mie=function(t,r,n){var i=iu(t,n);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(iu(r.reverse(),n).slice(1))},vie=function(t){var r=t.points,n=t.className,i=t.baseLinePoints,a=t.connectNulls,o=lie(t,sie);if(!r||!r.length)return null;var s=ue("recharts-polygon",n);if(i&&i.length){var l=o.stroke&&o.stroke!=="none",u=mie(r,i,a);return N.createElement("g",{className:s},N.createElement("path",Ro({},te(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),l?N.createElement("path",Ro({},te(o,!0),{fill:"none",d:iu(r,a)})):null,l?N.createElement("path",Ro({},te(o,!0),{fill:"none",d:iu(i,a)})):null)}var c=iu(r,a);return N.createElement("path",Ro({},te(o,!0),{fill:c.slice(-1)==="Z"?o.fill:"none",className:s,d:c}))};function r0(){return r0=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Pie=function(t,r,n,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},Eie=function(t){var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.top,s=o===void 0?0:o,l=t.left,u=l===void 0?0:l,c=t.width,f=c===void 0?0:c,d=t.height,p=d===void 0?0:d,v=t.className,m=Sie(t,yie),g=gie({x:n,y:a,top:s,left:u,width:f,height:p},m);return!q(n)||!q(a)||!q(f)||!q(p)||!q(s)||!q(u)?null:N.createElement("path",n0({},te(g,!0),{className:ue("recharts-cross",v),d:Pie(n,a,f,p,s,u)}))},Aie=Lp,jie=bC,_ie=jn;function Tie(e,t){return e&&e.length?Aie(e,_ie(t),jie):void 0}var kie=Tie;const Nie=Ae(kie);var Cie=Lp,$ie=jn,Mie=xC;function Iie(e,t){return e&&e.length?Cie(e,$ie(t),Mie):void 0}var Die=Iie;const Rie=Ae(Die);var Lie=["cx","cy","angle","ticks","axisLine"],Fie=["ticks","tick","angle","tickFormatter","stroke"];function _s(e){"@babel/helpers - typeof";return _s=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},_s(e)}function au(){return au=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Bie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dE(e,t){for(var r=0;rmE?o=i==="outer"?"start":"end":a<-mE?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.cx,a=n.cy,o=n.radius,s=n.axisLine,l=n.axisLineType,u=ua(ua({},te(this.props,!1)),{},{fill:"none"},te(s,!1));if(l==="circle")return N.createElement(Wp,va({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:a,r:o}));var c=this.props.ticks,f=c.map(function(d){return Le(i,a,o,d.coordinate)});return N.createElement(vie,va({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,i=this.props,a=i.ticks,o=i.tick,s=i.tickLine,l=i.tickFormatter,u=i.stroke,c=te(this.props,!1),f=te(o,!1),d=ua(ua({},c),{},{fill:"none"},te(s,!1)),p=a.map(function(v,m){var g=n.getTickLineCoord(v),y=n.getTickTextAnchor(v),b=ua(ua(ua({textAnchor:y},c),{},{stroke:"none",fill:u},f),{},{index:m,payload:v,x:g.x2,y:g.y2});return N.createElement(he,va({className:ue("recharts-polar-angle-axis-tick",GC(o)),key:"tick-".concat(v.coordinate)},Yi(n.props,v,m)),s&&N.createElement("line",va({className:"recharts-polar-angle-axis-tick-line"},d,g)),o&&t.renderTickItem(o,b,l?l(v.value,m):v.value))});return N.createElement(he,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,i=n.ticks,a=n.radius,o=n.axisLine;return a<=0||!i||!i.length?null:N.createElement(he,{className:ue("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,i,a){var o;return N.isValidElement(n)?o=N.cloneElement(n,i):oe(n)?o=n(i):o=N.createElement(Qa,va({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])}(A.PureComponent);qp(Vp,"displayName","PolarAngleAxis");qp(Vp,"axisType","angleAxis");qp(Vp,"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 rae=mN,nae=rae(Object.getPrototypeOf,Object),iae=nae,aae=ii,oae=iae,sae=ai,lae="[object Object]",uae=Function.prototype,cae=Object.prototype,d$=uae.toString,fae=cae.hasOwnProperty,dae=d$.call(Object);function hae(e){if(!sae(e)||aae(e)!=lae)return!1;var t=oae(e);if(t===null)return!0;var r=fae.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&d$.call(r)==dae}var pae=hae;const mae=Ae(pae);var vae=ii,yae=ai,gae="[object Boolean]";function bae(e){return e===!0||e===!1||yae(e)&&vae(e)==gae}var xae=bae;const wae=Ae(xae);function ic(e){"@babel/helpers - typeof";return ic=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},ic(e)}function gh(){return gh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0,from:{upperWidth:0,lowerWidth:0,height:d,x:l,y:u},to:{upperWidth:c,lowerWidth:f,height:d,x:l,y:u},duration:m,animationEasing:v,isActive:y},function(x){var S=x.upperWidth,w=x.lowerWidth,O=x.height,P=x.x,E=x.y;return N.createElement(on,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:m,easing:v},N.createElement("path",gh({},te(r,!0),{className:b,d:bE(P,E,S,w,O),ref:n})))}):N.createElement("g",null,N.createElement("path",gh({},te(r,!0),{className:b,d:bE(l,u,c,f,d)})))},Cae=["option","shapeType","propTransformer","activeClassName","isActive"];function ac(e){"@babel/helpers - typeof";return ac=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},ac(e)}function $ae(e,t){if(e==null)return{};var r=Mae(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Mae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function xE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bh(e){for(var t=1;t0?gr(x,"paddingAngle",0):0;if(w){var P=At(w.endAngle-w.startAngle,x.endAngle-x.startAngle),E=Me(Me({},x),{},{startAngle:b+O,endAngle:b+P(m)+O});g.push(E),b=E.endAngle}else{var j=x.endAngle,_=x.startAngle,T=At(0,j-_),k=T(m),M=Me(Me({},x),{},{startAngle:b+O,endAngle:b+k+O});g.push(M),b=M.endAngle}}),N.createElement(he,null,n.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(n){var i=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var s=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,i=n.sectors,a=n.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!dl(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,i=this.props,a=i.hide,o=i.sectors,s=i.className,l=i.label,u=i.cx,c=i.cy,f=i.innerRadius,d=i.outerRadius,p=i.isAnimationActive,v=this.state.isAnimationFinished;if(a||!o||!o.length||!q(u)||!q(c)||!q(f)||!q(d))return null;var m=ue("recharts-pie",s);return N.createElement(he,{tabIndex:this.props.rootTabIndex,className:m,ref:function(y){n.pieRef=y}},this.renderSectors(),l&&this.renderLabels(o),bt.renderCallByParent(this.props,null,!1),(!p||v)&&Sn.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return i.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:n.sectors!==i.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,i){return n>i?"start":n=360?b:b-1)*l,S=g-b*p-x,w=i.reduce(function(E,j){var _=Ve(j,y,0);return E+(q(_)?_:0)},0),O;if(w>0){var P;O=i.map(function(E,j){var _=Ve(E,y,0),T=Ve(E,c,j),k=(q(_)?_:0)/w,M;j?M=P.endAngle+Ut(m)*l*(_!==0?1:0):M=o;var R=M+Ut(m)*((_!==0?p:0)+k*S),I=(M+R)/2,L=(v.innerRadius+v.outerRadius)/2,z=[{name:T,value:_,payload:E,dataKey:y,type:d}],C=Le(v.cx,v.cy,L,I);return P=Me(Me(Me({percent:k,cornerRadius:a,name:T,tooltipPayload:z,midAngle:I,middleRadius:L,tooltipPosition:C},E),v),{},{value:Ve(E,y),startAngle:M,endAngle:R,payload:E,paddingAngle:Ut(m)*l}),P})}return Me(Me({},v),{},{sectors:O,data:i})});var toe=Math.ceil,roe=Math.max;function noe(e,t,r,n){for(var i=-1,a=roe(toe((t-e)/(r||1)),0),o=Array(a);a--;)o[n?a:++i]=e,e+=r;return o}var ioe=noe,aoe=MN,PE=1/0,ooe=17976931348623157e292;function soe(e){if(!e)return e===0?e:0;if(e=aoe(e),e===PE||e===-PE){var t=e<0?-1:1;return t*ooe}return e===e?e:0}var m$=soe,loe=ioe,uoe=Np,pv=m$;function coe(e){return function(t,r,n){return n&&typeof n!="number"&&uoe(t,r,n)&&(r=n=void 0),t=pv(t),r===void 0?(r=t,t=0):r=pv(r),n=n===void 0?t0&&n.handleDrag(i.changedTouches[0])}),dr(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,s=i.startIndex;o==null||o({endIndex:a,startIndex:s})}),n.detachDragEndListener()}),dr(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),dr(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),dr(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),dr(n,"handleSlideDragStart",function(i){var a=TE(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return Poe(t,e),xoe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,s=this.props,l=s.gap,u=s.data,c=u.length-1,f=Math.min(i,a),d=Math.max(i,a),p=t.getIndexInRange(o,f),v=t.getIndexInRange(o,d);return{startIndex:p-p%l,endIndex:v===c?c:v-v%l}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,s=i.dataKey,l=Ve(a[n],s,n);return oe(o)?o(l,n):l}},{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(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,s=i.endX,l=this.props,u=l.x,c=l.width,f=l.travellerWidth,d=l.startIndex,p=l.endIndex,v=l.onChange,m=n.pageX-a;m>0?m=Math.min(m,u+c-f-s,u+c-f-o):m<0&&(m=Math.max(m,u-o,u-s));var g=this.getIndex({startX:o+m,endX:s+m});(g.startIndex!==d||g.endIndex!==p)&&v&&v(g),this.setState({startX:o+m,endX:s+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=TE(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,s=i.endX,l=i.startX,u=this.state[o],c=this.props,f=c.x,d=c.width,p=c.travellerWidth,v=c.onChange,m=c.gap,g=c.data,y={startX:this.state.startX,endX:this.state.endX},b=n.pageX-a;b>0?b=Math.min(b,f+d-p-u):b<0&&(b=Math.max(b,f-u)),y[o]=u+b;var x=this.getIndex(y),S=x.startIndex,w=x.endIndex,O=function(){var E=g.length-1;return o==="startX"&&(s>l?S%m===0:w%m===0)||sl?w%m===0:S%m===0)||s>l&&w===E};this.setState(dr(dr({},o,u+b),"brushMoveStartX",n.pageX),function(){v&&O()&&v(x)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,s=o.scaleValues,l=o.startX,u=o.endX,c=this.state[i],f=s.indexOf(c);if(f!==-1){var d=f+n;if(!(d===-1||d>=s.length)){var p=s[d];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState(dr({},i,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,s=n.height,l=n.fill,u=n.stroke;return N.createElement("rect",{stroke:u,fill:l,x:i,y:a,width:o,height:s})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,s=n.height,l=n.data,u=n.children,c=n.padding,f=A.Children.only(u);return f?N.cloneElement(f,{x:i,y:a,width:o,height:s,margin:c,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,s=this,l=this.props,u=l.y,c=l.travellerWidth,f=l.height,d=l.traveller,p=l.ariaLabel,v=l.data,m=l.startIndex,g=l.endIndex,y=Math.max(n,this.props.x),b=mv(mv({},te(this.props,!1)),{},{x:y,y:u,width:c,height:f}),x=p||"Min value: ".concat((a=v[m])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=v[g])===null||o===void 0?void 0:o.name);return N.createElement(he,{tabIndex:0,role:"slider","aria-label":x,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(w){["ArrowLeft","ArrowRight"].includes(w.key)&&(w.preventDefault(),w.stopPropagation(),s.handleTravellerMoveKeyboard(w.key==="ArrowRight"?1:-1,i))},onFocus:function(){s.setState({isTravellerFocused:!0})},onBlur:function(){s.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(d,b))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,s=a.height,l=a.stroke,u=a.travellerWidth,c=Math.min(n,i)+u,f=Math.max(Math.abs(i-n)-u,0);return N.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:c,y:o,width:f,height:s})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,s=n.height,l=n.travellerWidth,u=n.stroke,c=this.state,f=c.startX,d=c.endX,p=5,v={pointerEvents:"none",fill:u};return N.createElement(he,{className:"recharts-brush-texts"},N.createElement(Qa,Oh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,d)-p,y:o+s/2},v),this.getTextOfTick(i)),N.createElement(Qa,Oh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,d)+l+p,y:o+s/2},v),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,s=n.x,l=n.y,u=n.width,c=n.height,f=n.alwaysShowText,d=this.state,p=d.startX,v=d.endX,m=d.isTextActive,g=d.isSlideMoving,y=d.isTravellerMoving,b=d.isTravellerFocused;if(!i||!i.length||!q(s)||!q(l)||!q(u)||!q(c)||u<=0||c<=0)return null;var x=ue("recharts-brush",a),S=N.Children.count(o)===1,w=goe("userSelect","none");return N.createElement(he,{className:x,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:w},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,v),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(v,"endX"),(m||g||y||b||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,s=n.height,l=n.stroke,u=Math.floor(a+s/2)-1;return N.createElement(N.Fragment,null,N.createElement("rect",{x:i,y:a,width:o,height:s,fill:l,stroke:"none"}),N.createElement("line",{x1:i+1,y1:u,x2:i+o-1,y2:u,fill:"none",stroke:"#fff"}),N.createElement("line",{x1:i+1,y1:u+2,x2:i+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return N.isValidElement(n)?a=N.cloneElement(n,i):oe(n)?a=n(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,s=n.x,l=n.travellerWidth,u=n.updateId,c=n.startIndex,f=n.endIndex;if(a!==i.prevData||u!==i.prevUpdateId)return mv({prevData:a,prevTravellerWidth:l,prevUpdateId:u,prevX:s,prevWidth:o},a&&a.length?Aoe({data:a,width:o,x:s,travellerWidth:l,startIndex:c,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||s!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([s,s+o-l]);var d=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:a,prevTravellerWidth:l,prevUpdateId:u,prevX:s,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:d}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,s=a-1;s-o>1;){var l=Math.floor((o+s)/2);n[l]>i?s=l:o=l}return i>=n[s]?s:o}}])}(A.PureComponent);dr(Cs,"displayName","Brush");dr(Cs,"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 joe=dx;function _oe(e,t){var r;return joe(e,function(n,i,a){return r=t(n,i,a),!r}),!!r}var Toe=_oe,koe=sN,Noe=jn,Coe=Toe,$oe=cr,Moe=Np;function Ioe(e,t,r){var n=$oe(e)?koe:Coe;return r&&Moe(e,t,r)&&(t=void 0),n(e,Noe(t))}var Doe=Ioe;const Roe=Ae(Doe);var On=function(t,r){var n=t.alwaysShow,i=t.ifOverflow;return n&&(i="extendDomain"),i===r},kE=TN;function Loe(e,t,r){t=="__proto__"&&kE?kE(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Foe=Loe,Boe=Foe,zoe=jN,Uoe=jn;function Woe(e,t){var r={};return t=Uoe(t),zoe(e,function(n,i,a){Boe(r,i,t(n,i,a))}),r}var Hoe=Woe;const Koe=Ae(Hoe);function qoe(e,t){for(var r=-1,n=e==null?0:e.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function use(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function cse(e,t){var r=e.x,n=e.y,i=lse(e,ise),a="".concat(r),o=parseInt(a,10),s="".concat(n),l=parseInt(s,10),u="".concat(t.height||i.height),c=parseInt(u,10),f="".concat(t.width||i.width),d=parseInt(f,10);return Ll(Ll(Ll(Ll(Ll({},t),i),o?{x:o}:{}),l?{y:l}:{}),{},{height:c,width:d,name:t.name,radius:t.radius})}function CE(e){return N.createElement(xh,l0({shapeType:"rectangle",propTransformer:cse,activeClassName:"recharts-active-bar"},e))}var fse=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof t=="number")return t;var a=q(n)||N8(n);return a?t(n,i):(a||Za(),r)}},dse=["value","background"],x$;function $s(e){"@babel/helpers - typeof";return $s=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},$s(e)}function hse(e,t){if(e==null)return{};var r=pse(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pse(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Eh(){return Eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(I)0&&Math.abs(R)0&&(M=Math.min((re||0)-(R[be-1]||0),M))}),Number.isFinite(M)){var I=M/k,L=m.layout==="vertical"?n.height:n.width;if(m.padding==="gap"&&(P=I*L/2),m.padding==="no-gap"){var z=Wt(t.barCategoryGap,I*L),C=I*L/2;P=C-z-(C-z)/L*z}}}i==="xAxis"?E=[n.left+(x.left||0)+(P||0),n.left+n.width-(x.right||0)-(P||0)]:i==="yAxis"?E=l==="horizontal"?[n.top+n.height-(x.bottom||0),n.top+(x.top||0)]:[n.top+(x.top||0)+(P||0),n.top+n.height-(x.bottom||0)-(P||0)]:E=m.range,w&&(E=[E[1],E[0]]);var F=zC(m,a,d),W=F.scale,V=F.realScaleType;W.domain(y).range(E),UC(W);var H=WC(W,Yr(Yr({},m),{},{realScaleType:V}));i==="xAxis"?(T=g==="top"&&!S||g==="bottom"&&S,j=n.left,_=f[O]-T*m.height):i==="yAxis"&&(T=g==="left"&&!S||g==="right"&&S,j=f[O]-T*m.width,_=n.top);var Y=Yr(Yr(Yr({},m),H),{},{realScaleType:V,x:j,y:_,scale:W,width:i==="xAxis"?n.width:m.width,height:i==="yAxis"?n.height:m.height});return Y.bandSize=lh(Y,H),!m.hide&&i==="xAxis"?f[O]+=(T?-1:1)*Y.height:m.hide||(f[O]+=(T?-1:1)*Y.width),Yr(Yr({},p),{},Xp({},v,Y))},{})},E$=function(t,r){var n=t.x,i=t.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},Ese=function(t){var r=t.x1,n=t.y1,i=t.x2,a=t.y2;return E$({x:r,y:n},{x:i,y:a})},A$=function(){function e(t){Sse(this,e),this.scale=t}return Ose(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(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(r)+s}default:return this.scale(r)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+l}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new e(r)}}])}();Xp(A$,"EPS",1e-4);var zx=function(t){var r=Object.keys(t).reduce(function(n,i){return Yr(Yr({},n),{},Xp({},i,A$.create(t[i])))},{});return Yr(Yr({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,s=a.position;return Koe(i,function(l,u){return r[u].apply(l,{bandAware:o,position:s})})},isInRange:function(i){return b$(i,function(a,o){return r[o].isInRange(a)})}})};function Ase(e){return(e%180+180)%180}var jse=function(t){var r=t.width,n=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Ase(i),o=a*Math.PI/180,s=Math.atan(n/r),l=o>s&&o-1?i[a?t[o]:o]:void 0}}var Cse=Nse,$se=m$;function Mse(e){var t=$se(e),r=t%1;return t===t?r?t-r:t:0}var Ise=Mse,Dse=wN,Rse=jn,Lse=Ise,Fse=Math.max;function Bse(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var i=r==null?0:Lse(r);return i<0&&(i=Fse(n+i,0)),Dse(e,Rse(t),i)}var zse=Bse,Use=Cse,Wse=zse,Hse=Use(Wse),Kse=Hse;const qse=Ae(Kse);var Vse=RU(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("")}),Ux=A.createContext(void 0),Wx=A.createContext(void 0),j$=A.createContext(void 0),_$=A.createContext({}),T$=A.createContext(void 0),k$=A.createContext(0),N$=A.createContext(0),RE=function(t){var r=t.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=t.clipPathId,s=t.children,l=t.width,u=t.height,c=Vse(a);return N.createElement(Ux.Provider,{value:n},N.createElement(Wx.Provider,{value:i},N.createElement(_$.Provider,{value:a},N.createElement(j$.Provider,{value:c},N.createElement(T$.Provider,{value:o},N.createElement(k$.Provider,{value:u},N.createElement(N$.Provider,{value:l},s)))))))},Gse=function(){return A.useContext(T$)},C$=function(t){var r=A.useContext(Ux);r==null&&Za();var n=r[t];return n==null&&Za(),n},Yse=function(){var t=A.useContext(Ux);return xi(t)},Xse=function(){var t=A.useContext(Wx),r=qse(t,function(n){return b$(n.domain,Number.isFinite)});return r||xi(t)},$$=function(t){var r=A.useContext(Wx);r==null&&Za();var n=r[t];return n==null&&Za(),n},Qse=function(){var t=A.useContext(j$);return t},Jse=function(){return A.useContext(_$)},Hx=function(){return A.useContext(N$)},Kx=function(){return A.useContext(k$)};function Ms(e){"@babel/helpers - typeof";return Ms=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},Ms(e)}function Zse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ele(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);re*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function Ile(e,t){return B$(e,t+1)}function Dle(e,t,r,n,i){for(var a=(n||[]).slice(),o=t.start,s=t.end,l=0,u=1,c=o,f=function(){var v=n==null?void 0:n[l];if(v===void 0)return{v:B$(n,u)};var m=l,g,y=function(){return g===void 0&&(g=r(v,m)),g},b=v.coordinate,x=l===0||kh(e,b,y,c,s);x||(l=0,c=o,u+=1),x&&(c=b+e*(y()/2+i),l+=u)},d;u<=a.length;)if(d=f(),d)return d.v;return[]}function cc(e){"@babel/helpers - typeof";return cc=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},cc(e)}function KE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Nt(e){for(var t=1;t0?p.coordinate-g*e:p.coordinate})}else a[d]=p=Nt(Nt({},p),{},{tickCoord:p.coordinate});var y=kh(e,p.tickCoord,m,s,l);y&&(l=p.tickCoord-e*(m()/2+i),a[d]=Nt(Nt({},p),{},{isShow:!0}))},c=o-1;c>=0;c--)u(c);return a}function zle(e,t,r,n,i,a){var o=(n||[]).slice(),s=o.length,l=t.start,u=t.end;if(a){var c=n[s-1],f=r(c,s-1),d=e*(c.coordinate+e*f/2-u);o[s-1]=c=Nt(Nt({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate});var p=kh(e,c.tickCoord,function(){return f},l,u);p&&(u=c.tickCoord-e*(f/2+i),o[s-1]=Nt(Nt({},c),{},{isShow:!0}))}for(var v=a?s-1:s,m=function(b){var x=o[b],S,w=function(){return S===void 0&&(S=r(x,b)),S};if(b===0){var O=e*(x.coordinate-e*w()/2-l);o[b]=x=Nt(Nt({},x),{},{tickCoord:O<0?x.coordinate-O*e:x.coordinate})}else o[b]=x=Nt(Nt({},x),{},{tickCoord:x.coordinate});var P=kh(e,x.tickCoord,w,l,u);P&&(l=x.tickCoord+e*(w()/2+i),o[b]=Nt(Nt({},x),{},{isShow:!0}))},g=0;g=2?Ut(i[1].coordinate-i[0].coordinate):1,y=Mle(a,g,p);return l==="equidistantPreserveStart"?Dle(g,y,m,i,o):(l==="preserveStart"||l==="preserveStartEnd"?d=zle(g,y,m,i,o,l==="preserveStartEnd"):d=Ble(g,y,m,i,o),d.filter(function(b){return b.isShow}))}var Ule=["viewBox"],Wle=["viewBox"],Hle=["ticks"];function Rs(e){"@babel/helpers - typeof";return Rs=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},Rs(e)}function Fo(){return Fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Kle(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function qle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VE(e,t){for(var r=0;r0?l(this.props):l(p)),o<=0||s<=0||!v||!v.length?null:N.createElement(he,{className:ue("recharts-cartesian-axis",u),ref:function(g){n.layerReference=g}},a&&this.renderAxisLine(),this.renderTicks(v,this.state.fontSize,this.state.letterSpacing),bt.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,s=ue(i.className,"recharts-cartesian-axis-tick-value");return N.isValidElement(n)?o=N.cloneElement(n,ct(ct({},i),{},{className:s})):oe(n)?o=n(ct(ct({},i),{},{className:s})):o=N.createElement(Qa,Fo({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(A.Component);Yx(vl,"displayName","CartesianAxis");Yx(vl,"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 Zle=["x1","y1","x2","y2","key"],eue=["offset"];function eo(e){"@babel/helpers - typeof";return eo=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},eo(e)}function GE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mt(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var aue=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,i=t.x,a=t.y,o=t.width,s=t.height,l=t.ry;return N.createElement("rect",{x:i,y:a,ry:l,width:o,height:s,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function W$(e,t){var r;if(N.isValidElement(e))r=N.cloneElement(e,t);else if(oe(e))r=e(t);else{var n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.key,l=YE(t,Zle),u=te(l,!1);u.offset;var c=YE(u,eue);r=N.createElement("line",Ea({},c,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:s}))}return r}function oue(e){var t=e.x,r=e.width,n=e.horizontal,i=n===void 0?!0:n,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,l){var u=Mt(Mt({},e),{},{x1:t,y1:s,x2:t+r,y2:s,key:"line-".concat(l),index:l});return W$(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function sue(e){var t=e.y,r=e.height,n=e.vertical,i=n===void 0?!0:n,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,l){var u=Mt(Mt({},e),{},{x1:s,y1:t,x2:s,y2:t+r,key:"line-".concat(l),index:l});return W$(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function lue(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,l=e.horizontal,u=l===void 0?!0:l;if(!u||!t||!t.length)return null;var c=s.map(function(d){return Math.round(d+i-i)}).sort(function(d,p){return d-p});i!==c[0]&&c.unshift(0);var f=c.map(function(d,p){var v=!c[p+1],m=v?i+o-d:c[p+1]-d;if(m<=0)return null;var g=p%t.length;return N.createElement("rect",{key:"react-".concat(p),y:d,x:n,height:m,width:a,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function uue(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,l=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var c=u.map(function(d){return Math.round(d+a-a)}).sort(function(d,p){return d-p});a!==c[0]&&c.unshift(0);var f=c.map(function(d,p){var v=!c[p+1],m=v?a+s-d:c[p+1]-d;if(m<=0)return null;var g=p%n.length;return N.createElement("rect",{key:"react-".concat(p),x:d,y:o,width:m,height:l,stroke:"none",fill:n[g],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var cue=function(t,r){var n=t.xAxis,i=t.width,a=t.height,o=t.offset;return BC(Gx(Mt(Mt(Mt({},vl.defaultProps),n),{},{ticks:zn(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},fue=function(t,r){var n=t.yAxis,i=t.width,a=t.height,o=t.offset;return BC(Gx(Mt(Mt(Mt({},vl.defaultProps),n),{},{ticks:zn(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},bo={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Ls(e){var t,r,n,i,a,o,s=Hx(),l=Kx(),u=Jse(),c=Mt(Mt({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:bo.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:bo.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:bo.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:bo.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:bo.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:bo.verticalFill,x:q(e.x)?e.x:u.left,y:q(e.y)?e.y:u.top,width:q(e.width)?e.width:u.width,height:q(e.height)?e.height:u.height}),f=c.x,d=c.y,p=c.width,v=c.height,m=c.syncWithTicks,g=c.horizontalValues,y=c.verticalValues,b=Yse(),x=Xse();if(!q(p)||p<=0||!q(v)||v<=0||!q(f)||f!==+f||!q(d)||d!==+d)return null;var S=c.verticalCoordinatesGenerator||cue,w=c.horizontalCoordinatesGenerator||fue,O=c.horizontalPoints,P=c.verticalPoints;if((!O||!O.length)&&oe(w)){var E=g&&g.length,j=w({yAxis:x?Mt(Mt({},x),{},{ticks:E?g:x.ticks}):void 0,width:s,height:l,offset:u},E?!0:m);tn(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(eo(j),"]")),Array.isArray(j)&&(O=j)}if((!P||!P.length)&&oe(S)){var _=y&&y.length,T=S({xAxis:b?Mt(Mt({},b),{},{ticks:_?y:b.ticks}):void 0,width:s,height:l,offset:u},_?!0:m);tn(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(eo(T),"]")),Array.isArray(T)&&(P=T)}return N.createElement("g",{className:"recharts-cartesian-grid"},N.createElement(aue,{fill:c.fill,fillOpacity:c.fillOpacity,x:c.x,y:c.y,width:c.width,height:c.height,ry:c.ry}),N.createElement(oue,Ea({},c,{offset:u,horizontalPoints:O,xAxis:b,yAxis:x})),N.createElement(sue,Ea({},c,{offset:u,verticalPoints:P,xAxis:b,yAxis:x})),N.createElement(lue,Ea({},c,{horizontalPoints:O})),N.createElement(uue,Ea({},c,{verticalPoints:P})))}Ls.displayName="CartesianGrid";var due=["type","layout","connectNulls","ref"],hue=["key"];function Fs(e){"@babel/helpers - typeof";return Fs=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},Fs(e)}function XE(e,t){if(e==null)return{};var r=pue(e,t),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ou(){return ou=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);rf){p=[].concat(xo(l.slice(0,v)),[f-m]);break}var g=p.length%2===0?[0,d]:[d];return[].concat(xo(t.repeat(l,c)),xo(p),g).map(function(y){return"".concat(y,"px")}).join(", ")}),Xr(r,"id",so("recharts-line-")),Xr(r,"pathRef",function(o){r.mainCurve=o}),Xr(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Xr(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Pue(t,e),xue(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,s=a.xAxis,l=a.yAxis,u=a.layout,c=a.children,f=qt(c,ml);if(!f)return null;var d=function(m,g){return{x:m.x,y:m.y,value:m.value,errorVal:Ve(m.payload,g)}},p={clipPath:n?"url(#clipPath-".concat(i,")"):null};return N.createElement(he,p,f.map(function(v){return N.cloneElement(v,{key:"bar-".concat(v.props.dataKey),data:o,xAxis:s,yAxis:l,layout:u,dataPointFormatter:d})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,u=s.points,c=s.dataKey,f=te(this.props,!1),d=te(l,!0),p=u.map(function(m,g){var y=fr(fr(fr({key:"dot-".concat(g),r:3},f),d),{},{index:g,cx:m.x,cy:m.y,value:m.value,dataKey:c,payload:m.payload,points:u});return t.renderDotItem(l,y)}),v={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return N.createElement(he,ou({className:"recharts-line-dots",key:"dots"},v),p)}},{key:"renderCurveStatically",value:function(n,i,a,o){var s=this.props,l=s.type,u=s.layout,c=s.connectNulls;s.ref;var f=XE(s,due),d=fr(fr(fr({},te(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:l,layout:u,connectNulls:c});return N.createElement(Zu,ou({},d,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,s=o.points,l=o.strokeDasharray,u=o.isAnimationActive,c=o.animationBegin,f=o.animationDuration,d=o.animationEasing,p=o.animationId,v=o.animateNewValues,m=o.width,g=o.height,y=this.state,b=y.prevPoints,x=y.totalLength;return N.createElement(on,{begin:c,duration:f,isActive:u,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(S){var w=S.t;if(b){var O=b.length/s.length,P=s.map(function(k,M){var R=Math.floor(M*O);if(b[R]){var I=b[R],L=At(I.x,k.x),z=At(I.y,k.y);return fr(fr({},k),{},{x:L(w),y:z(w)})}if(v){var C=At(m*2,k.x),F=At(g/2,k.y);return fr(fr({},k),{},{x:C(w),y:F(w)})}return fr(fr({},k),{},{x:k.x,y:k.y})});return a.renderCurveStatically(P,n,i)}var E=At(0,x),j=E(w),_;if(l){var T="".concat(l).split(/[,\s]+/gim).map(function(k){return parseFloat(k)});_=a.getStrokeDasharray(j,x,T)}else _=a.generateSimpleStrokeDasharray(x,j);return a.renderCurveStatically(s,n,i,{strokeDasharray:_})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,s=a.isAnimationActive,l=this.state,u=l.prevPoints,c=l.totalLength;return s&&o&&o.length&&(!u&&c>0||!dl(u,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,s=i.points,l=i.className,u=i.xAxis,c=i.yAxis,f=i.top,d=i.left,p=i.width,v=i.height,m=i.isAnimationActive,g=i.id;if(a||!s||!s.length)return null;var y=this.state.isAnimationFinished,b=s.length===1,x=ue("recharts-line",l),S=u&&u.allowDataOverflow,w=c&&c.allowDataOverflow,O=S||w,P=ae(g)?this.id:g,E=(n=te(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},j=E.r,_=j===void 0?3:j,T=E.strokeWidth,k=T===void 0?2:T,M=H8(o)?o:{},R=M.clipDot,I=R===void 0?!0:R,L=_*2+k;return N.createElement(he,{className:x},S||w?N.createElement("defs",null,N.createElement("clipPath",{id:"clipPath-".concat(P)},N.createElement("rect",{x:S?d:d-p/2,y:w?f:f-v/2,width:S?p:p*2,height:w?v:v*2})),!I&&N.createElement("clipPath",{id:"clipPath-dots-".concat(P)},N.createElement("rect",{x:d-L/2,y:f-L/2,width:p+L,height:v+L}))):null,!b&&this.renderCurve(O,P),this.renderErrorBar(O,P),(b||o)&&this.renderDots(O,I,P),(!m||y)&&Sn.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(xo(n),[0]):n,o=[],s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Due(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Rue(e){var t=e.option,r=e.isActive,n=Iue(e,Mue);return typeof t=="string"?A.createElement(xh,su({option:A.createElement(_p,su({type:t},n)),isActive:r,shapeType:"symbols"},n)):A.createElement(xh,su({option:t,isActive:r,shapeType:"symbols"},n))}function zs(e){"@babel/helpers - typeof";return zs=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},zs(e)}function lu(){return lu=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mce(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?o:t&&t.length&&q(i)&&q(a)?t.slice(i,a+1):[]};function c2(e){return e==="number"?[0,"auto"]:void 0}var T0=function(t,r,n,i){var a=t.graphicalItems,o=t.tooltipAxis,s=rm(r,t);return n<0||!a||!a.length||n>=s.length?null:a.reduce(function(l,u){var c,f=(c=u.props.data)!==null&&c!==void 0?c:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var d;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?s:f;d=$d(p,o.dataKey,i)}else d=f&&f[n]||s[n];return d?[].concat(Ks(l),[KC(u,d)]):l},[])},oA=function(t,r,n,i){var a=i||{x:t.chartX,y:t.chartY},o=qce(a,n),s=t.orderedTooltipTicks,l=t.tooltipAxis,u=t.tooltipTicks,c=Kee(o,s,u,l);if(c>=0&&u){var f=u[c]&&u[c].value,d=T0(t,r,c,f),p=Vce(n,s,c,a);return{activeTooltipIndex:c,activeLabel:f,activePayload:d,activeCoordinate:p}}return null},Gce=function(t,r){var n=r.axes,i=r.graphicalItems,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,c=t.layout,f=t.children,d=t.stackOffset,p=FC(c,a);return n.reduce(function(v,m){var g,y=m.type.defaultProps!==void 0?B(B({},m.type.defaultProps),m.props):m.props,b=y.type,x=y.dataKey,S=y.allowDataOverflow,w=y.allowDuplicatedCategory,O=y.scale,P=y.ticks,E=y.includeHidden,j=y[o];if(v[j])return v;var _=rm(t.data,{graphicalItems:i.filter(function(H){var Y,re=o in H.props?H.props[o]:(Y=H.type.defaultProps)===null||Y===void 0?void 0:Y[o];return re===j}),dataStartIndex:l,dataEndIndex:u}),T=_.length,k,M,R;xce(y.domain,S,b)&&(k=zg(y.domain,null,S),p&&(b==="number"||O!=="auto")&&(R=ru(_,x,"category")));var I=c2(b);if(!k||k.length===0){var L,z=(L=y.domain)!==null&&L!==void 0?L:I;if(x){if(k=ru(_,x,b),b==="category"&&p){var C=$8(k);w&&C?(M=k,k=Sh(0,T)):w||(k=TP(z,k,m).reduce(function(H,Y){return H.indexOf(Y)>=0?H:[].concat(Ks(H),[Y])},[]))}else if(b==="category")w?k=k.filter(function(H){return H!==""&&!ae(H)}):k=TP(z,k,m).reduce(function(H,Y){return H.indexOf(Y)>=0||Y===""||ae(Y)?H:[].concat(Ks(H),[Y])},[]);else if(b==="number"){var F=Xee(_,i.filter(function(H){var Y,re,be=o in H.props?H.props[o]:(Y=H.type.defaultProps)===null||Y===void 0?void 0:Y[o],We="hide"in H.props?H.props.hide:(re=H.type.defaultProps)===null||re===void 0?void 0:re.hide;return be===j&&(E||!We)}),x,a,c);F&&(k=F)}p&&(b==="number"||O!=="auto")&&(R=ru(_,x,"category"))}else p?k=Sh(0,T):s&&s[j]&&s[j].hasStack&&b==="number"?k=d==="expand"?[0,1]:HC(s[j].stackGroups,l,u):k=LC(_,i.filter(function(H){var Y=o in H.props?H.props[o]:H.type.defaultProps[o],re="hide"in H.props?H.props.hide:H.type.defaultProps.hide;return Y===j&&(E||!re)}),b,c,!0);if(b==="number")k=A0(f,k,j,a,P),z&&(k=zg(z,k,S));else if(b==="category"&&z){var W=z,V=k.every(function(H){return W.indexOf(H)>=0});V&&(k=W)}}return B(B({},v),{},ie({},j,B(B({},y),{},{axisType:a,domain:k,categoricalDomain:R,duplicateDomain:M,originalDomain:(g=y.domain)!==null&&g!==void 0?g:I,isCategorical:p,layout:c})))},{})},Yce=function(t,r){var n=r.graphicalItems,i=r.Axis,a=r.axisType,o=r.axisIdKey,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,c=t.layout,f=t.children,d=rm(t.data,{graphicalItems:n,dataStartIndex:l,dataEndIndex:u}),p=d.length,v=FC(c,a),m=-1;return n.reduce(function(g,y){var b=y.type.defaultProps!==void 0?B(B({},y.type.defaultProps),y.props):y.props,x=b[o],S=c2("number");if(!g[x]){m++;var w;return v?w=Sh(0,p):s&&s[x]&&s[x].hasStack?(w=HC(s[x].stackGroups,l,u),w=A0(f,w,x,a)):(w=zg(S,LC(d,n.filter(function(O){var P,E,j=o in O.props?O.props[o]:(P=O.type.defaultProps)===null||P===void 0?void 0:P[o],_="hide"in O.props?O.props.hide:(E=O.type.defaultProps)===null||E===void 0?void 0:E.hide;return j===x&&!_}),"number",c),i.defaultProps.allowDataOverflow),w=A0(f,w,x,a)),B(B({},g),{},ie({},x,B(B({axisType:a},i.defaultProps),{},{hide:!0,orientation:gr(Hce,"".concat(a,".").concat(m%2),null),domain:w,originalDomain:S,isCategorical:v,layout:c})))}return g},{})},Xce=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,a=r.AxisComp,o=r.graphicalItems,s=r.stackGroups,l=r.dataStartIndex,u=r.dataEndIndex,c=t.children,f="".concat(i,"Id"),d=qt(c,a),p={};return d&&d.length?p=Gce(t,{axes:d,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:s,dataStartIndex:l,dataEndIndex:u}):o&&o.length&&(p=Yce(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:s,dataStartIndex:l,dataEndIndex:u})),p},Qce=function(t){var r=xi(t),n=zn(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:hx(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:lh(r,n)}},sA=function(t){var r=t.children,n=t.defaultShowTooltip,i=pr(r,Cs),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!n}},Jce=function(t){return!t||!t.length?!1:t.some(function(r){var n=Wn(r&&r.type);return n&&n.indexOf("Bar")>=0})},lA=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"}},Zce=function(t,r){var n=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,s=t.yAxisMap,l=s===void 0?{}:s,u=n.width,c=n.height,f=n.children,d=n.margin||{},p=pr(f,Cs),v=pr(f,rn),m=Object.keys(l).reduce(function(w,O){var P=l[O],E=P.orientation;return!P.mirror&&!P.hide?B(B({},w),{},ie({},E,w[E]+P.width)):w},{left:d.left||0,right:d.right||0}),g=Object.keys(o).reduce(function(w,O){var P=o[O],E=P.orientation;return!P.mirror&&!P.hide?B(B({},w),{},ie({},E,gr(w,"".concat(E))+P.height)):w},{top:d.top||0,bottom:d.bottom||0}),y=B(B({},g),m),b=y.bottom;p&&(y.bottom+=p.props.height||Cs.defaultProps.height),v&&r&&(y=Gee(y,i,n,r));var x=u-y.left-y.right,S=c-y.top-y.bottom;return B(B({brushBottom:b},y),{},{width:Math.max(x,0),height:Math.max(S,0)})},efe=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Xx=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,s=o===void 0?["axis"]:o,l=t.axisComponents,u=t.legendContent,c=t.formatAxisMap,f=t.defaultProps,d=function(y,b){var x=b.graphicalItems,S=b.stackGroups,w=b.offset,O=b.updateId,P=b.dataStartIndex,E=b.dataEndIndex,j=y.barSize,_=y.layout,T=y.barGap,k=y.barCategoryGap,M=y.maxBarSize,R=lA(_),I=R.numericAxisName,L=R.cateAxisName,z=Jce(x),C=[];return x.forEach(function(F,W){var V=rm(y.data,{graphicalItems:[F],dataStartIndex:P,dataEndIndex:E}),H=F.type.defaultProps!==void 0?B(B({},F.type.defaultProps),F.props):F.props,Y=H.dataKey,re=H.maxBarSize,be=H["".concat(I,"Id")],We=H["".concat(L,"Id")],Oe={},St=l.reduce(function(ia,aa){var sm=b["".concat(aa.axisType,"Map")],aw=H["".concat(aa.axisType,"Id")];sm&&sm[aw]||aa.axisType==="zAxis"||Za();var ow=sm[aw];return B(B({},ia),{},ie(ie({},aa.axisType,ow),"".concat(aa.axisType,"Ticks"),zn(ow)))},Oe),G=St[L],se=St["".concat(L,"Ticks")],le=S&&S[be]&&S[be].hasStack&&ate(F,S[be].stackGroups),U=Wn(F.type).indexOf("Bar")>=0,Qe=lh(G,se),ye=[],st=z&&qee({barSize:j,stackGroups:S,totalSize:efe(St,L)});if(U){var lt,Yt,li=ae(re)?M:re,ho=(lt=(Yt=lh(G,se,!0))!==null&&Yt!==void 0?Yt:li)!==null&<!==void 0?lt:0;ye=Vee({barGap:T,barCategoryGap:k,bandSize:ho!==Qe?ho:Qe,sizeList:st[We],maxBarSize:li}),ho!==Qe&&(ye=ye.map(function(ia){return B(B({},ia),{},{position:B(B({},ia.position),{},{offset:ia.position.offset-ho/2})})}))}var Kc=F&&F.type&&F.type.getComposedData;Kc&&C.push({props:B(B({},Kc(B(B({},St),{},{displayedData:V,props:y,dataKey:Y,item:F,bandSize:Qe,barPosition:ye,offset:w,stackedData:le,layout:_,dataStartIndex:P,dataEndIndex:E}))),{},ie(ie(ie({key:F.key||"item-".concat(W)},I,St[I]),L,St[L]),"animationId",O)),childIndex:V8(F,y.children),item:F})}),C},p=function(y,b){var x=y.props,S=y.dataStartIndex,w=y.dataEndIndex,O=y.updateId;if(!OS({props:x}))return null;var P=x.children,E=x.layout,j=x.stackOffset,_=x.data,T=x.reverseStackOrder,k=lA(E),M=k.numericAxisName,R=k.cateAxisName,I=qt(P,n),L=nte(_,I,"".concat(M,"Id"),"".concat(R,"Id"),j,T),z=l.reduce(function(H,Y){var re="".concat(Y.axisType,"Map");return B(B({},H),{},ie({},re,Xce(x,B(B({},Y),{},{graphicalItems:I,stackGroups:Y.axisType===M&&L,dataStartIndex:S,dataEndIndex:w}))))},{}),C=Zce(B(B({},z),{},{props:x,graphicalItems:I}),b==null?void 0:b.legendBBox);Object.keys(z).forEach(function(H){z[H]=c(x,z[H],C,H.replace("Map",""),r)});var F=z["".concat(R,"Map")],W=Qce(F),V=d(x,B(B({},z),{},{dataStartIndex:S,dataEndIndex:w,updateId:O,graphicalItems:I,stackGroups:L,offset:C}));return B(B({formattedGraphicalItems:V,graphicalItems:I,offset:C,stackGroups:L},W),z)},v=function(g){function y(b){var x,S,w;return $ce(this,y),w=Dce(this,y,[b]),ie(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ie(w,"accessibilityManager",new bce),ie(w,"handleLegendBBoxUpdate",function(O){if(O){var P=w.state,E=P.dataStartIndex,j=P.dataEndIndex,_=P.updateId;w.setState(B({legendBBox:O},p({props:w.props,dataStartIndex:E,dataEndIndex:j,updateId:_},B(B({},w.state),{},{legendBBox:O}))))}}),ie(w,"handleReceiveSyncEvent",function(O,P,E){if(w.props.syncId===O){if(E===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(P)}}),ie(w,"handleBrushChange",function(O){var P=O.startIndex,E=O.endIndex;if(P!==w.state.dataStartIndex||E!==w.state.dataEndIndex){var j=w.state.updateId;w.setState(function(){return B({dataStartIndex:P,dataEndIndex:E},p({props:w.props,dataStartIndex:P,dataEndIndex:E,updateId:j},w.state))}),w.triggerSyncEvent({dataStartIndex:P,dataEndIndex:E})}}),ie(w,"handleMouseEnter",function(O){var P=w.getMouseInfo(O);if(P){var E=B(B({},P),{},{isTooltipActive:!0});w.setState(E),w.triggerSyncEvent(E);var j=w.props.onMouseEnter;oe(j)&&j(E,O)}}),ie(w,"triggeredAfterMouseMove",function(O){var P=w.getMouseInfo(O),E=P?B(B({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(E),w.triggerSyncEvent(E);var j=w.props.onMouseMove;oe(j)&&j(E,O)}),ie(w,"handleItemMouseEnter",function(O){w.setState(function(){return{isTooltipActive:!0,activeItem:O,activePayload:O.tooltipPayload,activeCoordinate:O.tooltipPosition||{x:O.cx,y:O.cy}}})}),ie(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),ie(w,"handleMouseMove",function(O){O.persist(),w.throttleTriggeredAfterMouseMove(O)}),ie(w,"handleMouseLeave",function(O){w.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};w.setState(P),w.triggerSyncEvent(P);var E=w.props.onMouseLeave;oe(E)&&E(P,O)}),ie(w,"handleOuterEvent",function(O){var P=q8(O),E=gr(w.props,"".concat(P));if(P&&oe(E)){var j,_;/.*touch.*/i.test(P)?_=w.getMouseInfo(O.changedTouches[0]):_=w.getMouseInfo(O),E((j=_)!==null&&j!==void 0?j:{},O)}}),ie(w,"handleClick",function(O){var P=w.getMouseInfo(O);if(P){var E=B(B({},P),{},{isTooltipActive:!0});w.setState(E),w.triggerSyncEvent(E);var j=w.props.onClick;oe(j)&&j(E,O)}}),ie(w,"handleMouseDown",function(O){var P=w.props.onMouseDown;if(oe(P)){var E=w.getMouseInfo(O);P(E,O)}}),ie(w,"handleMouseUp",function(O){var P=w.props.onMouseUp;if(oe(P)){var E=w.getMouseInfo(O);P(E,O)}}),ie(w,"handleTouchMove",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(O.changedTouches[0])}),ie(w,"handleTouchStart",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&w.handleMouseDown(O.changedTouches[0])}),ie(w,"handleTouchEnd",function(O){O.changedTouches!=null&&O.changedTouches.length>0&&w.handleMouseUp(O.changedTouches[0])}),ie(w,"handleDoubleClick",function(O){var P=w.props.onDoubleClick;if(oe(P)){var E=w.getMouseInfo(O);P(E,O)}}),ie(w,"handleContextMenu",function(O){var P=w.props.onContextMenu;if(oe(P)){var E=w.getMouseInfo(O);P(E,O)}}),ie(w,"triggerSyncEvent",function(O){w.props.syncId!==void 0&&yv.emit(gv,w.props.syncId,O,w.eventEmitterSymbol)}),ie(w,"applySyncEvent",function(O){var P=w.props,E=P.layout,j=P.syncMethod,_=w.state.updateId,T=O.dataStartIndex,k=O.dataEndIndex;if(O.dataStartIndex!==void 0||O.dataEndIndex!==void 0)w.setState(B({dataStartIndex:T,dataEndIndex:k},p({props:w.props,dataStartIndex:T,dataEndIndex:k,updateId:_},w.state)));else if(O.activeTooltipIndex!==void 0){var M=O.chartX,R=O.chartY,I=O.activeTooltipIndex,L=w.state,z=L.offset,C=L.tooltipTicks;if(!z)return;if(typeof j=="function")I=j(C,O);else if(j==="value"){I=-1;for(var F=0;F=0){var le,U;if(M.dataKey&&!M.allowDuplicatedCategory){var Qe=typeof M.dataKey=="function"?se:"payload.".concat(M.dataKey.toString());le=$d(F,Qe,I),U=W&&V&&$d(V,Qe,I)}else le=F==null?void 0:F[R],U=W&&V&&V[R];if(We||be){var ye=O.props.activeIndex!==void 0?O.props.activeIndex:R;return[A.cloneElement(O,B(B(B({},j.props),St),{},{activeIndex:ye})),null,null]}if(!ae(le))return[G].concat(Ks(w.renderActivePoints({item:j,activePoint:le,basePoint:U,childIndex:R,isRange:W})))}else{var st,lt=(st=w.getItemByXY(w.state.activeCoordinate))!==null&&st!==void 0?st:{graphicalItem:G},Yt=lt.graphicalItem,li=Yt.item,ho=li===void 0?O:li,Kc=Yt.childIndex,ia=B(B(B({},j.props),St),{},{activeIndex:Kc});return[A.cloneElement(ho,ia),null,null]}return W?[G,null,null]:[G,null]}),ie(w,"renderCustomized",function(O,P,E){return A.cloneElement(O,B(B({key:"recharts-customized-".concat(E)},w.props),w.state))}),ie(w,"renderMap",{CartesianGrid:{handler:Tf,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:Tf},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:Tf},YAxis:{handler:Tf},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:so("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=IN(w.triggeredAfterMouseMove,(S=b.throttleDelay)!==null&&S!==void 0?S:1e3/60),w.state={},w}return Fce(y,g),Ice(y,[{key:"componentDidMount",value:function(){var x,S;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,S=x.children,w=x.data,O=x.height,P=x.layout,E=pr(S,Ct);if(E){var j=E.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var _=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,T=T0(this.state,w,j,_),k=this.state.tooltipTicks[j].coordinate,M=(this.state.offset.top+O)/2,R=P==="horizontal",I=R?{x:k,y:M}:{y:k,x:M},L=this.state.formattedGraphicalItems.find(function(C){var F=C.item;return F.type.name==="Scatter"});L&&(I=B(B({},I),L.props.points[j].tooltipPosition),T=L.props.points[j].tooltipPayload);var z={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:_,activePayload:T,activeCoordinate:I};this.setState(z),this.renderCursor(E),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,S){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==S.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var w,O;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(O=this.props.margin.top)!==null&&O!==void 0?O:0}})}return null}},{key:"componentDidUpdate",value:function(x){rg([pr(x.children,Ct)],[pr(this.props.children,Ct)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=pr(this.props.children,Ct);if(x&&typeof x.props.shared=="boolean"){var S=x.props.shared?"axis":"item";return s.indexOf(S)>=0?S:a}return a}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var S=this.container,w=S.getBoundingClientRect(),O=bX(w),P={chartX:Math.round(x.pageX-O.left),chartY:Math.round(x.pageY-O.top)},E=w.width/S.offsetWidth||1,j=this.inRange(P.chartX,P.chartY,E);if(!j)return null;var _=this.state,T=_.xAxisMap,k=_.yAxisMap,M=this.getTooltipEventType(),R=oA(this.state,this.props.data,this.props.layout,j);if(M!=="axis"&&T&&k){var I=xi(T).scale,L=xi(k).scale,z=I&&I.invert?I.invert(P.chartX):null,C=L&&L.invert?L.invert(P.chartY):null;return B(B({},P),{},{xValue:z,yValue:C},R)}return R?B(B({},P),R):null}},{key:"inRange",value:function(x,S){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,O=this.props.layout,P=x/w,E=S/w;if(O==="horizontal"||O==="vertical"){var j=this.state.offset,_=P>=j.left&&P<=j.left+j.width&&E>=j.top&&E<=j.top+j.height;return _?{x:P,y:E}:null}var T=this.state,k=T.angleAxisMap,M=T.radiusAxisMap;if(k&&M){var R=xi(k);return CP({x:P,y:E},R)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,S=this.getTooltipEventType(),w=pr(x,Ct),O={};w&&S==="axis"&&(w.props.trigger==="click"?O={onClick:this.handleClick}:O={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 P=Md(this.props,this.handleOuterEvent);return B(B({},P),O)}},{key:"addListener",value:function(){yv.on(gv,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){yv.removeListener(gv,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,S,w){for(var O=this.state.formattedGraphicalItems,P=0,E=O.length;P{const i=rfe.find(s=>s.value===t);if(!i)return[];const a=new Date,o=new Map;for(let s=0;s{const l=new Date(s.createdAt),u=Hi(Jy(l),"yyyy-MM-dd"),c=o.get(u)||0;o.set(u,c+1)}),Array.from(o.entries()).map(([s,l])=>({date:s,experiments:l,displayDate:Hi(new Date(s),"MMM dd")})).sort((s,l)=>s.date.localeCompare(l.date))},[e,t]),n=A.useMemo(()=>e.length,[e]);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-sm font-semibold",children:"Experiments Timeline"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Total: ",n]})]}),h.jsx(Xa,{width:"100%",height:260,children:h.jsxs(nm,{data:r,margin:{left:0,right:15,top:15,bottom:15},children:[h.jsx(Ls,{strokeDasharray:"3 3",stroke:"#e2e8f0",opacity:.5}),h.jsx(Zn,{dataKey:"displayDate",tick:{fontSize:10},angle:-45,textAnchor:"end",height:70}),h.jsx(ei,{tick:{fontSize:10},width:40,label:{value:"Count",angle:-90,position:"insideLeft",offset:8,style:{textAnchor:"middle",fontSize:11}}}),h.jsx(Ct,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"10px"},content:({active:i,payload:a,label:o})=>{if(!i||!a||!a.length)return null;const s=a[0].payload;return h.jsxs("div",{className:"bg-card border border-border rounded-md p-2 shadow-sm",children:[h.jsx("div",{className:"text-[10px] font-medium mb-1.5",children:o}),h.jsx("div",{className:"space-y-0.5 text-[10px]",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-purple-400"}),h.jsx("span",{className:"text-muted-foreground",children:"Launched:"}),h.jsx("span",{className:"font-medium ml-auto",children:s.experiments})]})})]})}}),h.jsx(rn,{wrapperStyle:{fontSize:"10px"},iconType:"circle",iconSize:8}),h.jsx(Pn,{type:"monotone",dataKey:"experiments",stroke:"#a78bfa",strokeWidth:2,dot:{fill:"#a78bfa",r:3},activeDot:{r:5},name:"Launched"})]})})]})}const uA={COMPLETED:"#22c55e",RUNNING:"#3b82f6",FAILED:"#ef4444",PENDING:"#eab308",CANCELLED:"#6b7280",UNKNOWN:"#a78bfa"};function ife({experiments:e}){const t=A.useMemo(()=>{const r=new Map;return e.forEach(n=>{const i=n.status,a=r.get(i)||0;r.set(i,a+1)}),Array.from(r.entries()).map(([n,i])=>({name:n,value:i,color:uA[n]||uA.UNKNOWN})).sort((n,i)=>i.value-n.value)},[e]);return t.length===0?h.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"No data available"}):h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-sm font-semibold",children:"Experiments Distribution"}),h.jsx(Xa,{width:"100%",height:220,children:h.jsxs(f2,{margin:{top:20,bottom:5},children:[h.jsx(_n,{data:t,dataKey:"value",nameKey:"name",cx:"50%",cy:"48%",outerRadius:58,label:({name:r,value:n})=>`${r}: ${n}`,style:{fontSize:"10px"},children:t.map((r,n)=>h.jsx(cl,{fill:r.color},`cell-${n}`))}),h.jsx(Ct,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"10px"}}),h.jsx(rn,{wrapperStyle:{fontSize:"10px"}})]})})]})}const afe=[{value:"7days",label:"7 Days",days:7},{value:"1month",label:"1 Month",days:30},{value:"3months",label:"3 Months",days:90}];function ofe({data:e,timeRange:t}){const r=A.useMemo(()=>{const o=afe.find(u=>u.value===t);if(!o)return[];const s=new Date,l=new Map;for(let u=0;u{const c=Hi(new Date(u.date),"yyyy-MM-dd");l.has(c)&&l.set(c,{totalTokens:u.totalTokens,inputTokens:u.inputTokens,outputTokens:u.outputTokens})}),Array.from(l.entries()).map(([u,c])=>({date:u,displayDate:Hi(new Date(u),"MMM dd"),totalTokens:c.totalTokens,inputTokens:c.inputTokens,outputTokens:c.outputTokens})).sort((u,c)=>u.date.localeCompare(c.date))},[e,t]),n=A.useMemo(()=>r.reduce((o,s)=>o+s.totalTokens,0),[r]),i=A.useMemo(()=>r.reduce((o,s)=>o+s.inputTokens,0),[r]),a=A.useMemo(()=>r.reduce((o,s)=>o+s.outputTokens,0),[r]);return h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-sm font-semibold",children:"Token Usage"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Total: ",n.toLocaleString()," (",i.toLocaleString(),"↓ ",a.toLocaleString(),"↑)"]})]}),h.jsx(Xa,{width:"100%",height:260,children:h.jsxs(nm,{data:r,margin:{left:10,right:15,top:15,bottom:15},children:[h.jsx(Ls,{strokeDasharray:"3 3",stroke:"#e2e8f0",opacity:.5}),h.jsx(Zn,{dataKey:"displayDate",tick:{fontSize:10},angle:-45,textAnchor:"end",height:70}),h.jsx(ei,{tick:{fontSize:10},width:50,tickFormatter:o=>o>=1e6?`${(o/1e6).toFixed(1)}M`:o>=1e3?`${(o/1e3).toFixed(1)}K`:o.toString(),label:{value:"Tokens",angle:-90,position:"insideLeft",offset:-5,style:{textAnchor:"middle",fontSize:11}}}),h.jsx(Ct,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"10px"},content:({active:o,payload:s,label:l})=>{if(!o||!s||!s.length)return null;const u=s[0].payload;return h.jsxs("div",{className:"bg-card border border-border rounded-md p-2 shadow-sm",children:[h.jsx("div",{className:"text-[10px] font-medium mb-1.5",children:l}),h.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"}),h.jsx("span",{className:"text-muted-foreground",children:"Total:"}),h.jsx("span",{className:"font-medium ml-auto",children:u.totalTokens.toLocaleString()})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),h.jsx("span",{className:"text-muted-foreground",children:"Input:"}),h.jsx("span",{className:"font-medium ml-auto",children:u.inputTokens.toLocaleString()})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"}),h.jsx("span",{className:"text-muted-foreground",children:"Output:"}),h.jsx("span",{className:"font-medium ml-auto",children:u.outputTokens.toLocaleString()})]})]})]})}}),h.jsx(rn,{wrapperStyle:{fontSize:"10px"},iconType:"circle",iconSize:8}),h.jsx(Pn,{type:"monotone",dataKey:"totalTokens",stroke:"#3b82f6",strokeWidth:2,dot:{fill:"#3b82f6",r:3},activeDot:{r:5},name:"Total"}),h.jsx(Pn,{type:"monotone",dataKey:"inputTokens",stroke:"#10b981",strokeWidth:2,dot:{fill:"#10b981",r:3},activeDot:{r:5},name:"Input"}),h.jsx(Pn,{type:"monotone",dataKey:"outputTokens",stroke:"#f59e0b",strokeWidth:2,dot:{fill:"#f59e0b",r:3},activeDot:{r:5},name:"Output"})]})})]})}const cA=[{value:"7days",label:"7 Days",days:7},{value:"1month",label:"1 Month",days:30},{value:"3months",label:"3 Months",days:90}];function sfe(){var f,d,p,v;const{selectedTeamId:e}=Qs(),[t,r]=A.useState("7days"),{data:n,isLoading:i}=Wb(e||""),{data:a,isLoading:o}=JB(e||"",{enabled:!!e}),s=((f=cA.find(m=>m.value===t))==null?void 0:f.days)||30,{data:l,isLoading:u}=ZB(e||"",s),c=A.useMemo(()=>{if(!a)return[];const m=new Date,g=t==="7days"?Hb(m,7):t==="1month"?Zy(m,1):Zy(m,3);return a.filter(y=>{const b=new Date(y.createdAt);return b>=g&&b<=m})},[a,t]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Dashboard"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Overview of your team's experiments and activity"})]}),h.jsx("div",{children:h.jsx("h2",{className:"text-base font-semibold text-foreground mb-2",children:"Overview"})}),i?h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2.5",children:[h.jsx(De,{className:"h-14 w-full"}),h.jsx(De,{className:"h-14 w-full"}),h.jsx(De,{className:"h-14 w-full"})]}):h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2.5",children:[h.jsx(xe,{children:h.jsx(we,{className:"p-3",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"EXPERIMENTS"}),h.jsx("p",{className:"text-lg font-bold tabular-nums text-foreground",children:(n==null?void 0:n.totalExperiments)||0})]}),h.jsx("div",{className:"p-1.5 bg-purple-100 rounded-lg",children:h.jsx(ek,{className:"h-3.5 w-3.5 text-purple-600"})})]})})}),h.jsx(xe,{children:h.jsx(we,{className:"p-3",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"RUNS"}),h.jsx("p",{className:"text-lg font-bold tabular-nums text-foreground",children:(n==null?void 0:n.totalRuns)||0})]}),h.jsx("div",{className:"p-1.5 bg-green-100 rounded-lg",children:h.jsx(kF,{className:"h-3.5 w-3.5 text-green-600"})})]})})}),h.jsx(xe,{children:h.jsx(we,{className:"p-3",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"TOKENS"}),h.jsxs("p",{className:"text-lg font-bold tabular-nums text-foreground",children:[(((d=n==null?void 0:n.aggregatedTokens)==null?void 0:d.totalTokens)||0).toLocaleString(),h.jsxs("span",{className:"text-muted-foreground text-xs ml-1 font-normal",children:["(",(((p=n==null?void 0:n.aggregatedTokens)==null?void 0:p.inputTokens)||0).toLocaleString(),"↓ ",(((v=n==null?void 0:n.aggregatedTokens)==null?void 0:v.outputTokens)||0).toLocaleString(),"↑)"]})]})]}),h.jsx("div",{className:"p-1.5 bg-orange-100 rounded-lg",children:h.jsx(dF,{className:"h-3.5 w-3.5 text-orange-600"})})]})})})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Activity"}),h.jsx("div",{className:"flex gap-1",children:cA.map(m=>h.jsx(Yn,{variant:"outline",size:"sm",onClick:()=>r(m.value),className:`h-8 px-2.5 text-xs transition-colors ${t===m.value?"bg-blue-50 border-blue-300 text-blue-700 hover:bg-blue-100":"bg-white hover:bg-gray-50"}`,children:m.label},m.value))})]}),h.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:o?h.jsx(De,{className:"h-56 w-full"}):c&&c.length>0?h.jsx(ife,{experiments:c}):h.jsx("div",{className:"flex h-56 items-center justify-center text-sm text-muted-foreground",children:"No experiments data available for this time range"})})}),h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:o?h.jsx(De,{className:"h-56 w-full"}):c&&c.length>0?h.jsx(nfe,{experiments:c,timeRange:t}):h.jsx("div",{className:"flex h-56 items-center justify-center text-sm text-muted-foreground",children:"No experiments data available for this time range"})})})]}),h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:u?h.jsx(De,{className:"h-80 w-full"}):l?h.jsx(ofe,{data:l,timeRange:t}):h.jsx("div",{className:"flex h-80 items-center justify-center text-sm text-muted-foreground",children:"No token usage data available for this time range"})})})]})]})}const Uc=A.forwardRef(({className:e,...t},r)=>h.jsx("div",{className:"relative w-full overflow-auto",children:h.jsx("table",{ref:r,className:fe("w-full caption-bottom text-sm",e),...t})}));Uc.displayName="Table";const Wc=A.forwardRef(({className:e,...t},r)=>h.jsx("thead",{ref:r,className:fe("[&_tr]:border-b",e),...t}));Wc.displayName="TableHeader";const Hc=A.forwardRef(({className:e,...t},r)=>h.jsx("tbody",{ref:r,className:fe("[&_tr:last-child]:border-0",e),...t}));Hc.displayName="TableBody";const lfe=A.forwardRef(({className:e,...t},r)=>h.jsx("tfoot",{ref:r,className:fe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));lfe.displayName="TableFooter";const ti=A.forwardRef(({className:e,...t},r)=>h.jsx("tr",{ref:r,className:fe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));ti.displayName="TableRow";const It=A.forwardRef(({className:e,...t},r)=>h.jsx("th",{ref:r,className:fe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));It.displayName="TableHead";const Dt=A.forwardRef(({className:e,...t},r)=>h.jsx("td",{ref:r,className:fe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Dt.displayName="TableCell";const ufe=A.forwardRef(({className:e,...t},r)=>h.jsx("caption",{ref:r,className:fe("mt-4 text-sm text-muted-foreground",e),...t}));ufe.displayName="TableCaption";function Lr({className:e,variant:t="default",...r}){const n={default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-slate-100 text-slate-700 border-slate-200",destructive:"bg-red-50 text-red-700 border-red-200",outline:"text-foreground",success:"bg-emerald-50 text-emerald-700 border-emerald-200",warning:"bg-amber-50 text-amber-700 border-amber-200",unknown:"bg-purple-50 text-purple-700 border-purple-200",info:"bg-blue-50 text-blue-700 border-blue-200"};return h.jsx("div",{className:fe("inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors",n[t],e),...r})}const qs=A.forwardRef(({className:e,type:t,...r},n)=>h.jsx("input",{type:t,className:fe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));qs.displayName="Input";function Qx({value:e,onChange:t,options:r,className:n,placeholder:i}){const[a,o]=A.useState(!1),s=A.useRef(null),l=r.find(u=>u.value===e);return A.useEffect(()=>{const u=c=>{s.current&&!s.current.contains(c.target)&&o(!1)};return a&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[a]),h.jsxs("div",{ref:s,className:fe("relative",n),children:[h.jsxs("button",{type:"button",onClick:()=>o(!a),className:fe("flex h-9 w-full items-center justify-between rounded-md border bg-background px-3 py-2 text-[13px] font-medium text-foreground","hover:bg-accent hover:text-accent-foreground transition-colors","focus:outline-none focus:border-blue-300 focus:bg-blue-50","disabled:cursor-not-allowed disabled:opacity-50"),children:[h.jsx("span",{children:(l==null?void 0:l.label)||i||"Select..."}),h.jsx(sp,{className:fe("h-3.5 w-3.5 opacity-50 transition-transform",a&&"transform rotate-180")})]}),a&&h.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-lg",children:h.jsx("div",{className:"max-h-60 overflow-auto p-1",children:r.map(u=>h.jsx("button",{type:"button",onClick:()=>{t(u.value),o(!1)},className:fe("w-full rounded-sm px-2 py-1.5 text-[13px] text-left cursor-pointer transition-colors","hover:bg-accent hover:text-accent-foreground",e===u.value&&"bg-accent text-accent-foreground font-medium"),children:u.label},u.value))})})]})}function cfe({values:e,onChange:t,options:r,className:n,placeholder:i}){const[a,o]=A.useState(!1),s=A.useRef(null),l=r.filter(p=>e.includes(p.value)),u=A.useMemo(()=>{const p={};return r.forEach(v=>{const m=v.group||"Other";p[m]||(p[m]=[]),p[m].push(v)}),p},[r]);A.useEffect(()=>{const p=v=>{s.current&&!s.current.contains(v.target)&&o(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const c=p=>{e.includes(p)?t(e.filter(v=>v!==p)):t([...e,p])},f=(p,v)=>{v.stopPropagation(),t(e.filter(m=>m!==p))},d=p=>{p.stopPropagation(),t([])};return h.jsxs("div",{ref:s,className:fe("relative",n),children:[h.jsxs("button",{type:"button",onClick:()=>o(!a),className:fe("flex min-h-9 w-full items-center justify-between rounded-md border bg-background px-3 py-1.5 text-[13px]","hover:bg-accent hover:text-accent-foreground transition-colors","focus:outline-none focus:border-blue-300 focus:bg-blue-50","disabled:cursor-not-allowed disabled:opacity-50"),children:[h.jsx("div",{className:"flex flex-wrap gap-1 flex-1",children:l.length===0?h.jsx("span",{className:"text-muted-foreground font-medium",children:i||"Select labels..."}):l.map(p=>{const v=p.value.endsWith(":*")?p.label:`${p.group}:${p.label}`;return h.jsxs(Lr,{variant:"outline",className:"text-[11px] px-1.5 py-0 font-normal",children:[v,h.jsx(_d,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",onClick:m=>f(p.value,m)})]},p.value)})}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[l.length>0&&h.jsx(_d,{className:"h-3.5 w-3.5 opacity-50 hover:opacity-100 cursor-pointer",onClick:d}),h.jsx(sp,{className:fe("h-3.5 w-3.5 opacity-50 transition-transform",a&&"transform rotate-180")})]})]}),a&&h.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-lg",children:h.jsx("div",{className:"max-h-80 overflow-auto p-1",children:Object.entries(u).map(([p,v])=>h.jsxs("div",{children:[h.jsx("div",{className:"px-2 py-1.5 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:p}),v.map(m=>h.jsxs("button",{type:"button",onClick:()=>c(m.value),className:fe("w-full rounded-sm px-2 py-1.5 pl-6 text-[13px] text-left cursor-pointer transition-colors flex items-center gap-2","hover:bg-accent hover:text-accent-foreground"),children:[h.jsx("input",{type:"checkbox",checked:e.includes(m.value),onChange:()=>{},className:"h-3.5 w-3.5 rounded border-gray-300"}),h.jsx("span",{className:fe(e.includes(m.value)&&"font-medium"),children:m.label})]},m.value))]},p))})})]})}function Jx({currentPage:e,totalPages:t,pageSize:r,totalItems:n,onPageChange:i,itemName:a="items"}){return n===0?null:h.jsx("div",{className:"flex items-center justify-end px-6 py-4 border-t",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Yn,{variant:"outline",size:"sm",onClick:()=>i(Math.max(0,e-1)),disabled:e===0,className:"h-8 w-8 p-0",children:h.jsx(uF,{className:"h-4 w-4"})}),h.jsxs("div",{className:"text-[13px] font-medium text-muted-foreground",children:[e+1," / ",t]}),h.jsx(Yn,{variant:"outline",size:"sm",onClick:()=>i(Math.min(t-1,e+1)),disabled:e>=t-1,className:"h-8 w-8 p-0",children:h.jsx(zb,{className:"h-4 w-4"})})]})})}const ffe={UNKNOWN:"unknown",PENDING:"warning",RUNNING:"info",CANCELLED:"secondary",COMPLETED:"success",FAILED:"destructive"},dfe=[{value:"ALL",label:"All Status"},{value:"COMPLETED",label:"Completed"},{value:"RUNNING",label:"Running"},{value:"FAILED",label:"Failed"},{value:"PENDING",label:"Pending"},{value:"CANCELLED",label:"Cancelled"}],xv=[{bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-300"},{bg:"bg-green-100",text:"text-green-700",border:"border-green-300"},{bg:"bg-purple-100",text:"text-purple-700",border:"border-purple-300"},{bg:"bg-orange-100",text:"text-orange-700",border:"border-orange-300"},{bg:"bg-pink-100",text:"text-pink-700",border:"border-pink-300"},{bg:"bg-cyan-100",text:"text-cyan-700",border:"border-cyan-300"},{bg:"bg-indigo-100",text:"text-indigo-700",border:"border-indigo-300"},{bg:"bg-teal-100",text:"text-teal-700",border:"border-teal-300"},{bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-300"},{bg:"bg-rose-100",text:"text-rose-700",border:"border-rose-300"},{bg:"bg-violet-100",text:"text-violet-700",border:"border-violet-300"},{bg:"bg-lime-100",text:"text-lime-700",border:"border-lime-300"},{bg:"bg-fuchsia-100",text:"text-fuchsia-700",border:"border-fuchsia-300"},{bg:"bg-emerald-100",text:"text-emerald-700",border:"border-emerald-300"},{bg:"bg-sky-100",text:"text-sky-700",border:"border-sky-300"},{bg:"bg-red-100",text:"text-red-700",border:"border-red-300"},{bg:"bg-yellow-100",text:"text-yellow-700",border:"border-yellow-300"},{bg:"bg-slate-100",text:"text-slate-700",border:"border-slate-300"},{bg:"bg-zinc-100",text:"text-zinc-700",border:"border-zinc-300"},{bg:"bg-stone-100",text:"text-stone-700",border:"border-stone-300"}],wv=10;function hfe(){const{selectedTeamId:e}=Qs(),[t,r]=A.useState("ALL"),[n,i]=A.useState([]),[a,o]=A.useState(""),[s,l]=A.useState(0),{data:u}=Wb(e||""),{data:c,isLoading:f}=pk(e||"",{page:s,pageSize:wv,enabled:!!e}),d=(u==null?void 0:u.totalExperiments)||0,p=Math.ceil(d/wv),v=A.useMemo(()=>{if(!c||c.length===0)return new Map;const y=new Set;c.forEach(S=>{var w;(w=S.labels)==null||w.forEach(O=>{y.add(O.name)})});const b=Array.from(y).sort(),x=new Map;return b.forEach((S,w)=>{x.set(S,xv[w%xv.length])}),x},[c]),m=A.useMemo(()=>{if(!c||c.length===0)return[];const y=new Map;c.forEach(x=>{var S;(S=x.labels)==null||S.forEach(w=>{y.has(w.name)||y.set(w.name,new Set),y.get(w.name).add(w.value)})});const b=[];return Array.from(y.entries()).sort(([x],[S])=>x.localeCompare(S)).forEach(([x,S])=>{b.push({value:`${x}:*`,label:`(Any ${x})`,group:x}),Array.from(S).sort().forEach(w=>{b.push({value:`${x}:${w}`,label:w,group:x})})}),b},[c]),g=A.useMemo(()=>{if(!c)return[];let y=[...c];if(a.trim()){const b=a.toLowerCase();y=y.filter(x=>{var S,w,O,P;return((S=x.name)==null?void 0:S.toLowerCase().includes(b))||((w=x.description)==null?void 0:w.toLowerCase().includes(b))||((O=x.id)==null?void 0:O.toLowerCase().includes(b))||((P=x.labels)==null?void 0:P.some(E=>E.name.toLowerCase().includes(b)||E.value.toLowerCase().includes(b)))})}return t!=="ALL"&&(y=y.filter(b=>b.status===t)),n.length>0&&(y=y.filter(b=>n.every(x=>{var O,P;const[S,w]=x.split(":",2);return w==="*"?(O=b.labels)==null?void 0:O.some(E=>E.name===S):(P=b.labels)==null?void 0:P.some(E=>E.name===S&&E.value===w)}))),y.sort((b,x)=>new Date(x.createdAt).getTime()-new Date(b.createdAt).getTime()),y},[c,t,n,a]);return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Experiments"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse and manage experiments"})]}),h.jsxs("div",{className:"flex gap-2 items-center",children:[h.jsxs("div",{className:"relative w-80",children:[h.jsx(ku,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(qs,{placeholder:"Search experiments...",value:a,onChange:y=>o(y.target.value),className:"pl-8 h-9 text-[13px] font-medium focus:bg-blue-50 focus:border-blue-300 focus-visible:ring-0"})]}),h.jsx(cfe,{values:n,onChange:y=>i(y),options:m,className:"w-64",placeholder:"Filter by labels..."}),h.jsx(Qx,{value:t,onChange:y=>r(y),options:dfe,className:"w-40"})]})]}),h.jsx(xe,{className:"border-0 shadow-sm",children:h.jsxs(we,{className:"p-0",children:[f?h.jsx("div",{className:"p-8",children:h.jsx(De,{className:"h-24 w-full"})}):!g||g.length===0?h.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:a.trim()||t!=="ALL"||n.length>0?"No experiments match your filters":"No experiments found"}):h.jsx("div",{className:"overflow-hidden rounded-lg",children:h.jsxs(Uc,{children:[h.jsx(Wc,{children:h.jsxs(ti,{className:"hover:bg-transparent border-b",children:[h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"UUID"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Name"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Labels"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Status"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50 text-right",children:"Duration"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50 text-right",children:"Created"})]})}),h.jsx(Hc,{children:g.map((y,b)=>h.jsxs(ti,{className:"hover:bg-accent/50 transition-colors border-b last:border-0",children:[h.jsx(Dt,{className:"py-3 text-sm font-mono",children:h.jsx(Va,{to:`/experiments/${y.id}`,className:"text-blue-600 hover:text-blue-800 hover:underline font-medium transition-colors",children:y.id})}),h.jsx(Dt,{className:"py-3 text-sm font-medium text-foreground",children:y.name}),h.jsx(Dt,{className:"py-3 text-sm",children:y.labels&&y.labels.length>0?h.jsx("div",{className:"flex gap-1 flex-wrap",children:y.labels.map((x,S)=>{const w=v.get(x.name)||xv[0];return h.jsxs(Lr,{variant:"outline",className:`text-xs px-2 py-0.5 font-normal ${w.bg} ${w.text} ${w.border}`,children:[x.name,": ",x.value]},S)})}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Dt,{className:"py-3",children:h.jsx(Lr,{variant:ffe[y.status],children:y.status})}),h.jsx(Dt,{className:"py-3 text-sm text-foreground tabular-nums text-right",children:y.duration>0?`${y.duration.toFixed(2)}s`:"-"}),h.jsx(Dt,{className:"py-3 text-sm text-muted-foreground text-right",children:Vo(new Date(y.createdAt),{addSuffix:!0})})]},y.id))})]})}),g&&g.length>0&&h.jsx(Jx,{currentPage:s,totalPages:p,pageSize:wv,totalItems:d,onPageChange:l,itemName:"experiments"})]})})]})}function d2(e){const{data:t,...r}=lp(e),n=A.useMemo(()=>{const i={};return((t==null?void 0:t.metrics)||[]).forEach(o=>{const s=o.key||"unknown";i[s]||(i[s]=[]),i[s].push(o)}),Object.keys(i).forEach(o=>{i[o].sort((s,l)=>new Date(s.createdAt).getTime()-new Date(l.createdAt).getTime())}),i},[t==null?void 0:t.metrics]);return{...r,data:n,metricKeys:Object.keys(n)}}const pfe="modulepreload",mfe=function(e){return"/static/"+e},fA={},vfe=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(l=>{if(l=mfe(l),l in fA)return;fA[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":pfe,u||(f.as="script"),f.crossOrigin="",f.href=l,s&&f.setAttribute("nonce",s),document.head.appendChild(f),u)return new Promise((d,p)=>{f.addEventListener("load",d),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})};function yfe(e){const{data:t,...r}=lp(e),{runMetrics:n,availableMetrics:i}=A.useMemo(()=>{const a=(t==null?void 0:t.metrics)||[];if(a.length===0)return{runMetrics:[],availableMetrics:[]};const o=new Map,s=new Set;[...a].sort((c,f)=>new Date(c.createdAt).getTime()-new Date(f.createdAt).getTime()).forEach(c=>{!c.key||c.value===null||(s.add(c.key),o.has(c.runId)||o.set(c.runId,new Map),o.get(c.runId).set(c.key,c.value))});const u=[];return o.forEach((c,f)=>{const d={};c.forEach((p,v)=>{d[v]=p}),u.push({runId:f,metrics:d})}),{runMetrics:u,availableMetrics:Array.from(s).sort()}},[t==null?void 0:t.metrics]);return{...r,runMetrics:n,availableMetrics:i}}function gfe(e,t,r){let n=!1;for(const i of r){const a=e.metrics[i.key],o=t.metrics[i.key];if(a===void 0||o===void 0)return!1;if(i.direction==="maximize"){if(ao&&(n=!0)}else{if(a>o)return!1;avfe(()=>import("./react-plotly-DGe6pNjt.js").then(e=>e.r),[])),di=["#0ea5e9","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444","#6366f1","#14b8a6"],dA="#10b981",hA="#9ca3af",pA="#f59e0b";function wfe({metrics:e,experimentId:t,title:r="Metrics",description:n}){const i=Object.keys(e),[a,o]=A.useState(i[0]||""),[s,l]=A.useState("timeline"),[u,c]=A.useState([]),{runMetrics:f,availableMetrics:d}=yfe(t),p=A.useMemo(()=>{const P=[];return Object.values(e).forEach(E=>{P.push(...E)}),P.length===0?null:P[0].runId},[e]),v=A.useMemo(()=>u.length===0?f:f.filter(P=>u.every(E=>P.metrics[E.key]!==void 0)),[f,u]),m=A.useMemo(()=>u.length<2||v.length<2?new Set:bfe(v,u),[v,u]),g=A.useMemo(()=>{var E;if(i.length===0||!a)return[];const P=[];return e[a]&&e[a].forEach((j,_)=>{j.value!==null&&P.push({timestamp:new Date(j.createdAt).getTime(),index:_,time:Hi(new Date(j.createdAt),"MMM dd HH:mm:ss"),value:j.value,runId:j.runId})}),P.sort((j,_)=>j.timestamp-_.timestamp),P.forEach((j,_)=>{j.index=_}),console.log("[MetricsChart] Selected key:",a),console.log("[MetricsChart] Total metrics for this key:",(E=e[a])==null?void 0:E.length),console.log("[MetricsChart] Total data points after processing:",P.length),console.log("[MetricsChart] All data points:",P),P},[e,i,a]),y=A.useMemo(()=>{if(u.length<2)return{all:[],paretoLine:[]};const P=u[0],E=u[1],j=u.length>=3?u[2]:void 0,_=v.map(k=>({runId:k.runId,x:k.metrics[P.key],y:k.metrics[E.key],z:j?k.metrics[j.key]:void 0,isParetoOptimal:m.has(k.runId),metrics:k.metrics})),T=_.filter(k=>k.isParetoOptimal).sort((k,M)=>k.x-M.x);return{all:_,paretoLine:T}},[v,u,m]),b=A.useMemo(()=>{if(u.length!==3||y.all.length===0)return null;const P=[...y.paretoLine].sort((k,M)=>k.x!==M.x?k.x-M.x:k.y!==M.y?k.y-M.y:(k.z||0)-(M.z||0)),E=y.all.find(k=>k.runId===p),j=P.filter(k=>k.runId!==p),_=y.all.filter(k=>!k.isParetoOptimal&&k.runId!==p),T=[{x:_.map(k=>k.x),y:_.map(k=>k.y),z:_.map(k=>k.z),mode:"markers",type:"scatter3d",name:"Dominated",showlegend:!1,marker:{size:5,color:hA,opacity:.4,symbol:"circle",line:{color:"#6b7280",width:1,opacity:.3}},customdata:_.map(k=>[k.runId,k.x,k.y,k.z]),hovertemplate:`Run: %{customdata[0]}
${u[0].key}: %{customdata[1]:.4f}
${u[1].key}: %{customdata[2]:.4f}
${u[2].key}: %{customdata[3]:.4f}`,hoverlabel:{bgcolor:"#fafafa",bordercolor:"#d1d5db",font:{family:"system-ui, -apple-system, sans-serif",size:12,color:"#374151"},align:"left"}},{x:j.map(k=>k.x),y:j.map(k=>k.y),z:j.map(k=>k.z),mode:"markers",type:"scatter3d",name:"Pareto Optimal",showlegend:!1,marker:{size:5,color:dA,symbol:"circle",opacity:.95,line:{color:"#059669",width:1,opacity:.8}},customdata:j.map(k=>[k.runId,k.x,k.y,k.z]),hovertemplate:`Run: %{customdata[0]}
${u[0].key}: %{customdata[1]:.4f}
${u[1].key}: %{customdata[2]:.4f}
${u[2].key}: %{customdata[3]:.4f}`,hoverlabel:{bgcolor:"#f0fdf4",bordercolor:"#86efac",font:{family:"system-ui, -apple-system, sans-serif",size:12,color:"#374151"},align:"left"}}];return E&&T.push({x:[E.x],y:[E.y],z:[E.z],mode:"markers",type:"scatter3d",name:"Start Point",showlegend:!1,marker:{size:5,color:pA,symbol:"circle",opacity:1,line:{color:"#d97706",width:1,opacity:1}},customdata:[[E.runId,E.x,E.y,E.z]],hovertemplate:`Run: %{customdata[0]} (StartPoint)
${u[0].key}: %{customdata[1]:.4f}
${u[1].key}: %{customdata[2]:.4f}
${u[2].key}: %{customdata[3]:.4f}`,hoverlabel:{bgcolor:"#fef3c7",bordercolor:"#fcd34d",font:{family:"system-ui, -apple-system, sans-serif",size:12,color:"#374151"},align:"left"}}),T},[y,u,p]),x=P=>{o(P)},S=P=>{u.length>=3||u.some(E=>E.key===P)||c([...u,{key:P,direction:"maximize"}])},w=P=>{c(u.filter(E=>E.key!==P))},O=P=>{c(u.map(E=>E.key===P?{...E,direction:E.direction==="maximize"?"minimize":"maximize"}:E))};return i.length===0?h.jsxs(xe,{children:[h.jsxs(or,{className:"pb-3",children:[h.jsx(sr,{className:"text-sm",children:r}),n&&h.jsx(xr,{className:"text-xs",children:n})]}),h.jsx(we,{children:h.jsx("div",{className:"flex h-48 items-center justify-center text-sm text-muted-foreground",children:"No metrics data available"})})]}):h.jsxs(xe,{children:[h.jsxs(or,{className:"pb-3",children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsx(sr,{className:"text-sm",children:r}),n&&h.jsx(xr,{className:"text-xs",children:n})]}),h.jsxs("div",{className:"flex gap-1",children:[h.jsx(Yn,{variant:"outline",size:"sm",onClick:()=>l("timeline"),className:`h-7 px-3 text-xs transition-colors ${s==="timeline"?"bg-blue-50 border-blue-300 text-blue-700 hover:bg-blue-100":"bg-white hover:bg-gray-50"}`,children:"Timeline"}),h.jsx(Yn,{variant:"outline",size:"sm",onClick:()=>l("pareto"),className:`h-7 px-3 text-xs transition-colors ${s==="pareto"?"bg-blue-50 border-blue-300 text-blue-700 hover:bg-blue-100":"bg-white hover:bg-gray-50"}`,children:"Pareto"})]})]}),s==="timeline"?h.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:i.map((P,E)=>h.jsx(Lr,{variant:a===P?"default":"outline",className:"cursor-pointer text-xs px-2 py-0.5",style:{backgroundColor:a===P?di[E%di.length]:void 0},onClick:()=>x(P),children:P},P))}):h.jsxs("div",{className:"space-y-2 pt-3",children:[h.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.map((P,E)=>{const j=u.find(T=>T.key===P),_=(j==null?void 0:j.direction)==="maximize";return h.jsxs(Lr,{variant:j?"default":"outline",className:"cursor-pointer text-xs px-2 py-1 transition-colors relative",style:{backgroundColor:j?di[E%di.length]:void 0,borderColor:j?di[E%di.length]:void 0},onClick:()=>{j?O(P):u.length<3&&S(P)},onContextMenu:T=>{T.preventDefault(),j&&w(P)},children:[P,j&&h.jsx("span",{className:"ml-1 text-[10px] opacity-90",children:_?"↑":"↓"})]},P)})}),u.length>0&&h.jsx("div",{className:"text-xs text-gray-500 italic",children:"Click: toggle direction ↑↓ • Right-click: remove"}),h.jsx("div",{className:"text-xs text-muted-foreground",children:u.length===0?h.jsx("span",{children:"Click metrics to select (up to 3)"}):u.length<2?h.jsx("span",{children:"Select at least 2 metrics for analysis"}):h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("span",{children:["Runs: ",v.length]}),m.size>0&&h.jsxs("span",{className:"text-emerald-600 font-medium",children:["Pareto Optimal: ",m.size]})]})})]})]}),h.jsx(we,{className:"pt-0",children:s==="timeline"?a?h.jsx(Xa,{width:"100%",height:280,children:h.jsxs(nm,{data:g,margin:{top:5,right:20,left:10,bottom:5},onClick:P=>{if(P&&P.activePayload&&P.activePayload[0]){const E=P.activePayload[0].payload;E.runId&&window.open(`/runs/${E.runId}`,"_blank")}},children:[h.jsx(Ls,{strokeDasharray:"3 3"}),h.jsx(Zn,{dataKey:"index",label:{value:"Index",position:"insideBottom",offset:-5,style:{fontSize:10}},type:"number",domain:["dataMin","dataMax"],tick:{fontSize:10}}),h.jsx(ei,{label:{value:"Value",angle:-90,position:"insideLeft",style:{fontSize:10}},tick:{fontSize:10}}),h.jsx(Ct,{cursor:{strokeDasharray:"5 5",stroke:"#94a3b8",strokeWidth:1},contentStyle:{backgroundColor:"transparent",border:"none",padding:0},content:({active:P,payload:E})=>{if(!P||!E||E.length===0)return null;const j=E[0].payload;return j.runId?h.jsxs("div",{style:{backgroundColor:"#f9fafb",border:"1px solid #d1d5db",borderRadius:"6px",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)",fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.4"},children:[h.jsxs("div",{style:{fontWeight:600,fontSize:"10px"},children:["Run: ",j.runId]}),h.jsxs("div",{style:{fontSize:"10px"},children:[a,": ",typeof j.value=="number"?j.value.toFixed(4):j.value]})]}):null}}),h.jsx(Pn,{type:"monotone",dataKey:"value",name:a,stroke:di[i.indexOf(a)%di.length],strokeWidth:2,dot:{r:3,style:{cursor:"pointer"}},activeDot:{r:5,style:{cursor:"pointer"}},connectNulls:!0})]})}):h.jsx("div",{className:"flex h-48 items-center justify-center text-sm text-muted-foreground",children:"Select a metric to display"}):u.length<2?h.jsx("div",{className:"flex h-80 items-center justify-center text-sm text-muted-foreground",children:"Select at least 2 metrics for Pareto analysis"}):y.all.length===0?h.jsx("div",{className:"flex h-80 items-center justify-center text-sm text-muted-foreground",children:"No runs with complete data for selected metrics"}):u.length===3?h.jsxs("div",{className:"w-full h-[550px] rounded-lg overflow-hidden",style:{background:"linear-gradient(135deg, #fafafa 0%, #f3f4f6 100%)"},children:[h.jsx("style",{children:`
- #pareto-3d-plot .nsewdrag {
- cursor: default !important;
- }
- #pareto-3d-plot .nsewdrag.cursor-crosshair {
- cursor: default !important;
- }
- `}),h.jsx(A.Suspense,{fallback:h.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:h.jsxs("div",{className:"text-center space-y-2",children:[h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-500 mx-auto"}),h.jsx("div",{children:"Loading 3D visualization..."})]})}),children:h.jsx(xfe,{divId:"pareto-3d-plot",data:b,onInitialized:(P,E)=>{E.on("plotly_click",j=>{var _;if(j&&j.points&&j.points[0]){const k=(_=j.points[0].customdata)==null?void 0:_[0];k&&window.open(`/runs/${k}`,"_blank")}})},onUpdate:(P,E)=>{E.removeAllListeners("plotly_click"),E.on("plotly_click",j=>{var _;if(j&&j.points&&j.points[0]){const k=(_=j.points[0].customdata)==null?void 0:_[0];k&&window.open(`/runs/${k}`,"_blank")}})},layout:{autosize:!0,transition:{duration:0},scene:{xaxis:{title:{text:`${u[0].key} (${u[0].direction})`,font:{size:10,color:"#374151",family:"system-ui"}},gridcolor:"#e5e7eb",gridwidth:1,showbackground:!0,backgroundcolor:"#fafafa",tickfont:{size:10,color:"#6b7280"}},yaxis:{title:{text:`${u[1].key} (${u[1].direction})`,font:{size:10,color:"#374151",family:"system-ui"}},gridcolor:"#e5e7eb",gridwidth:1,showbackground:!0,backgroundcolor:"#fafafa",tickfont:{size:10,color:"#6b7280"}},zaxis:{title:{text:`${u[2].key} (${u[2].direction})`,font:{size:10,color:"#374151",family:"system-ui"}},gridcolor:"#e5e7eb",gridwidth:1,showbackground:!0,backgroundcolor:"#fafafa",tickfont:{size:10,color:"#6b7280"}},camera:{eye:{x:1.7,y:1.7,z:1.3},center:{x:0,y:0,z:0},up:{x:0,y:0,z:1}},aspectmode:"cube"},showlegend:!1,hovermode:"closest",margin:{l:10,r:10,t:10,b:10},paper_bgcolor:"rgba(0,0,0,0)",plot_bgcolor:"rgba(0,0,0,0)",dragmode:"orbit"},config:{responsive:!0,displayModeBar:!0,displaylogo:!1,modeBarButtonsToRemove:["toImage"],modeBarButtonsToAdd:[]},style:{width:"100%",height:"100%"}})})]}):h.jsx(Xa,{width:"100%",height:400,children:h.jsxs(tfe,{margin:{top:20,right:20,bottom:60,left:60},children:[h.jsx(Ls,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),h.jsx(Zn,{type:"number",dataKey:"x",name:u[0].key,label:{value:`${u[0].key} (${u[0].direction})`,position:"insideBottom",offset:-10,style:{fontSize:10,fill:"#374151"}},tick:{fontSize:10,fill:"#6b7280"},domain:["dataMin - 0.1 * abs(dataMin)","dataMax + 0.1 * abs(dataMax)"]}),h.jsx(ei,{type:"number",dataKey:"y",name:u[1].key,label:{value:`${u[1].key} (${u[1].direction})`,angle:-90,position:"insideLeft",style:{fontSize:10,fill:"#374151"}},tick:{fontSize:10,fill:"#6b7280"},domain:["dataMin - 0.1 * abs(dataMin)","dataMax + 0.1 * abs(dataMax)"]}),h.jsx(Ct,{cursor:{strokeDasharray:"3 3"},content:({active:P,payload:E})=>{var R,I;if(!P||!E||!E[0])return null;const j=E[0].payload,_=j.runId===p,T=j.isParetoOptimal,k=_?"#fef3c7":T?"#f0fdf4":"#fafafa",M=_?"#fcd34d":T?"#86efac":"#d1d5db";return h.jsxs("div",{style:{backgroundColor:k,border:`1px solid ${M}`,borderRadius:"6px",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontSize:"10px"},children:[h.jsxs("div",{style:{fontWeight:600,marginBottom:"4px"},children:["Run: ",j.runId,_?" (StartPoint)":""]}),h.jsxs("div",{children:[u[0].key,": ",(R=j.x)==null?void 0:R.toFixed(4)]}),h.jsxs("div",{children:[u[1].key,": ",(I=j.y)==null?void 0:I.toFixed(4)]})]})}}),h.jsx(Ba,{name:"Dominated",data:y.all.filter(P=>!P.isParetoOptimal&&P.runId!==p),fill:hA,fillOpacity:.4,shape:"circle",onClick:P=>(P==null?void 0:P.runId)&&window.open(`/runs/${P.runId}`,"_blank")}),h.jsx(Ba,{name:"Pareto",data:y.all.filter(P=>P.isParetoOptimal&&P.runId!==p),fill:dA,fillOpacity:.95,shape:"circle",onClick:P=>(P==null?void 0:P.runId)&&window.open(`/runs/${P.runId}`,"_blank")}),p&&h.jsx(Ba,{name:"Start",data:y.all.filter(P=>P.runId===p),fill:pA,shape:"circle",onClick:P=>(P==null?void 0:P.runId)&&window.open(`/runs/${P.runId}`,"_blank")})]})})})]})}const Zx=A.createContext(void 0),ew=A.forwardRef(({className:e,value:t,onValueChange:r,...n},i)=>h.jsx(Zx.Provider,{value:{value:t,onValueChange:r},children:h.jsx("div",{ref:i,className:fe("w-full",e),...n})}));ew.displayName="Tabs";const tw=A.forwardRef(({className:e,...t},r)=>h.jsx("div",{ref:r,className:fe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));tw.displayName="TabsList";const hc=A.forwardRef(({className:e,value:t,...r},n)=>{const i=A.useContext(Zx);if(!i)throw new Error("TabsTrigger must be used within Tabs");const a=i.value===t;return h.jsx("button",{ref:n,className:fe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",e),onClick:()=>i.onValueChange(t),...r})});hc.displayName="TabsTrigger";const pc=A.forwardRef(({className:e,value:t,...r},n)=>{const i=A.useContext(Zx);if(!i)throw new Error("TabsContent must be used within Tabs");return i.value!==t?null:h.jsx("div",{ref:n,className:fe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r})});pc.displayName="TabsContent";const mA={UNKNOWN:"unknown",PENDING:"warning",RUNNING:"info",CANCELLED:"secondary",COMPLETED:"success",FAILED:"destructive"},Sfe=[{value:"ALL",label:"All Status"},{value:"COMPLETED",label:"Completed"},{value:"RUNNING",label:"Running"},{value:"FAILED",label:"Failed"},{value:"PENDING",label:"Pending"},{value:"CANCELLED",label:"Cancelled"}],Sv=10;function Ofe(){var w;const{id:e}=bT(),[t,r]=A.useState("overview"),[n,i]=A.useState(0),[a,o]=A.useState(""),[s,l]=A.useState("ALL"),{data:u,isLoading:c,error:f}=lp(e),{data:d,isLoading:p}=Xy(e,{page:n,pageSize:Sv}),{data:v}=Xy(e,{page:0,pageSize:1e3}),m=(v==null?void 0:v.length)||0,g=Math.ceil(m/Sv),{data:y,isLoading:b}=d2(e),x=A.useMemo(()=>{if(!d)return[];let O=[...d];if(a.trim()){const P=a.toLowerCase();O=O.filter(E=>{var j;return(j=E.id)==null?void 0:j.toLowerCase().includes(P)})}return s!=="ALL"&&(O=O.filter(P=>P.status===s)),O.sort((P,E)=>new Date(E.createdAt).getTime()-new Date(P.createdAt).getTime()),O},[d,a,s]),S=A.useMemo(()=>!v||v.length===0?[]:[{name:"COMPLETED",value:v.filter(P=>P.status==="COMPLETED").length,color:"#22c55e"},{name:"RUNNING",value:v.filter(P=>P.status==="RUNNING").length,color:"#3b82f6"},{name:"FAILED",value:v.filter(P=>P.status==="FAILED").length,color:"#ef4444"},{name:"PENDING",value:v.filter(P=>P.status==="PENDING").length,color:"#eab308"},{name:"CANCELLED",value:v.filter(P=>P.status==="CANCELLED").length,color:"#6b7280"},{name:"UNKNOWN",value:v.filter(P=>P.status==="UNKNOWN").length,color:"#a78bfa"}].filter(P=>P.value>0),[v]);return c?h.jsxs("div",{className:"space-y-4",children:[h.jsx(De,{className:"h-12 w-64"}),h.jsx(De,{className:"h-96 w-full"})]}):f||!u?h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Error"}),h.jsx(xr,{children:"Failed to load experiment"})]}),h.jsx(we,{children:h.jsx("p",{className:"text-destructive",children:(f==null?void 0:f.message)||"Experiment not found"})})]}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:u.name}),h.jsx("p",{className:"mt-0.5 text-muted-foreground font-mono text-sm",children:u.id})]}),h.jsx(Lr,{variant:mA[u.status],children:u.status})]}),h.jsxs(ew,{value:t,onValueChange:r,children:[h.jsxs(tw,{children:[h.jsx(hc,{value:"overview",children:"Overview"}),h.jsx(hc,{value:"runs",children:"Runs"})]}),h.jsxs(pc,{value:"overview",className:"space-y-4",children:[h.jsx(xe,{children:h.jsxs(we,{className:"p-4",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Details"}),h.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:[u.description&&h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Description"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:u.description})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Duration"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:u.duration>0?`${u.duration.toFixed(2)}s`:"-"})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Total Tokens"}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm",children:((w=u.aggregatedTokens)==null?void 0:w.totalTokens)!==void 0&&u.aggregatedTokens.totalTokens>0?h.jsxs(h.Fragment,{children:[Number(u.aggregatedTokens.totalTokens).toLocaleString(),u.aggregatedTokens.inputTokens!==void 0&&u.aggregatedTokens.outputTokens!==void 0&&h.jsxs("span",{className:"text-muted-foreground text-xs ml-1",children:["(",Number(u.aggregatedTokens.inputTokens).toLocaleString(),"↓ ",Number(u.aggregatedTokens.outputTokens).toLocaleString(),"↑)"]})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Created"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:Vo(new Date(u.createdAt),{addSuffix:!0})})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Updated"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:Vo(new Date(u.updatedAt),{addSuffix:!0})})]})]}),u.meta&&Object.keys(u.meta).length>0&&h.jsxs("div",{className:"mt-5 pt-5 border-t",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Metadata"}),h.jsx("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:Object.entries(u.meta).map(([O,P])=>h.jsxs("div",{className:"break-words",children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:O}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm break-all",children:typeof P=="string"?P:JSON.stringify(P)})]},O))})]}),u.params&&Object.keys(u.params).length>0&&h.jsxs("div",{className:"mt-5 pt-5 border-t",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Parameters"}),h.jsx("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:Object.entries(u.params).map(([O,P])=>h.jsxs("div",{className:"break-words",children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:O}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm break-all",children:typeof P=="string"?P:JSON.stringify(P)})]},O))})]}),v&&v.length>0&&S.length>0&&h.jsxs("div",{className:"mt-5 pt-5 border-t",children:[h.jsxs("h3",{className:"text-base font-semibold mb-6",children:["Statistics (",v.length," runs)"]}),h.jsx(Xa,{width:"100%",height:180,children:h.jsxs(f2,{margin:{top:20,bottom:5},children:[h.jsx(_n,{data:S,dataKey:"value",nameKey:"name",cx:"50%",cy:"48%",outerRadius:48,label:({name:O,value:P})=>`${O}: ${P}`,style:{fontSize:"10px"},children:S.map((O,P)=>h.jsx(cl,{fill:O.color},`cell-${P}`))}),h.jsx(Ct,{contentStyle:{fontSize:"10px",backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px"}}),h.jsx(rn,{wrapperStyle:{fontSize:"10px"}})]})})]})]})}),b?h.jsx(De,{className:"h-80 w-full"}):y&&Object.keys(y).length>0?h.jsx(wfe,{metrics:y,experimentId:e,title:"Metrics",description:"Switch between timeline and Pareto analysis views"}):h.jsxs(xe,{children:[h.jsxs(or,{className:"pb-3",children:[h.jsx(sr,{className:"text-sm",children:"Metrics"}),h.jsx(xr,{className:"text-xs",children:"No metrics data available"})]}),h.jsx(we,{children:h.jsx("div",{className:"flex h-24 items-center justify-center text-sm text-muted-foreground",children:v&&v.length>0?"No metrics logged yet":"No runs in this experiment"})})]})]}),h.jsx(pc,{value:"runs",className:"space-y-4",children:h.jsx(xe,{children:h.jsxs(we,{className:"p-0",children:[h.jsxs("div",{className:"flex gap-2 mb-3 items-center px-4 pt-4",children:[h.jsxs("div",{className:"relative w-64",children:[h.jsx(ku,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(qs,{placeholder:"Search runs...",value:a,onChange:O=>o(O.target.value),className:"pl-8 h-9 text-sm focus:bg-blue-50 focus:border-blue-300 focus-visible:ring-0"})]}),h.jsx(Qx,{value:s,onChange:O=>l(O),options:Sfe,className:"w-40"})]}),p?h.jsx("div",{className:"p-8",children:h.jsx(De,{className:"h-24 w-full"})}):!d||d.length===0?h.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No runs found"}):x.length===0?h.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No runs match your search"}):h.jsx("div",{className:"overflow-hidden rounded-lg",children:h.jsxs(Uc,{children:[h.jsx(Wc,{children:h.jsxs(ti,{className:"hover:bg-transparent border-b",children:[h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"UUID"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Status"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50 text-right",children:"Created"})]})}),h.jsx(Hc,{children:x.map(O=>h.jsxs(ti,{className:"hover:bg-accent/50 transition-colors border-b last:border-0",children:[h.jsx(Dt,{className:"py-3 text-sm font-mono",children:h.jsx(Va,{to:`/runs/${O.id}`,className:"text-blue-600 hover:text-blue-800 hover:underline font-medium transition-colors",children:O.id})}),h.jsx(Dt,{className:"py-3",children:h.jsx(Lr,{variant:mA[O.status],children:O.status})}),h.jsx(Dt,{className:"py-3 text-sm text-muted-foreground text-right",children:Vo(new Date(O.createdAt),{addSuffix:!0})})]},O.id))})]})}),!p&&x&&x.length>0&&h.jsx(Jx,{currentPage:n,totalPages:g,pageSize:Sv,totalItems:m,onPageChange:i,itemName:"runs"})]})})})]})]})}function Pfe({experiments:e}){const t=A.useMemo(()=>{const r=new Set;return e.forEach(i=>{i.params&&Object.keys(i.params).forEach(a=>r.add(a))}),Array.from(r).map(i=>{const a=e.map(l=>l.params&&i in l.params?JSON.stringify(l.params[i]):null),s=new Set(a.filter(l=>l!==null)).size>1;return{key:i,values:a,isDifferent:s}}).sort((i,a)=>i.isDifferent!==a.isDifferent?i.isDifferent?-1:1:i.key.localeCompare(a.key))},[e]);return h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Parameter Comparison"}),h.jsx(xr,{children:"Side-by-side comparison of experiment parameters"})]}),h.jsx(we,{children:t.length===0?h.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"No parameters to compare"}):h.jsxs(Uc,{children:[h.jsx(Wc,{children:h.jsxs(ti,{children:[h.jsx(It,{className:"font-semibold",children:"Parameter"}),e.map((r,n)=>h.jsx(It,{className:"font-semibold",children:r.name},r.id))]})}),h.jsx(Hc,{children:t.map(r=>h.jsxs(ti,{className:r.isDifferent?"bg-yellow-50 dark:bg-yellow-950":"",children:[h.jsx(Dt,{className:"font-medium",children:r.key}),r.values.map((n,i)=>h.jsx(Dt,{className:n===null?"text-muted-foreground italic":r.isDifferent?"font-medium":"",children:n===null?"-":n},i))]},r.key))})]})})]})}const vA=["#0ea5e9","#8b5cf6","#ec4899","#f59e0b","#10b981"];function Efe({experimentIds:e}){const t=e.map(a=>d2(a)),r=t.some(a=>a.isLoading),n=A.useMemo(()=>{if(r)return[];const a=new Map;return t.forEach((o,s)=>{const l=o.data||{};Object.entries(l).forEach(([u,c])=>{c.forEach(f=>{const d=f.createdAt,p=`exp${s+1}_${u}`;a.has(d)||a.set(d,{timestamp:d,time:Hi(new Date(d),"HH:mm:ss")});const v=a.get(d);v[p]=f.value})})}),Array.from(a.values()).sort((o,s)=>new Date(o.timestamp).getTime()-new Date(s.timestamp).getTime())},[t,r]),i=A.useMemo(()=>{const a=new Set;return n.length>0&&Object.keys(n[0]).forEach(o=>{o!=="timestamp"&&o!=="time"&&a.add(o)}),Array.from(a)},[n]);return r?h.jsxs(xe,{children:[h.jsx(or,{children:h.jsx(sr,{children:"Metrics Overlay"})}),h.jsx(we,{children:h.jsx(De,{className:"h-96 w-full"})})]}):n.length===0?h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Metrics Overlay"}),h.jsx(xr,{children:"Combined metrics visualization across experiments"})]}),h.jsx(we,{children:h.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:"No metrics data available for comparison"})})]}):h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Metrics Overlay"}),h.jsx(xr,{children:"Combined metrics from all selected experiments"})]}),h.jsx(we,{children:h.jsx(Xa,{width:"100%",height:400,children:h.jsxs(nm,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[h.jsx(Ls,{strokeDasharray:"3 3"}),h.jsx(Zn,{dataKey:"time",tick:{fontSize:10},label:{value:"Time",position:"insideBottom",offset:-5,style:{fontSize:10}}}),h.jsx(ei,{tick:{fontSize:10},label:{value:"Value",angle:-90,position:"insideLeft",style:{fontSize:10}}}),h.jsx(Ct,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"0.5rem",fontSize:"10px"}}),h.jsx(rn,{wrapperStyle:{fontSize:"10px"}}),i.map((a,o)=>h.jsx(Pn,{type:"monotone",dataKey:a,stroke:vA[o%vA.length],strokeWidth:2,dot:{r:3},connectNulls:!0},a))]})})})]})}const Afe={UNKNOWN:"unknown",PENDING:"warning",RUNNING:"info",CANCELLED:"secondary",COMPLETED:"success",FAILED:"destructive"};function jfe(){var i;const[e]=vL(),t=((i=e.get("ids"))==null?void 0:i.split(","))||[],{data:r,isLoading:n}=T5(t);return n?h.jsxs("div",{className:"space-y-4",children:[h.jsx(De,{className:"h-12 w-64"}),h.jsx(De,{className:"h-96 w-full"})]}):!r||r.length<2?h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Experiment Comparison"}),h.jsx(xr,{children:"Select at least 2 experiments to compare"})]}),h.jsx(we,{children:h.jsx("p",{className:"text-muted-foreground",children:"No experiments selected for comparison"})})]}):h.jsxs("div",{className:"space-y-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Experiment Comparison"}),h.jsxs("p",{className:"mt-2 text-muted-foreground",children:["Comparing ",r.length," experiments"]})]}),h.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:r.map(a=>h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsx(sr,{className:"text-lg",children:a.name}),h.jsx(Lr,{variant:Afe[a.status],children:a.status})]}),a.description&&h.jsx(xr,{children:a.description})]}),h.jsx(we,{children:h.jsxs("dl",{className:"space-y-2 text-sm",children:[h.jsxs("div",{className:"flex justify-between",children:[h.jsx("dt",{className:"text-muted-foreground",children:"Duration"}),h.jsx("dd",{className:"font-medium",children:a.duration>0?`${a.duration.toFixed(2)}s`:"-"})]}),h.jsxs("div",{className:"flex justify-between",children:[h.jsx("dt",{className:"text-muted-foreground",children:"Params"}),h.jsx("dd",{className:"font-medium",children:a.params?Object.keys(a.params).length:0})]})]})})]},a.id))}),h.jsx(Pfe,{experiments:r}),h.jsx(Efe,{experimentIds:t})]})}const _fe={UNKNOWN:"unknown",PENDING:"warning",RUNNING:"info",CANCELLED:"secondary",COMPLETED:"success",FAILED:"destructive"},Tfe=[{value:"ALL",label:"All Status"},{value:"COMPLETED",label:"Completed"},{value:"RUNNING",label:"Running"},{value:"FAILED",label:"Failed"},{value:"PENDING",label:"Pending"},{value:"CANCELLED",label:"Cancelled"}],Ov=10;function kfe(){var y;const{selectedTeamId:e}=Qs(),[t,r]=A.useState("ALL"),[n,i]=A.useState(""),[a,o]=A.useState(0),{data:s}=Wb(e||""),{data:l,isLoading:u}=pk(e||"",{page:0,pageSize:1e3,enabled:!!e}),c=((y=l==null?void 0:l[0])==null?void 0:y.id)||"",{data:f,isLoading:d}=Xy(c,{page:a,pageSize:Ov,enabled:!!c}),p=(s==null?void 0:s.totalRuns)||0,v=Math.ceil(p/Ov),m=A.useMemo(()=>{if(!f)return[];let b=[...f];if(n.trim()){const x=n.toLowerCase();b=b.filter(S=>{var w,O;return((w=S.id)==null?void 0:w.toLowerCase().includes(x))||((O=S.experimentId)==null?void 0:O.toLowerCase().includes(x))})}return t!=="ALL"&&(b=b.filter(x=>x.status===t)),b.sort((x,S)=>new Date(S.createdAt).getTime()-new Date(x.createdAt).getTime()),b},[f,t,n]),g=u||d;return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Runs"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse and monitor individual runs"})]}),h.jsxs("div",{className:"flex gap-2 items-center",children:[h.jsxs("div",{className:"relative w-80",children:[h.jsx(ku,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(qs,{placeholder:"Search runs...",value:n,onChange:b=>i(b.target.value),className:"pl-8 h-9 text-sm focus:bg-blue-50 focus:border-blue-300 focus-visible:ring-0"})]}),h.jsx(Qx,{value:t,onChange:b=>r(b),options:Tfe,className:"w-40"})]})]}),h.jsx(xe,{className:"border-0 shadow-sm",children:h.jsxs(we,{className:"p-0",children:[g?h.jsx("div",{className:"p-8",children:h.jsx(De,{className:"h-24 w-full"})}):!m||m.length===0?h.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:n.trim()?"No runs match your search":t!=="ALL"?`No ${t} runs found`:"No runs found"}):h.jsx("div",{className:"overflow-hidden rounded-lg",children:h.jsxs(Uc,{children:[h.jsx(Wc,{children:h.jsxs(ti,{className:"hover:bg-transparent border-b",children:[h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"UUID"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Experiment ID"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:"Status"}),h.jsx(It,{className:"h-11 text-xs font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50 text-right",children:"Created"})]})}),h.jsx(Hc,{children:m.map(b=>h.jsxs(ti,{className:"hover:bg-accent/50 transition-colors border-b last:border-0",children:[h.jsx(Dt,{className:"py-3 text-sm font-mono",children:h.jsx(Va,{to:`/runs/${b.id}`,className:"text-blue-600 hover:text-blue-800 hover:underline font-medium transition-colors",children:b.id})}),h.jsx(Dt,{className:"py-3 text-sm font-mono",children:h.jsx(Va,{to:`/experiments/${b.experimentId}`,className:"text-blue-600 hover:text-blue-800 hover:underline font-medium transition-colors",children:b.experimentId})}),h.jsx(Dt,{className:"py-3",children:h.jsx(Lr,{variant:_fe[b.status],children:b.status})}),h.jsx(Dt,{className:"py-3 text-sm text-muted-foreground text-right",children:Vo(new Date(b.createdAt),{addSuffix:!0})})]},b.id))})]})}),m&&m.length>0&&h.jsx(Jx,{currentPage:a,totalPages:v,pageSize:Ov,totalItems:p,onPageChange:o,itemName:"runs"})]})})]})}async function Nfe(){try{return(await lr(ur.listArtifactRepositories)).artifactRepos.map(t=>t.name)}catch(e){throw new Error(`Failed to list repositories: ${e instanceof Error?e.message:"Unknown error"}`)}}async function Cfe(e,t){try{return(await lr(ur.listArtifactTags,{team_id:e,repo_name:t})).artifactTags.map(n=>n.name)}catch(r){throw new Error(`Failed to list tags for repository ${t}: ${r instanceof Error?r.message:"Unknown error"}`)}}async function $fe(e,t,r){try{return(await lr(ur.getArtifactContent,{team_id:e,tag:t,repo_name:r})).artifactContent}catch(n){throw new Error(`Failed to get artifact content: ${n instanceof Error?n.message:"Unknown error"}`)}}function Mfe(){return Fr({queryKey:["artifacts","repositories"],queryFn:Nfe,staleTime:30*60*1e3})}function Ife(e,t){return Fr({queryKey:["artifacts","tags",e,t],queryFn:()=>Cfe(e,t),enabled:!!(e&&t),staleTime:10*60*1e3})}function h2(e,t,r,n=!0){return Fr({queryKey:["artifacts","content",e,t,r],queryFn:()=>$fe(e,t,r),enabled:!!(n&&e&&t&&r),staleTime:1/0,gcTime:30*60*1e3,retry:1})}const yA={OK:"bg-green-500",ERROR:"bg-red-500",UNSET:"bg-green-500"},gA=e=>{var n,i;const t=e.spanName.toLowerCase(),r=e.spanKind;return t.includes("openai")||t.includes("chat")||t.includes("completion")?{label:"LLM",icon:h.jsx(nF,{className:"h-3 w-3"}),badgeColor:"bg-purple-100 text-purple-700 border-purple-200"}:r==="CLIENT"||t.includes("http")||t.includes("api")?{label:"API",icon:h.jsx(EF,{className:"h-3 w-3"}),badgeColor:"bg-blue-100 text-blue-700 border-blue-200"}:t.includes("db")||t.includes("database")||t.includes("query")?{label:"DB",icon:h.jsx(mF,{className:"h-3 w-3"}),badgeColor:"bg-cyan-100 text-cyan-700 border-cyan-200"}:((n=e.spanAttributes)==null?void 0:n["traceloop.span.kind"])==="workflow"?{label:"Workflow",icon:h.jsx(wF,{className:"h-3 w-3"}),badgeColor:"bg-indigo-100 text-indigo-700 border-indigo-200"}:((i=e.spanAttributes)==null?void 0:i["traceloop.span.kind"])==="task"?{label:"Task",icon:h.jsx(IF,{className:"h-3 w-3"}),badgeColor:"bg-amber-100 text-amber-700 border-amber-200"}:{label:"Span",icon:h.jsx(Gy,{className:"h-3 w-3"}),badgeColor:"bg-gray-100 text-gray-700 border-gray-200"}};function Dfe({spans:e}){const[t,r]=A.useState(()=>new Set(e.filter(g=>!g.parentSpanId||g.parentSpanId==="").map(g=>g.spanId))),[n,i]=A.useState(null),a=()=>{const g=new Set(e.map(y=>y.spanId));r(g)},o=()=>{r(new Set)},s=A.useMemo(()=>{if(!e||e.length===0)return[];const g=new Map,y=[];e.forEach(S=>{g.set(S.spanId,{span:S,children:[],depth:0})}),e.forEach(S=>{const w=g.get(S.spanId);if(!S.parentSpanId||S.parentSpanId==="")y.push(w);else{const O=g.get(S.parentSpanId);O?(w.depth=O.depth+1,O.children.push(w)):y.push(w)}});const b=S=>{S.sort((w,O)=>new Date(w.span.timestamp).getTime()-new Date(O.span.timestamp).getTime()),S.forEach(w=>b(w.children))},x=S=>{var T,k,M;S.children.forEach(R=>x(R));const w=parseInt((T=S.span.spanAttributes)==null?void 0:T["gen_ai.usage.input_tokens"])||0,O=parseInt((k=S.span.spanAttributes)==null?void 0:k["gen_ai.usage.output_tokens"])||0,P=parseInt((M=S.span.spanAttributes)==null?void 0:M["llm.usage.total_tokens"])||0,E=S.children.reduce((R,I)=>R+(I.inputTokens||0),0),j=S.children.reduce((R,I)=>R+(I.outputTokens||0),0),_=S.children.reduce((R,I)=>R+(I.totalTokens||0),0);S.inputTokens=w+E,S.outputTokens=O+j,S.totalTokens=P+_};return b(y),y.forEach(S=>x(S)),y},[e]),{minTimestamp:l,maxTimestamp:u,totalDuration:c}=A.useMemo(()=>{if(!e||e.length===0)return{minTimestamp:0,maxTimestamp:0,totalDuration:0};const g=e.map(w=>new Date(w.timestamp).getTime()),y=e.map(w=>new Date(w.timestamp).getTime()+w.duration/1e6),b=Math.min(...g),x=Math.max(...y),S=x-b;return{minTimestamp:b,maxTimestamp:x,totalDuration:S||1}},[e]),f=g=>{r(y=>{const b=new Set(y);return b.has(g)?b.delete(g):b.add(g),b})},d=g=>{const y=g/1e3,b=y/1e3,x=b/1e3;return x>=1?`${x.toFixed(2)}s`:b>=1?`${b.toFixed(2)}ms`:`${y.toFixed(2)}μs`},p=g=>{const{span:y}=g,b=new Date(y.timestamp).getTime(),x=b+y.duration/1e6,S=(b-l)/c*100,w=(x-b)/c*100,O=yA[y.statusCode]||yA.UNSET;return h.jsx("div",{className:`${O} absolute h-6 rounded flex items-center px-1.5 text-white text-[10px] font-medium overflow-hidden transition-all hover:opacity-90 hover:shadow-md cursor-pointer shadow`,style:{left:`${S}%`,width:`${Math.max(w,.8)}%`},title:`${y.spanName}
-Duration: ${d(y.duration)}
-Status: ${y.statusCode}
-Kind: ${y.spanKind}`,children:h.jsx("span",{className:"truncate",children:d(y.duration)})})},v=g=>{const{span:y,children:b,depth:x,totalTokens:S,inputTokens:w,outputTokens:O}=g,P=b.length>0,E=t.has(y.spanId),j=gA(y),_=P&&S&&S>0;return h.jsxs("div",{children:[h.jsxs("div",{className:`flex items-center border-b border-border hover:bg-muted/30 transition-colors cursor-pointer h-10 ${(n==null?void 0:n.spanId)===y.spanId?"bg-accent":""}`,onClick:T=>{T.target.closest("button")||i(y)},children:[h.jsxs("div",{className:"flex-shrink-0 flex items-center gap-1.5 h-full min-w-0",style:{width:"320px",paddingLeft:`${x*10+8}px`,paddingRight:"8px"},children:[x>0&&h.jsx("div",{className:"absolute h-full border-l border-border/60",style:{left:`${(x-1)*10+8}px`}}),P?h.jsx("button",{onClick:()=>f(y.spanId),className:"p-0.5 hover:bg-accent rounded flex-shrink-0 transition-colors",children:E?h.jsx(sp,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"}):h.jsx(zb,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})}):h.jsx("div",{className:"w-[18px] flex-shrink-0"}),h.jsxs(Lr,{variant:"outline",className:`${j.badgeColor} flex items-center gap-0.5 px-1.5 py-0.5 text-[11px] font-medium flex-shrink-0`,children:[j.icon,h.jsx("span",{children:j.label})]}),h.jsx("span",{className:"text-[13px] font-medium truncate text-foreground",title:y.spanName,children:y.spanName})]}),h.jsxs("div",{className:"flex-shrink-0 flex items-center gap-1 whitespace-nowrap text-foreground h-full",style:{width:"90px",paddingLeft:"8px",paddingRight:"8px"},children:[h.jsx(Gy,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),h.jsx("span",{className:"text-[11px] font-mono",children:d(y.duration)})]}),h.jsx("div",{className:"flex-shrink-0 flex items-center whitespace-nowrap text-foreground h-full",style:{width:"90px",paddingLeft:"8px",paddingRight:"4px"},children:S&&S>0?h.jsxs("div",{className:"flex flex-col justify-center",children:[h.jsxs("div",{className:"font-mono flex items-center text-[11px] leading-tight",children:[_&&h.jsx("span",{className:"inline-block align-middle mr-0.5 text-muted-foreground text-[10px]",children:"∑"}),h.jsx("span",{children:S.toLocaleString()})]}),w&&O&&w>0&&O>0&&h.jsxs("div",{className:"text-muted-foreground text-[9px] font-mono leading-tight mt-0.5",children:[w.toLocaleString(),"↓ ",O.toLocaleString(),"↑"]})]}):h.jsx("span",{className:"text-muted-foreground/40 text-[11px]",children:"—"})}),h.jsx("div",{className:"flex-1 relative h-full min-w-0 flex items-center",style:{paddingLeft:"2px",paddingRight:"8px"},children:p(g)})]}),P&&E&&h.jsx("div",{children:b.map(T=>v(T))})]},y.spanId)};if(!e||e.length===0)return h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:h.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No traces available"})})});const m=g=>{const y=gA(g),b=g.spanAttributes||{},x=b["gen_ai.request.model"]||b["gen_ai.response.model"],S=b["gen_ai.request.temperature"],w=b["gen_ai.request.max_tokens"],O=b["gen_ai.request.top_p"],P=[];let E=0;for(;b[`gen_ai.prompt.${E}.role`];)P.push({role:b[`gen_ai.prompt.${E}.role`],content:b[`gen_ai.prompt.${E}.content`]}),E++;const j=[];for(E=0;b[`gen_ai.completion.${E}.role`];)j.push({role:b[`gen_ai.completion.${E}.role`],content:b[`gen_ai.completion.${E}.content`],finishReason:b[`gen_ai.completion.${E}.finish_reason`]}),E++;return h.jsx(xe,{className:"mt-2 border-2",children:h.jsxs(we,{className:"p-3",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsxs(Lr,{variant:"outline",className:`${y.badgeColor} flex items-center gap-0.5 px-1.5 py-0.5 text-[11px]`,children:[y.icon,y.label]}),h.jsx("h4",{className:"font-semibold text-[13px]",children:g.spanName})]}),h.jsx(Yn,{variant:"ghost",size:"sm",onClick:()=>i(null),className:"h-6 w-6 p-0 hover:bg-muted",children:h.jsx(_d,{className:"h-3 w-3"})})]}),x&&h.jsxs("div",{className:"mb-3",children:[h.jsx("h5",{className:"text-[11px] font-semibold mb-1.5 text-foreground uppercase tracking-wide",children:"Model Configuration"}),h.jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[10px] border rounded-md p-2 bg-muted/30",children:[h.jsxs("div",{className:"col-span-2",children:[h.jsx("span",{className:"text-muted-foreground font-medium",children:"Model:"}),h.jsx("span",{className:"ml-1.5 font-mono text-foreground",children:x})]}),S!==void 0&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground font-medium",children:"Temperature:"}),h.jsx("span",{className:"ml-1.5 font-mono text-foreground",children:S})]}),w&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground font-medium",children:"Max Tokens:"}),h.jsx("span",{className:"ml-1.5 font-mono text-foreground",children:w})]}),O!==void 0&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground font-medium",children:"Top P:"}),h.jsx("span",{className:"ml-1.5 font-mono text-foreground",children:O})]})]})]}),P.length>0&&h.jsxs("div",{className:"mb-3",children:[h.jsx("h5",{className:"text-[11px] font-semibold mb-1.5 text-foreground uppercase tracking-wide",children:"Input"}),h.jsx("div",{className:"space-y-1.5",children:P.map((_,T)=>h.jsxs("div",{className:"border rounded-md p-2 bg-muted/30",children:[h.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground mb-1 uppercase tracking-wide",children:_.role}),h.jsx("div",{className:"text-[11px] whitespace-pre-wrap leading-relaxed text-foreground",children:_.content})]},T))})]}),j.length>0&&h.jsxs("div",{className:"mb-3",children:[h.jsx("h5",{className:"text-[11px] font-semibold mb-1.5 text-foreground uppercase tracking-wide",children:"Output"}),h.jsx("div",{className:"space-y-1.5",children:j.map((_,T)=>h.jsxs("div",{className:"border rounded-md p-2 bg-muted/30",children:[h.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground mb-1 uppercase tracking-wide",children:_.role}),h.jsx("div",{className:"text-[11px] whitespace-pre-wrap leading-relaxed text-foreground",children:_.content})]},T))})]}),h.jsxs("details",{className:"mt-2",children:[h.jsxs("summary",{className:"text-[11px] font-semibold cursor-pointer hover:text-foreground text-muted-foreground py-0.5 uppercase tracking-wide",children:["All Attributes (",Object.keys(b).length,")"]}),h.jsx("div",{className:"mt-1.5 text-[11px] space-y-0.5 bg-muted/30 rounded-md p-2 max-h-48 overflow-auto border",children:Object.entries(b).map(([_,T])=>h.jsxs("div",{className:"grid grid-cols-3 gap-2 py-0.5",children:[h.jsxs("span",{className:"text-muted-foreground truncate font-medium text-[10px]",title:_,children:[_,":"]}),h.jsx("span",{className:"col-span-2 font-mono break-all text-[10px] text-foreground",children:String(T)})]},_))})]})]})})};return h.jsx(xe,{className:"shadow-sm",children:h.jsxs(we,{className:"p-3",children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Gy,{className:"h-3.5 w-3.5 text-muted-foreground"}),h.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Timeline"}),h.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[d(c*1e6)," · ",e.length," span",e.length!==1?"s":""]}),h.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[h.jsx("button",{onClick:a,className:"text-[11px] px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:"Expand all"}),h.jsx("span",{className:"text-muted-foreground/30 text-xs",children:"|"}),h.jsx("button",{onClick:o,className:"text-[11px] px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:"Collapse all"})]})]}),h.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),h.jsx("span",{className:"text-muted-foreground",children:"Success"})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),h.jsx("span",{className:"text-muted-foreground",children:"Error"})]})]})]}),h.jsxs("div",{className:"border rounded-md overflow-hidden bg-background shadow-sm",children:[h.jsxs("div",{className:"flex items-center bg-muted/50 border-b border-border font-semibold text-[10px] text-foreground uppercase tracking-wide h-8",children:[h.jsx("div",{className:"flex-shrink-0 flex items-center h-full",style:{width:"320px",paddingLeft:"8px",paddingRight:"8px"},children:"Span Name"}),h.jsx("div",{className:"flex-shrink-0 flex items-center h-full",style:{width:"90px",paddingLeft:"8px",paddingRight:"8px"},children:"Duration"}),h.jsx("div",{className:"flex-shrink-0 flex items-center h-full",style:{width:"90px",paddingLeft:"8px",paddingRight:"4px"},children:"Tokens"}),h.jsx("div",{className:"flex-1 flex items-center h-full",style:{paddingLeft:"2px",paddingRight:"8px"},children:"Timeline"})]}),s.map(g=>v(g))]}),n&&h.jsx("div",{className:"mt-2",children:m(n)})]})})}function qi(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function bA(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function p2(...e){return t=>{let r=!1;const n=e.map(i=>{const a=bA(i,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let i=0;i{const{children:o,...s}=a,l=A.useMemo(()=>s,Object.values(s));return h.jsx(r.Provider,{value:l,children:o})};n.displayName=e+"Provider";function i(a){const o=A.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,i]}function Lfe(e,t=[]){let r=[];function n(a,o){const s=A.createContext(o),l=r.length;r=[...r,o];const u=f=>{var y;const{scope:d,children:p,...v}=f,m=((y=d==null?void 0:d[e])==null?void 0:y[l])||s,g=A.useMemo(()=>v,Object.values(v));return h.jsx(m.Provider,{value:g,children:p})};u.displayName=a+"Provider";function c(f,d){var m;const p=((m=d==null?void 0:d[e])==null?void 0:m[l])||s,v=A.useContext(p);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,c]}const i=()=>{const a=r.map(o=>A.createContext(o));return function(s){const l=(s==null?void 0:s[e])||a;return A.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[n,Ffe(i,...t)]}function Ffe(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:u})=>{const f=l(a)[`__scope${u}`];return{...s,...f}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var mc=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},Bfe=R0[" useId ".trim().toString()]||(()=>{}),zfe=0;function Pv(e){const[t,r]=A.useState(Bfe());return mc(()=>{r(n=>n??String(zfe++))},[e]),e||(t?`radix-${t}`:"")}var Ufe=R0[" useInsertionEffect ".trim().toString()]||mc;function Wfe({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[i,a,o]=Hfe({defaultProp:t,onChange:r}),s=e!==void 0,l=s?e:i;{const c=A.useRef(e!==void 0);A.useEffect(()=>{const f=c.current;f!==s&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}const u=A.useCallback(c=>{var f;if(s){const d=Kfe(c)?c(e):c;d!==e&&((f=o.current)==null||f.call(o,d))}else a(c)},[s,e,a,o]);return[l,u]}function Hfe({defaultProp:e,onChange:t}){const[r,n]=A.useState(e),i=A.useRef(r),a=A.useRef(t);return Ufe(()=>{a.current=t},[t]),A.useEffect(()=>{var o;i.current!==r&&((o=a.current)==null||o.call(a,r),i.current=r)},[r,i]),[r,n,a]}function Kfe(e){return typeof e=="function"}function m2(e){const t=qfe(e),r=A.forwardRef((n,i)=>{const{children:a,...o}=n,s=A.Children.toArray(a),l=s.find(Gfe);if(l){const u=l.props.children,c=s.map(f=>f===l?A.Children.count(u)>1?A.Children.only(null):A.isValidElement(u)?u.props.children:null:f);return h.jsx(t,{...o,ref:i,children:A.isValidElement(u)?A.cloneElement(u,void 0,c):null})}return h.jsx(t,{...o,ref:i,children:a})});return r.displayName=`${e}.Slot`,r}function qfe(e){const t=A.forwardRef((r,n)=>{const{children:i,...a}=r;if(A.isValidElement(i)){const o=Xfe(i),s=Yfe(a,i.props);return i.type!==A.Fragment&&(s.ref=n?p2(n,o):o),A.cloneElement(i,s)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Vfe=Symbol("radix.slottable");function Gfe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vfe}function Yfe(e,t){const r={...t};for(const n in t){const i=e[n],a=t[n];/^on[A-Z]/.test(n)?i&&a?r[n]=(...s)=>{const l=a(...s);return i(...s),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...a}:n==="className"&&(r[n]=[i,a].filter(Boolean).join(" "))}return{...e,...r}}function Xfe(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Qfe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],si=Qfe.reduce((e,t)=>{const r=m2(`Primitive.${t}`),n=A.forwardRef((i,a)=>{const{asChild:o,...s}=i,l=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...s,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Jfe(e,t){e&&_b.flushSync(()=>e.dispatchEvent(t))}function vc(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function Zfe(e,t=globalThis==null?void 0:globalThis.document){const r=vc(e);A.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var ede="DismissableLayer",k0="dismissableLayer.update",tde="dismissableLayer.pointerDownOutside",rde="dismissableLayer.focusOutside",xA,v2=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y2=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=A.useContext(v2),[c,f]=A.useState(null),d=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=A.useState({}),v=fo(t,P=>f(P)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),b=c?m.indexOf(c):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,w=ade(P=>{const E=P.target,j=[...u.branches].some(_=>_.contains(E));!S||j||(i==null||i(P),o==null||o(P),P.defaultPrevented||s==null||s())},d),O=ode(P=>{const E=P.target;[...u.branches].some(_=>_.contains(E))||(a==null||a(P),o==null||o(P),P.defaultPrevented||s==null||s())},d);return Zfe(P=>{b===u.layers.size-1&&(n==null||n(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},d),A.useEffect(()=>{if(c)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(xA=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),wA(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=xA)}},[c,d,r,u]),A.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),wA())},[c,u]),A.useEffect(()=>{const P=()=>p({});return document.addEventListener(k0,P),()=>document.removeEventListener(k0,P)},[]),h.jsx(si.div,{...l,ref:v,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:qi(e.onFocusCapture,O.onFocusCapture),onBlurCapture:qi(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:qi(e.onPointerDownCapture,w.onPointerDownCapture)})});y2.displayName=ede;var nde="DismissableLayerBranch",ide=A.forwardRef((e,t)=>{const r=A.useContext(v2),n=A.useRef(null),i=fo(t,n);return A.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),h.jsx(si.div,{...e,ref:i})});ide.displayName=nde;function ade(e,t=globalThis==null?void 0:globalThis.document){const r=vc(e),n=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{const a=s=>{if(s.target&&!n.current){let l=function(){g2(tde,r,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function ode(e,t=globalThis==null?void 0:globalThis.document){const r=vc(e),n=A.useRef(!1);return A.useEffect(()=>{const i=a=>{a.target&&!n.current&&g2(rde,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function wA(){const e=new CustomEvent(k0);document.dispatchEvent(e)}function g2(e,t,r,{discrete:n}){const i=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?Jfe(i,a):i.dispatchEvent(a)}var Ev="focusScope.autoFocusOnMount",Av="focusScope.autoFocusOnUnmount",SA={bubbles:!1,cancelable:!0},sde="FocusScope",b2=A.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=A.useState(null),u=vc(i),c=vc(a),f=A.useRef(null),d=fo(t,m=>l(m)),p=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(n){let m=function(x){if(p.paused||!s)return;const S=x.target;s.contains(S)?f.current=S:pi(f.current,{select:!0})},g=function(x){if(p.paused||!s)return;const S=x.relatedTarget;S!==null&&(s.contains(S)||pi(f.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const w of x)w.removedNodes.length>0&&pi(s)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const b=new MutationObserver(y);return s&&b.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),b.disconnect()}}},[n,s,p.paused]),A.useEffect(()=>{if(s){PA.add(p);const m=document.activeElement;if(!s.contains(m)){const y=new CustomEvent(Ev,SA);s.addEventListener(Ev,u),s.dispatchEvent(y),y.defaultPrevented||(lde(hde(x2(s)),{select:!0}),document.activeElement===m&&pi(s))}return()=>{s.removeEventListener(Ev,u),setTimeout(()=>{const y=new CustomEvent(Av,SA);s.addEventListener(Av,c),s.dispatchEvent(y),y.defaultPrevented||pi(m??document.body,{select:!0}),s.removeEventListener(Av,c),PA.remove(p)},0)}}},[s,u,c,p]);const v=A.useCallback(m=>{if(!r&&!n||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const b=m.currentTarget,[x,S]=ude(b);x&&S?!m.shiftKey&&y===S?(m.preventDefault(),r&&pi(x,{select:!0})):m.shiftKey&&y===x&&(m.preventDefault(),r&&pi(S,{select:!0})):y===b&&m.preventDefault()}},[r,n,p.paused]);return h.jsx(si.div,{tabIndex:-1,...o,ref:d,onKeyDown:v})});b2.displayName=sde;function lde(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(pi(n,{select:t}),document.activeElement!==r)return}function ude(e){const t=x2(e),r=OA(t,e),n=OA(t.reverse(),e);return[r,n]}function x2(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function OA(e,t){for(const r of e)if(!cde(r,{upTo:t}))return r}function cde(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fde(e){return e instanceof HTMLInputElement&&"select"in e}function pi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&fde(e)&&t&&e.select()}}var PA=dde();function dde(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=EA(e,t),e.unshift(t)},remove(t){var r;e=EA(e,t),(r=e[0])==null||r.resume()}}}function EA(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function hde(e){return e.filter(t=>t.tagName!=="A")}var pde="Portal",w2=A.forwardRef((e,t)=>{var s;const{container:r,...n}=e,[i,a]=A.useState(!1);mc(()=>a(!0),[]);const o=r||i&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return o?_D.createPortal(h.jsx(si.div,{...n,ref:t}),o):null});w2.displayName=pde;function mde(e,t){return A.useReducer((r,n)=>t[r][n]??r,e)}var im=e=>{const{present:t,children:r}=e,n=vde(t),i=typeof r=="function"?r({present:n.isPresent}):A.Children.only(r),a=fo(n.ref,yde(i));return typeof r=="function"||n.isPresent?A.cloneElement(i,{ref:a}):null};im.displayName="Presence";function vde(e){const[t,r]=A.useState(),n=A.useRef(null),i=A.useRef(e),a=A.useRef("none"),o=e?"mounted":"unmounted",[s,l]=mde(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const u=kf(n.current);a.current=s==="mounted"?u:"none"},[s]),mc(()=>{const u=n.current,c=i.current;if(c!==e){const d=a.current,p=kf(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),mc(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,f=p=>{const m=kf(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},d=p=>{p.target===t&&(a.current=kf(n.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:A.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function kf(e){return(e==null?void 0:e.animationName)||"none"}function yde(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var jv=0;function gde(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??AA()),document.body.insertAdjacentElement("beforeend",e[1]??AA()),jv++,()=>{jv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jv--}},[])}function AA(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var yn=function(){return yn=Object.assign||function(t){for(var r,n=1,i=arguments.length;n"u")return Ide;var t=Dde(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Lde=E2(),Qo="data-scroll-locked",Fde=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,s=e.gap;return r===void 0&&(r="margin"),`
- .`.concat(xde,` {
- overflow: hidden `).concat(n,`;
- padding-right: `).concat(s,"px ").concat(n,`;
- }
- body[`).concat(Qo,`] {
- overflow: hidden `).concat(n,`;
- overscroll-behavior: contain;
- `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
- padding-left: `.concat(i,`px;
- padding-top: `).concat(a,`px;
- padding-right: `).concat(o,`px;
- margin-left:0;
- margin-top:0;
- margin-right: `).concat(s,"px ").concat(n,`;
- `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
- }
-
- .`).concat(Zf,` {
- right: `).concat(s,"px ").concat(n,`;
- }
-
- .`).concat(ed,` {
- margin-right: `).concat(s,"px ").concat(n,`;
- }
-
- .`).concat(Zf," .").concat(Zf,` {
- right: 0 `).concat(n,`;
- }
-
- .`).concat(ed," .").concat(ed,` {
- margin-right: 0 `).concat(n,`;
- }
-
- body[`).concat(Qo,`] {
- `).concat(wde,": ").concat(s,`px;
- }
-`)},_A=function(){var e=parseInt(document.body.getAttribute(Qo)||"0",10);return isFinite(e)?e:0},Bde=function(){A.useEffect(function(){return document.body.setAttribute(Qo,(_A()+1).toString()),function(){var e=_A()-1;e<=0?document.body.removeAttribute(Qo):document.body.setAttribute(Qo,e.toString())}},[])},zde=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;Bde();var a=A.useMemo(function(){return Rde(i)},[i]);return A.createElement(Lde,{styles:Fde(a,!t,i,r?"":"!important")})},N0=!1;if(typeof window<"u")try{var Nf=Object.defineProperty({},"passive",{get:function(){return N0=!0,!0}});window.addEventListener("test",Nf,Nf),window.removeEventListener("test",Nf,Nf)}catch{N0=!1}var wo=N0?{passive:!1}:!1,Ude=function(e){return e.tagName==="TEXTAREA"},A2=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Ude(e)&&r[t]==="visible")},Wde=function(e){return A2(e,"overflowY")},Hde=function(e){return A2(e,"overflowX")},TA=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=j2(e,n);if(i){var a=_2(e,n),o=a[1],s=a[2];if(o>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Kde=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},qde=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},j2=function(e,t){return e==="v"?Wde(t):Hde(t)},_2=function(e,t){return e==="v"?Kde(t):qde(t)},Vde=function(e,t){return e==="h"&&t==="rtl"?-1:1},Gde=function(e,t,r,n,i){var a=Vde(e,window.getComputedStyle(t).direction),o=a*n,s=r.target,l=t.contains(s),u=!1,c=o>0,f=0,d=0;do{if(!s)break;var p=_2(e,s),v=p[0],m=p[1],g=p[2],y=m-g-a*v;(v||y)&&j2(e,s)&&(f+=y,d+=v);var b=s.parentNode;s=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(c&&Math.abs(f)<1||!c&&Math.abs(d)<1)&&(u=!0),u},Cf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},kA=function(e){return[e.deltaX,e.deltaY]},NA=function(e){return e&&"current"in e?e.current:e},Yde=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Xde=function(e){return`
- .block-interactivity-`.concat(e,` {pointer-events: none;}
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
-`)},Qde=0,So=[];function Jde(e){var t=A.useRef([]),r=A.useRef([0,0]),n=A.useRef(),i=A.useState(Qde++)[0],a=A.useState(E2)[0],o=A.useRef(e);A.useEffect(function(){o.current=e},[e]),A.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=bde([e.lockRef.current],(e.shards||[]).map(NA),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=A.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var y=Cf(m),b=r.current,x="deltaX"in m?m.deltaX:b[0]-y[0],S="deltaY"in m?m.deltaY:b[1]-y[1],w,O=m.target,P=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&O.type==="range")return!1;var E=window.getSelection(),j=E&&E.anchorNode,_=j?j===O||j.contains(O):!1;if(_)return!1;var T=TA(P,O);if(!T)return!0;if(T?w=P:(w=P==="v"?"h":"v",T=TA(P,O)),!T)return!1;if(!n.current&&"changedTouches"in m&&(x||S)&&(n.current=w),!w)return!0;var k=n.current||w;return Gde(k,g,m,k==="h"?x:S)},[]),l=A.useCallback(function(m){var g=m;if(!(!So.length||So[So.length-1]!==a)){var y="deltaY"in g?kA(g):Cf(g),b=t.current.filter(function(w){return w.name===g.type&&(w.target===g.target||g.target===w.shadowParent)&&Yde(w.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var x=(o.current.shards||[]).map(NA).filter(Boolean).filter(function(w){return w.contains(g.target)}),S=x.length>0?s(g,x[0]):!o.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),u=A.useCallback(function(m,g,y,b){var x={name:m,delta:g,target:y,should:b,shadowParent:Zde(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),c=A.useCallback(function(m){r.current=Cf(m),n.current=void 0},[]),f=A.useCallback(function(m){u(m.type,kA(m),m.target,s(m,e.lockRef.current))},[]),d=A.useCallback(function(m){u(m.type,Cf(m),m.target,s(m,e.lockRef.current))},[]);A.useEffect(function(){return So.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,wo),document.addEventListener("touchmove",l,wo),document.addEventListener("touchstart",c,wo),function(){So=So.filter(function(m){return m!==a}),document.removeEventListener("wheel",l,wo),document.removeEventListener("touchmove",l,wo),document.removeEventListener("touchstart",c,wo)}},[]);var p=e.removeScrollBar,v=e.inert;return A.createElement(A.Fragment,null,v?A.createElement(a,{styles:Xde(i)}):null,p?A.createElement(zde,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Zde(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ehe=_de(P2,Jde);var T2=A.forwardRef(function(e,t){return A.createElement(am,yn({},e,{ref:t,sideCar:ehe}))});T2.classNames=am.classNames;var the=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Oo=new WeakMap,$f=new WeakMap,Mf={},Nv=0,k2=function(e){return e&&(e.host||k2(e.parentNode))},rhe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=k2(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},nhe=function(e,t,r,n){var i=rhe(t,Array.isArray(e)?e:[e]);Mf[r]||(Mf[r]=new WeakMap);var a=Mf[r],o=[],s=new Set,l=new Set(i),u=function(f){!f||s.has(f)||(s.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(s.has(d))c(d);else try{var p=d.getAttribute(n),v=p!==null&&p!=="false",m=(Oo.get(d)||0)+1,g=(a.get(d)||0)+1;Oo.set(d,m),a.set(d,g),o.push(d),m===1&&v&&$f.set(d,!0),g===1&&d.setAttribute(r,"true"),v||d.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",d,y)}})};return c(t),s.clear(),Nv++,function(){o.forEach(function(f){var d=Oo.get(f)-1,p=a.get(f)-1;Oo.set(f,d),a.set(f,p),d||($f.has(f)||f.removeAttribute(n),$f.delete(f)),p||f.removeAttribute(r)}),Nv--,Nv||(Oo=new WeakMap,Oo=new WeakMap,$f=new WeakMap,Mf={})}},ihe=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=the(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),nhe(n,i,r,"aria-hidden")):function(){return null}},om="Dialog",[N2]=Lfe(om),[ahe,un]=N2(om),C2=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=A.useRef(null),l=A.useRef(null),[u,c]=Wfe({prop:n,defaultProp:i??!1,onChange:a,caller:om});return h.jsx(ahe,{scope:t,triggerRef:s,contentRef:l,contentId:Pv(),titleId:Pv(),descriptionId:Pv(),open:u,onOpenChange:c,onOpenToggle:A.useCallback(()=>c(f=>!f),[c]),modal:o,children:r})};C2.displayName=om;var $2="DialogTrigger",ohe=A.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=un($2,r),a=fo(t,i.triggerRef);return h.jsx(si.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":iw(i.open),...n,ref:a,onClick:qi(e.onClick,i.onOpenToggle)})});ohe.displayName=$2;var rw="DialogPortal",[she,M2]=N2(rw,{forceMount:void 0}),I2=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,a=un(rw,t);return h.jsx(she,{scope:t,forceMount:r,children:A.Children.map(n,o=>h.jsx(im,{present:r||a.open,children:h.jsx(w2,{asChild:!0,container:i,children:o})}))})};I2.displayName=rw;var Lh="DialogOverlay",D2=A.forwardRef((e,t)=>{const r=M2(Lh,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=un(Lh,e.__scopeDialog);return a.modal?h.jsx(im,{present:n||a.open,children:h.jsx(uhe,{...i,ref:t})}):null});D2.displayName=Lh;var lhe=m2("DialogOverlay.RemoveScroll"),uhe=A.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=un(Lh,r);return h.jsx(T2,{as:lhe,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(si.div,{"data-state":iw(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),to="DialogContent",R2=A.forwardRef((e,t)=>{const r=M2(to,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,a=un(to,e.__scopeDialog);return h.jsx(im,{present:n||a.open,children:a.modal?h.jsx(che,{...i,ref:t}):h.jsx(fhe,{...i,ref:t})})});R2.displayName=to;var che=A.forwardRef((e,t)=>{const r=un(to,e.__scopeDialog),n=A.useRef(null),i=fo(t,r.contentRef,n);return A.useEffect(()=>{const a=n.current;if(a)return ihe(a)},[]),h.jsx(L2,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qi(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:qi(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:qi(e.onFocusOutside,a=>a.preventDefault())})}),fhe=A.forwardRef((e,t)=>{const r=un(to,e.__scopeDialog),n=A.useRef(!1),i=A.useRef(!1);return h.jsx(L2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,s;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(n.current||(s=r.triggerRef.current)==null||s.focus(),a.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:a=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),L2=A.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=un(to,r),l=A.useRef(null),u=fo(t,l);return gde(),h.jsxs(h.Fragment,{children:[h.jsx(b2,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:a,children:h.jsx(y2,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":iw(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(dhe,{titleId:s.titleId}),h.jsx(phe,{contentRef:l,descriptionId:s.descriptionId})]})]})}),nw="DialogTitle",F2=A.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=un(nw,r);return h.jsx(si.h2,{id:i.titleId,...n,ref:t})});F2.displayName=nw;var B2="DialogDescription",z2=A.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=un(B2,r);return h.jsx(si.p,{id:i.descriptionId,...n,ref:t})});z2.displayName=B2;var U2="DialogClose",W2=A.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=un(U2,r);return h.jsx(si.button,{type:"button",...n,ref:t,onClick:qi(e.onClick,()=>i.onOpenChange(!1))})});W2.displayName=U2;function iw(e){return e?"open":"closed"}var H2="DialogTitleWarning",[Whe,K2]=Rfe(H2,{contentName:to,titleName:nw,docsSlug:"dialog"}),dhe=({titleId:e})=>{const t=K2(H2),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
-
-If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
-
-For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return A.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},hhe="DialogDescriptionWarning",phe=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${K2(hhe).contentName}}.`;return A.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mhe=C2,vhe=I2,q2=D2,V2=R2,G2=F2,Y2=z2,yhe=W2;const ghe=mhe,bhe=vhe,X2=A.forwardRef(({className:e,...t},r)=>h.jsx(q2,{ref:r,className:fe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));X2.displayName=q2.displayName;const Q2=A.forwardRef(({className:e,children:t,...r},n)=>h.jsxs(bhe,{children:[h.jsx(X2,{}),h.jsxs(V2,{ref:n,className:fe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,h.jsxs(yhe,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(_d,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Q2.displayName=V2.displayName;const J2=({className:e,...t})=>h.jsx("div",{className:fe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});J2.displayName="DialogHeader";const Z2=A.forwardRef(({className:e,...t},r)=>h.jsx(G2,{ref:r,className:fe("text-lg font-semibold leading-none tracking-tight",e),...t}));Z2.displayName=G2.displayName;const eM=A.forwardRef(({className:e,...t},r)=>h.jsx(Y2,{ref:r,className:fe("text-sm text-muted-foreground",e),...t}));eM.displayName=Y2.displayName;function tM({open:e,onOpenChange:t,artifactContent:r,isLoading:n,error:i,title:a="Artifact Content"}){const[o,s]=A.useState(!1),l=()=>{r!=null&&r.content&&(navigator.clipboard.writeText(r.content),s(!0),setTimeout(()=>s(!1),2e3))},u=()=>{if(!r)return"";const{content:f,filename:d,contentType:p}=r;if(p==="application/json"||d.endsWith(".json"))try{const v=JSON.parse(f);return JSON.stringify(v,null,2)}catch{return f}return f},c=()=>{if(!r)return"";const{filename:f,contentType:d}=r;return d==="application/json"||f.endsWith(".json")?"language-json":""};return h.jsx(ghe,{open:e,onOpenChange:t,children:h.jsxs(Q2,{className:"max-w-5xl max-h-[85vh] overflow-hidden flex flex-col",children:[h.jsx(J2,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx(Z2,{className:"text-base",children:a}),h.jsx(eM,{className:"text-xs font-mono mt-1 truncate",children:(r==null?void 0:r.filename)||"Loading..."})]}),r&&h.jsx(Yn,{variant:"ghost",size:"sm",onClick:l,className:"ml-2 h-7 w-7 p-0 flex-shrink-0",title:o?"Copied!":"Copy to clipboard",children:o?h.jsx(JT,{className:"h-3.5 w-3.5 text-green-600"}):h.jsx(ZT,{className:"h-3.5 w-3.5"})})]})}),h.jsx("div",{className:"flex-1 overflow-auto border rounded-md bg-slate-950 dark:bg-slate-950",children:n&&!r?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"text-slate-400 text-sm",children:"Loading artifact..."})}):i?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"text-red-400 text-sm",children:"Failed to load artifact"})}):h.jsx("pre",{className:`text-xs p-4 overflow-auto text-slate-50 ${c()}`,children:h.jsx("code",{className:"text-slate-50",children:u()})})})]})})}const xhe={UNKNOWN:"unknown",PENDING:"warning",RUNNING:"info",CANCELLED:"secondary",COMPLETED:"success",FAILED:"destructive"};function whe(){var S,w;const{id:e}=bT(),{data:t,isLoading:r,error:n}=mk(e),[i,a]=A.useState(!1),[o,s]=A.useState("overview"),l=(t==null?void 0:t.metrics)||[],u=(t==null?void 0:t.spans)||[],c=r,f=r,d=n,p=(S=t==null?void 0:t.meta)==null?void 0:S.execution_result,v=(p==null?void 0:p.path)&&(p==null?void 0:p.file_name);let m="";if(v){let O=p.path;if(O.includes(":")&&(O=O.split(":")[1]),O.includes("/")){const P=O.split("/");O=P[P.length-1],O.includes(":")&&(O=O.split(":")[1])}m=O}const{data:g,isLoading:y,error:b}=h2((t==null?void 0:t.teamId)||"",m,"execution",i&&v),x=()=>{!v||!t||a(!0)};return b&&i&&console.error("Failed to load artifact:",b),r?h.jsxs("div",{className:"space-y-4",children:[h.jsx(De,{className:"h-12 w-64"}),h.jsx(De,{className:"h-96 w-full"})]}):n||!t?h.jsxs(xe,{children:[h.jsxs(or,{children:[h.jsx(sr,{children:"Error"}),h.jsx(xr,{children:"Failed to load run"})]}),h.jsx(we,{children:h.jsx("p",{className:"text-destructive",children:(n==null?void 0:n.message)||"Run not found"})})]}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Run Details"}),h.jsx("p",{className:"mt-1 text-muted-foreground font-mono text-sm",children:t.id})]}),h.jsx(Lr,{variant:xhe[t.status],children:t.status})]}),h.jsxs(ew,{value:o,onValueChange:s,children:[h.jsxs(tw,{children:[h.jsx(hc,{value:"overview",children:"Overview"}),h.jsx(hc,{value:"traces",children:"Traces"})]}),h.jsxs(pc,{value:"overview",className:"space-y-4",children:[h.jsx(xe,{children:h.jsxs(we,{className:"p-4",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Overview"}),h.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:[v&&h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Execution Result"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:h.jsxs("button",{onClick:x,disabled:y,className:"inline-flex items-center gap-1.5 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 hover:underline",children:[h.jsx(yF,{className:"h-3.5 w-3.5"}),p.file_name]})})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Tokens"}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm",children:((w=t.aggregatedTokens)==null?void 0:w.totalTokens)!==void 0&&t.aggregatedTokens.totalTokens>0?h.jsxs(h.Fragment,{children:[Number(t.aggregatedTokens.totalTokens).toLocaleString(),h.jsxs("span",{className:"text-muted-foreground text-xs ml-1",children:["(",Number(t.aggregatedTokens.inputTokens||0).toLocaleString(),"↓ ",Number(t.aggregatedTokens.outputTokens||0).toLocaleString(),"↑)"]})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})})]}),h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Created"}),h.jsx("dd",{className:"mt-1.5 text-foreground text-sm",children:Vo(new Date(t.createdAt),{addSuffix:!0})})]})]}),t.meta&&Object.keys(t.meta).filter(O=>O!=="execution_result").length>0&&h.jsxs("div",{className:"mt-5 pt-5 border-t",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Metadata"}),h.jsx("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:Object.entries(t.meta).filter(([O])=>O!=="execution_result").map(([O,P])=>h.jsxs("div",{className:"break-words",children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:O}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm break-all",children:typeof P=="string"?P:JSON.stringify(P)})]},O))})]})]})}),h.jsx(xe,{children:h.jsxs(we,{className:"p-4",children:[h.jsx("h3",{className:"text-base font-semibold mb-3",children:"Metrics"}),c?h.jsx(De,{className:"h-32 w-full"}):l.length===0?h.jsx("div",{className:"flex h-24 items-center justify-center text-sm text-muted-foreground",children:"No metrics logged for this run"}):h.jsx("dl",{className:"grid grid-cols-3 gap-3 text-sm",children:l.map(O=>h.jsxs("div",{children:[h.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:O.key}),h.jsx("dd",{className:"mt-1.5 text-foreground font-mono text-sm",children:O.value})]},O.id))})]})})]}),h.jsx(pc,{value:"traces",children:f?h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:h.jsx(De,{className:"h-64 w-full"})})}):d?h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:h.jsxs("div",{className:"text-red-500",children:["Error loading traces: ",d.message]})})}):u&&u.length>0?h.jsx(Dfe,{spans:u}):h.jsx(xe,{children:h.jsx(we,{className:"p-4",children:h.jsx("div",{className:"flex h-24 items-center justify-center text-sm text-muted-foreground",children:"No traces available for this run"})})})})]}),h.jsx(tM,{open:i,onOpenChange:a,artifactContent:g,isLoading:y,error:b,title:"Artifact Content"})]})}function She(){const{selectedTeamId:e}=Qs(),[t,r]=A.useState(""),[n,i]=A.useState(""),[a,o]=A.useState(null),[s,l]=A.useState(null),[u,c]=A.useState(!1),{data:f,isLoading:d,error:p}=Mfe(),m=(E=>{if(!E)return"";const j=E.split("/");return j[j.length-1]})(a),{data:g,isLoading:y}=Ife(e||"",m),{data:b,isLoading:x,error:S}=h2(e||"",s||"",m,u&&!!s),w=A.useMemo(()=>{if(!f)return[];if(!t.trim())return f;const E=t.toLowerCase();return f.filter(j=>j.toLowerCase().includes(E))},[f,t]),O=A.useMemo(()=>{if(!g)return[];if(!n.trim())return g;const E=n.toLowerCase();return g.filter(j=>j.toLowerCase().includes(E))},[g,n]),P=E=>{l(E),c(!0)};return h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Artifacts"}),h.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse and manage experiment artifacts"})]}),h.jsxs("div",{className:"grid grid-cols-12 gap-4",children:[h.jsxs(xe,{className:"border-0 shadow-sm col-span-4",children:[h.jsxs(or,{className:"pb-3",children:[h.jsx(sr,{className:"text-base font-semibold",children:"Repositories"}),h.jsxs(xr,{className:"text-[13px]",children:[(f==null?void 0:f.length)||0," repositories available"]})]}),h.jsxs(we,{children:[h.jsxs("div",{className:"relative mb-4",children:[h.jsx(ku,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(qs,{placeholder:"Search repositories...",value:t,onChange:E=>r(E.target.value),className:"pl-8 h-9 text-[13px] font-medium focus:bg-blue-50 focus:border-blue-300 focus-visible:ring-0"})]}),d?h.jsxs("div",{className:"space-y-1",children:[h.jsx(De,{className:"h-11 w-full"}),h.jsx(De,{className:"h-11 w-full"}),h.jsx(De,{className:"h-11 w-full"})]}):p?h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx(Xf,{className:"h-10 w-10 text-muted-foreground mb-2 opacity-30"}),h.jsx("p",{className:"text-[12px] font-medium text-destructive",children:"Failed to load"})]}):!w||w.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx(Xf,{className:"h-10 w-10 text-muted-foreground mb-2 opacity-30"}),h.jsx("p",{className:"text-[12px] font-medium text-muted-foreground",children:"No repositories"})]}):h.jsx("div",{className:"space-y-1 max-h-[600px] overflow-y-auto pr-1",children:w.map(E=>h.jsx("button",{onClick:()=>o(E),title:E,className:`w-full text-left px-3 py-2.5 rounded-md transition-all ${a===E?"bg-blue-50 text-blue-700":"hover:bg-accent"}`,children:h.jsxs("div",{className:"flex items-start gap-2.5",children:[h.jsx(Xf,{className:`h-4 w-4 flex-shrink-0 mt-0.5 ${a===E?"text-blue-600":"text-muted-foreground"}`}),h.jsx("span",{className:"text-[13px] font-mono font-medium break-all leading-relaxed",children:E})]})},E))})]})]}),h.jsxs(xe,{className:"border-0 shadow-sm col-span-8",children:[h.jsxs(or,{className:"pb-3",children:[h.jsx(sr,{className:"text-base font-semibold",children:a?`Tags in ${a}`:"Tags"}),h.jsx(xr,{className:"text-[13px]",children:a?`${(O==null?void 0:O.length)||0} tags available`:"Select a repository to view tags"})]}),h.jsx(we,{children:a?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"relative mb-4",children:[h.jsx(ku,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(qs,{placeholder:"Search tags...",value:n,onChange:E=>i(E.target.value),className:"pl-8 h-9 text-[13px] font-medium focus:bg-blue-50 focus:border-blue-300 focus-visible:ring-0"})]}),y?h.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[h.jsx(De,{className:"h-11 w-full"}),h.jsx(De,{className:"h-11 w-full"}),h.jsx(De,{className:"h-11 w-full"})]}):!O||O.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[h.jsx(Fm,{className:"h-10 w-10 text-muted-foreground mb-2 opacity-30"}),h.jsx("p",{className:"text-[12px] font-medium text-muted-foreground",children:n?"No matching tags":"No tags found"})]}):h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 max-h-[500px] overflow-y-auto",children:O.map(E=>h.jsx("button",{onClick:()=>P(E),title:E,className:"text-left px-3 py-2.5 rounded-md border border-border bg-background hover:bg-blue-50 hover:border-blue-300 transition-all",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(Fm,{className:"h-3.5 w-3.5 flex-shrink-0 mt-0.5 text-blue-600"}),h.jsx("span",{className:"text-[13px] font-mono break-all leading-relaxed",children:E})]})},E))})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-[500px] text-center",children:[h.jsx(Fm,{className:"h-12 w-12 text-muted-foreground mb-3 opacity-20"}),h.jsx("p",{className:"text-[13px] font-medium text-muted-foreground",children:"Select a repository"}),h.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Choose a repository from the left panel"})]})})]})]}),h.jsx(tM,{open:u,onOpenChange:c,artifactContent:b,isLoading:x,error:S,title:s||"Artifact Content"})]})}function Ohe(){const[e,t]=A.useState(null),[r,n]=A.useState(!0),[i,a]=A.useState(null),{selectedTeamId:o,setSelectedTeamId:s}=Qs(),l=uT();return A.useEffect(()=>{async function u(){try{const c=await xL(),f=localStorage.getItem("alphatrion_user_id");f&&f!==c&&(console.log("User ID changed, clearing cache"),l.clear()),localStorage.setItem("alphatrion_user_id",c);const d=await lr(ur.getUser,{id:c});if(!d.user)throw new Error(`User with ID ${c} not found`);t(d.user);const p=await lr(ur.listTeams,{userId:c});if(p.teams&&p.teams.length>0){const v=`alphatrion_selected_team_${c}`,m=localStorage.getItem(v);let g;m&&p.teams.find(b=>b.id===m)?g=m:g=p.teams[0].id,s(g,c)}}catch(c){console.error("Failed to initialize app:",c),a(c)}finally{n(!1)}}u()},[s,l]),r?h.jsx("div",{className:"flex h-screen items-center justify-center",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),h.jsx("p",{className:"text-gray-600",children:"Loading user information..."})]})}):i?h.jsx("div",{className:"flex h-screen items-center justify-center",children:h.jsxs("div",{className:"text-center max-w-md",children:[h.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-4",children:"Error Loading User"}),h.jsx("p",{className:"text-gray-700 mb-2",children:i.message}),h.jsx("p",{className:"text-gray-500 text-sm",children:"Please verify:"}),h.jsxs("ul",{className:"text-gray-500 text-sm text-left mt-2 space-y-1",children:[h.jsx("li",{children:"• The user ID exists in the database"}),h.jsx("li",{children:"• The backend server is running"}),h.jsx("li",{children:"• The dashboard was started with correct --userid flag"})]})]})}):e?h.jsx("div",{className:"h-full",children:h.jsx(X3,{user:e,children:h.jsx(iL,{children:h.jsxs(Hr,{path:"/",element:h.jsx(N5,{}),children:[h.jsx(Hr,{index:!0,element:h.jsx(sfe,{})}),h.jsxs(Hr,{path:"experiments",children:[h.jsx(Hr,{index:!0,element:h.jsx(hfe,{})}),h.jsx(Hr,{path:":id",element:h.jsx(Ofe,{})}),h.jsx(Hr,{path:"compare",element:h.jsx(jfe,{})})]}),h.jsxs(Hr,{path:"runs",children:[h.jsx(Hr,{index:!0,element:h.jsx(kfe,{})}),h.jsx(Hr,{path:":id",element:h.jsx(whe,{})})]}),h.jsx(Hr,{path:"artifacts",element:h.jsx(She,{})})]})})})}):null}Cv.createRoot(document.getElementById("root")).render(h.jsx(N.StrictMode,{children:h.jsx(ZD,{client:yL,children:h.jsx(dL,{children:h.jsx(gL,{children:h.jsx(Ohe,{})})})})}));export{Vc as c,Ae as g,yre as p,A as r};
diff --git a/dashboard/static/assets/index-Cimlr8QB.js b/dashboard/static/assets/index-Cimlr8QB.js
new file mode 100644
index 00000000..7fe70b43
--- /dev/null
+++ b/dashboard/static/assets/index-Cimlr8QB.js
@@ -0,0 +1,575 @@
+var aw=e=>{throw TypeError(e)};var om=(e,t,r)=>t.has(e)||aw("Cannot "+r);var $=(e,t,r)=>(om(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?aw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),X=(e,t,r,n)=>(om(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),me=(e,t,r)=>(om(e,t,"access private method"),r);var Hc=(e,t,r,n)=>({set _(i){X(e,t,i,r)},get _(){return $(e,t,n)}});function JM(e,t){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var BA={exports:{}},Dh={},zA={exports:{}},pe={};/**
+ * @license React
+ * react.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var bc=Symbol.for("react.element"),ZM=Symbol.for("react.portal"),e2=Symbol.for("react.fragment"),t2=Symbol.for("react.strict_mode"),r2=Symbol.for("react.profiler"),n2=Symbol.for("react.provider"),i2=Symbol.for("react.context"),a2=Symbol.for("react.forward_ref"),o2=Symbol.for("react.suspense"),s2=Symbol.for("react.memo"),l2=Symbol.for("react.lazy"),ow=Symbol.iterator;function u2(e){return e===null||typeof e!="object"?null:(e=ow&&e[ow]||e["@@iterator"],typeof e=="function"?e:null)}var UA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WA=Object.assign,HA={};function qs(e,t,r){this.props=e,this.context=t,this.refs=HA,this.updater=r||UA}qs.prototype.isReactComponent={};qs.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};qs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function KA(){}KA.prototype=qs.prototype;function k0(e,t,r){this.props=e,this.context=t,this.refs=HA,this.updater=r||UA}var C0=k0.prototype=new KA;C0.constructor=k0;WA(C0,qs.prototype);C0.isPureReactComponent=!0;var sw=Array.isArray,qA=Object.prototype.hasOwnProperty,N0={current:null},VA={key:!0,ref:!0,__self:!0,__source:!0};function GA(e,t,r){var n,i={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)qA.call(t,n)&&!VA.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1>>1,H=N[V];if(0>>1;Vi(be,W))Uei(we,be)?(N[V]=we,N[Ue]=W,V=Ue):(N[V]=be,N[re]=W,V=re);else if(Uei(we,W))N[V]=we,N[Ue]=W,V=Ue;else break e}}return F}function i(N,F){var W=N.sortIndex-F.sortIndex;return W!==0?W:N.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var l=[],u=[],c=1,f=null,d=3,h=!1,v=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(N){for(var F=r(u);F!==null;){if(F.callback===null)n(u);else if(F.startTime<=N)n(u),F.sortIndex=F.expirationTime,t(l,F);else break;F=r(u)}}function S(N){if(m=!1,x(N),!v)if(r(l)!==null)v=!0,L(w);else{var F=r(u);F!==null&&z(S,F.startTime-N)}}function w(N,F){v=!1,m&&(m=!1,y(E),E=-1),h=!0;var W=d;try{for(x(F),f=r(l);f!==null&&(!(f.expirationTime>F)||N&&!T());){var V=f.callback;if(typeof V=="function"){f.callback=null,d=f.priorityLevel;var H=V(f.expirationTime<=F);F=e.unstable_now(),typeof H=="function"?f.callback=H:f===r(l)&&n(l),x(F)}else n(l);f=r(l)}if(f!==null)var Y=!0;else{var re=r(u);re!==null&&z(S,re.startTime-F),Y=!1}return Y}finally{f=null,d=W,h=!1}}var O=!1,P=null,E=-1,j=5,_=-1;function T(){return!(e.unstable_now()-_N||125V?(N.sortIndex=W,t(u,N),r(l)===null&&N===r(u)&&(m?(y(E),E=-1):m=!0,z(S,W-V))):(N.sortIndex=H,t(l,N),v||h||(v=!0,L(w))),N},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(N){var F=d;return function(){var W=d;d=F;try{return N.apply(this,arguments)}finally{d=W}}}})(ZA);JA.exports=ZA;var x2=JA.exports;/**
+ * @license React
+ * react-dom.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var w2=A,mr=x2;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kv=Object.prototype.hasOwnProperty,S2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,uw={},cw={};function O2(e){return kv.call(cw,e)?!0:kv.call(uw,e)?!1:S2.test(e)?cw[e]=!0:(uw[e]=!0,!1)}function P2(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function E2(e,t,r,n){if(t===null||typeof t>"u"||P2(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Gt(e,t,r,n,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_t[e]=new Gt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_t[t]=new Gt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_t[e]=new Gt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_t[e]=new Gt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_t[e]=new Gt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_t[e]=new Gt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_t[e]=new Gt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_t[e]=new Gt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_t[e]=new Gt(e,5,!1,e.toLowerCase(),null,!1,!1)});var I0=/[\-:]([a-z])/g;function D0(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(I0,D0);_t[t]=new Gt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(I0,D0);_t[t]=new Gt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(I0,D0);_t[t]=new Gt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_t[e]=new Gt(e,1,!1,e.toLowerCase(),null,!1,!1)});_t.xlinkHref=new Gt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_t[e]=new Gt(e,1,!1,e.toLowerCase(),null,!0,!0)});function R0(e,t,r,n){var i=_t.hasOwnProperty(t)?_t[t]:null;(i!==null?i.type!==0:n||!(2s||i[o]!==a[s]){var l=`
+`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{um=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Rl(e):""}function A2(e){switch(e.tag){case 5:return Rl(e.type);case 16:return Rl("Lazy");case 13:return Rl("Suspense");case 19:return Rl("SuspenseList");case 0:case 2:case 15:return e=cm(e.type,!1),e;case 11:return e=cm(e.type.render,!1),e;case 1:return e=cm(e.type,!0),e;default:return""}}function Mv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Eo:return"Fragment";case Po:return"Portal";case Cv:return"Profiler";case L0:return"StrictMode";case Nv:return"Suspense";case $v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rj:return(e.displayName||"Context")+".Consumer";case tj:return(e._context.displayName||"Context")+".Provider";case F0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B0:return t=e.displayName||null,t!==null?t:Mv(e.type)||"Memo";case mi:t=e._payload,e=e._init;try{return Mv(e(t))}catch{}}return null}function j2(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Mv(t);case 8:return t===L0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Vi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ij(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _2(e){var t=ij(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gc(e){e._valueTracker||(e._valueTracker=_2(e))}function aj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=ij(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Jf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Iv(e,t){var r=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function dw(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Vi(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function oj(e,t){t=t.checked,t!=null&&R0(e,"checked",t,!1)}function Dv(e,t){oj(e,t);var r=Vi(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Rv(e,t.type,r):t.hasOwnProperty("defaultValue")&&Rv(e,t.type,Vi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hw(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Rv(e,t,r){(t!=="number"||Jf(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Ll=Array.isArray;function zo(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Yc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function lu(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Wl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},T2=["Webkit","ms","Moz","O"];Object.keys(Wl).forEach(function(e){T2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wl[t]=Wl[e]})});function cj(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Wl.hasOwnProperty(e)&&Wl[e]?(""+t).trim():t+"px"}function fj(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=cj(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var k2=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Bv(e,t){if(t){if(k2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function zv(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Uv=null;function z0(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wv=null,Uo=null,Wo=null;function vw(e){if(e=Sc(e)){if(typeof Wv!="function")throw Error(K(280));var t=e.stateNode;t&&(t=zh(t),Wv(e.stateNode,e.type,t))}}function dj(e){Uo?Wo?Wo.push(e):Wo=[e]:Uo=e}function hj(){if(Uo){var e=Uo,t=Wo;if(Wo=Uo=null,vw(e),t)for(e=0;e>>=0,e===0?32:31-(z2(e)/U2|0)|0}var Xc=64,Qc=4194304;function Fl(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function rd(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~i;s!==0?n=Fl(s):(a&=o,a!==0&&(n=Fl(a)))}else o=r&~i,o!==0?n=Fl(o):a!==0&&(n=Fl(a));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function xc(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qr(t),e[t]=r}function q2(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0