diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html index 1bc2b927d9..de67ea1428 100644 --- a/litellm/proxy/_experimental/out/404.html +++ b/litellm/proxy/_experimental/out/404.html @@ -1 +1 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/q-moUJ7JvOaUXj6xE1Rk0/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/CLoTmxFwcBe0ryZN5lcGE/_buildManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/q-moUJ7JvOaUXj6xE1Rk0/_buildManifest.js rename to litellm/proxy/_experimental/out/_next/static/CLoTmxFwcBe0ryZN5lcGE/_buildManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/q-moUJ7JvOaUXj6xE1Rk0/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/CLoTmxFwcBe0ryZN5lcGE/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/q-moUJ7JvOaUXj6xE1Rk0/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/CLoTmxFwcBe0ryZN5lcGE/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1108-43b967097e41bd10.js b/litellm/proxy/_experimental/out/_next/static/chunks/1108-43b967097e41bd10.js new file mode 100644 index 0000000000..614c574071 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1108-43b967097e41bd10.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1108],{40278:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var n=r(5853),o=r(7084),i=r(26898),a=r(13241),u=r(1153),c=r(2265),l=r(47625),s=r(93765),f=r(31699),p=r(97059),h=r(62994),d=r(25311),y=(0,s.z)({chartName:"BarChart",GraphicalChild:f.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:p.K},{axisType:"yAxis",AxisComp:h.B}],formatAxisMap:d.t9}),v=r(56940),m=r(26680),b=r(8147),g=r(22190),x=r(65278),w=r(98593),O=r(92666),j=r(32644);let S=c.forwardRef((t,e)=>{let{data:r=[],categories:s=[],index:d,colors:S=i.s,valueFormatter:P=u.Cj,layout:E="horizontal",stack:k=!1,relative:A=!1,startEndOnly:M=!1,animationDuration:_=900,showAnimation:T=!1,showXAxis:C=!0,showYAxis:N=!0,yAxisWidth:D=56,intervalType:I="equidistantPreserveStart",showTooltip:L=!0,showLegend:B=!0,showGridLines:R=!0,autoMinValue:z=!1,minValue:U,maxValue:F,allowDecimals:$=!0,noDataText:q,onValueChange:Z,enableLegendSlider:W=!1,customTooltip:Y,rotateLabelX:H,barCategoryGap:X,tickGap:G=5,xAxisLabel:V,yAxisLabel:K,className:Q,padding:J=C||N?{left:20,right:20}:{left:0,right:0}}=t,tt=(0,n._T)(t,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),[te,tr]=(0,c.useState)(60),tn=(0,j.me)(s,S),[to,ti]=c.useState(void 0),[ta,tu]=(0,c.useState)(void 0),tc=!!Z;function tl(t,e,r){var n,o,i,a;r.stopPropagation(),Z&&((0,j.vZ)(to,Object.assign(Object.assign({},t.payload),{value:t.value}))?(tu(void 0),ti(void 0),null==Z||Z(null)):(tu(null===(o=null===(n=t.tooltipPayload)||void 0===n?void 0:n[0])||void 0===o?void 0:o.dataKey),ti(Object.assign(Object.assign({},t.payload),{value:t.value})),null==Z||Z(Object.assign({eventType:"bar",categoryClicked:null===(a=null===(i=t.tooltipPayload)||void 0===i?void 0:i[0])||void 0===a?void 0:a.dataKey},t.payload))))}let ts=(0,j.i4)(z,U,F);return c.createElement("div",Object.assign({ref:e,className:(0,a.q)("w-full h-80",Q)},tt),c.createElement(l.h,{className:"h-full w-full"},(null==r?void 0:r.length)?c.createElement(y,{barCategoryGap:X,data:r,stackOffset:k?"sign":A?"expand":"none",layout:"vertical"===E?"vertical":"horizontal",onClick:tc&&(ta||to)?()=>{ti(void 0),tu(void 0),null==Z||Z(null)}:void 0,margin:{bottom:V?30:void 0,left:K?20:void 0,right:K?5:void 0,top:5}},R?c.createElement(v.q,{className:(0,a.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:"vertical"!==E,vertical:"vertical"===E}):null,"vertical"!==E?c.createElement(p.K,{padding:J,hide:!C,dataKey:d,interval:M?"preserveStartEnd":I,tick:{transform:"translate(0, 6)"},ticks:M?[r[0][d],r[r.length-1][d]]:void 0,fill:"",stroke:"",className:(0,a.q)("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight,minTickGap:G},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)):c.createElement(p.K,{hide:!C,type:"number",tick:{transform:"translate(-3, 0)"},domain:ts,fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:P,minTickGap:G,allowDecimals:$,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),"vertical"!==E?c.createElement(h.B,{width:D,hide:!N,axisLine:!1,tickLine:!1,type:"number",domain:ts,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:A?t=>"".concat((100*t).toString()," %"):P,allowDecimals:$},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)):c.createElement(h.B,{width:D,hide:!N,dataKey:d,axisLine:!1,tickLine:!1,ticks:M?[r[0][d],r[r.length-1][d]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),c.createElement(b.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:L?t=>{let{active:e,payload:r,label:n}=t;return Y?c.createElement(Y,{payload:null==r?void 0:r.map(t=>{var e;return Object.assign(Object.assign({},t),{color:null!==(e=tn.get(t.dataKey))&&void 0!==e?e:o.fr.Gray})}),active:e,label:n}):c.createElement(w.ZP,{active:e,payload:r,label:n,valueFormatter:P,categoryColors:tn})}:c.createElement(c.Fragment,null),position:{y:0}}),B?c.createElement(g.D,{verticalAlign:"top",height:te,content:t=>{let{payload:e}=t;return(0,x.Z)({payload:e},tn,tr,ta,tc?t=>{tc&&(t!==ta||to?(tu(t),null==Z||Z({eventType:"category",categoryClicked:t})):(tu(void 0),null==Z||Z(null)),ti(void 0))}:void 0,W)}}):null,s.map(t=>{var e;return c.createElement(f.$,{className:(0,a.q)((0,u.bM)(null!==(e=tn.get(t))&&void 0!==e?e:o.fr.Gray,i.K.background).fillColor,Z?"cursor-pointer":""),key:t,name:t,type:"linear",stackId:k||A?"a":void 0,dataKey:t,fill:"",isAnimationActive:T,animationDuration:_,shape:t=>((t,e,r,n)=>{let{fillOpacity:o,name:i,payload:a,value:u}=t,{x:l,width:s,y:f,height:p}=t;return"horizontal"===n&&p<0?(f+=p,p=Math.abs(p)):"vertical"===n&&s<0&&(l+=s,s=Math.abs(s)),c.createElement("rect",{x:l,y:f,width:s,height:p,opacity:e||r&&r!==i?(0,j.vZ)(e,Object.assign(Object.assign({},a),{value:u}))?o:.3:o})})(t,to,ta,E),onClick:tl})})):c.createElement(O.Z,{noDataText:q})))});S.displayName="BarChart"},65278:function(t,e,r){"use strict";r.d(e,{Z:function(){return y}});var n=r(2265);let o=t=>{n.useEffect(()=>{let e=()=>{t()};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t])};var i=r(5853),a=r(26898),u=r(13241),c=r(1153);let l=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},s=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},f=(0,c.fn)("Legend"),p=t=>{let{name:e,color:r,onClick:o,activeLegend:i}=t,l=!!o;return n.createElement("li",{className:(0,u.q)(f("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",l?"cursor-pointer":"cursor-default","text-tremor-content",l?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",l?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:t=>{t.stopPropagation(),null==o||o(e,r)}},n.createElement("svg",{className:(0,u.q)("flex-none h-2 w-2 mr-1.5",(0,c.bM)(r,a.K.text).textColor,i&&i!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},n.createElement("circle",{cx:4,cy:4,r:4})),n.createElement("p",{className:(0,u.q)("whitespace-nowrap truncate text-tremor-default","text-tremor-content",l?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",i&&i!==e?"opacity-40":"opacity-100",l?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},h=t=>{let{icon:e,onClick:r,disabled:o}=t,[i,a]=n.useState(!1),c=n.useRef(null);return n.useEffect(()=>(i?c.current=setInterval(()=>{null==r||r()},300):clearInterval(c.current),()=>clearInterval(c.current)),[i,r]),(0,n.useEffect)(()=>{o&&(clearInterval(c.current),a(!1))},[o]),n.createElement("button",{type:"button",className:(0,u.q)(f("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",o?"cursor-not-allowed":"cursor-pointer",o?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",o?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:o,onClick:t=>{t.stopPropagation(),null==r||r()},onMouseDown:t=>{t.stopPropagation(),a(!0)},onMouseUp:t=>{t.stopPropagation(),a(!1)}},n.createElement(e,{className:"w-full"}))},d=n.forwardRef((t,e)=>{let{categories:r,colors:o=a.s,className:c,onClickLegendItem:d,activeLegend:y,enableLegendSlider:v=!1}=t,m=(0,i._T)(t,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),b=n.useRef(null),g=n.useRef(null),[x,w]=n.useState(null),[O,j]=n.useState(null),S=n.useRef(null),P=(0,n.useCallback)(()=>{let t=null==b?void 0:b.current;t&&w({left:t.scrollLeft>0,right:t.scrollWidth-t.clientWidth>t.scrollLeft})},[w]),E=(0,n.useCallback)(t=>{var e,r;let n=null==b?void 0:b.current,o=null==g?void 0:g.current,i=null!==(e=null==n?void 0:n.clientWidth)&&void 0!==e?e:0,a=null!==(r=null==o?void 0:o.clientWidth)&&void 0!==r?r:0;n&&v&&(n.scrollTo({left:"left"===t?n.scrollLeft-i+a:n.scrollLeft+i-a,behavior:"smooth"}),setTimeout(()=>{P()},400))},[v,P]);n.useEffect(()=>{let t=t=>{"ArrowLeft"===t?E("left"):"ArrowRight"===t&&E("right")};return O?(t(O),S.current=setInterval(()=>{t(O)},300)):clearInterval(S.current),()=>clearInterval(S.current)},[O,E]);let k=t=>{t.stopPropagation(),"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),j(t.key))},A=t=>{t.stopPropagation(),j(null)};return n.useEffect(()=>{let t=null==b?void 0:b.current;return v&&(P(),null==t||t.addEventListener("keydown",k),null==t||t.addEventListener("keyup",A)),()=>{null==t||t.removeEventListener("keydown",k),null==t||t.removeEventListener("keyup",A)}},[P,v]),n.createElement("ol",Object.assign({ref:e,className:(0,u.q)(f("root"),"relative overflow-hidden",c)},m),n.createElement("div",{ref:b,tabIndex:0,className:(0,u.q)("h-full flex",v?(null==x?void 0:x.right)||(null==x?void 0:x.left)?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((t,e)=>n.createElement(p,{key:"item-".concat(e),name:t,color:o[e%o.length],onClick:d,activeLegend:y}))),v&&((null==x?void 0:x.right)||(null==x?void 0:x.left))?n.createElement(n.Fragment,null,n.createElement("div",{className:(0,u.q)("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:g},n.createElement(h,{icon:l,onClick:()=>{j(null),E("left")},disabled:!(null==x?void 0:x.left)}),n.createElement(h,{icon:s,onClick:()=>{j(null),E("right")},disabled:!(null==x?void 0:x.right)}))):null)});d.displayName="Legend";let y=(t,e,r,i,a,u)=>{let{payload:c}=t,l=(0,n.useRef)(null);o(()=>{var t,e;r((e=null===(t=l.current)||void 0===t?void 0:t.clientHeight)?Number(e)+20:60)});let s=c.filter(t=>"none"!==t.type);return n.createElement("div",{ref:l,className:"flex items-center justify-end"},n.createElement(d,{categories:s.map(t=>t.value),colors:s.map(t=>e.get(t.value)),onClickLegendItem:a,activeLegend:i,enableLegendSlider:u}))}},98593:function(t,e,r){"use strict";r.d(e,{$B:function(){return c},ZP:function(){return s},zX:function(){return l}});var n=r(2265),o=r(7084),i=r(26898),a=r(13241),u=r(1153);let c=t=>{let{children:e}=t;return n.createElement("div",{className:(0,a.q)("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e)},l=t=>{let{value:e,name:r,color:o}=t;return n.createElement("div",{className:"flex items-center justify-between space-x-8"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("span",{className:(0,a.q)("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",(0,u.bM)(o,i.K.background).bgColor)}),n.createElement("p",{className:(0,a.q)("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},r)),n.createElement("p",{className:(0,a.q)("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e))},s=t=>{let{active:e,payload:r,label:i,categoryColors:u,valueFormatter:s}=t;if(e&&r){let t=r.filter(t=>"none"!==t.type);return n.createElement(c,null,n.createElement("div",{className:(0,a.q)("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},n.createElement("p",{className:(0,a.q)("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},i)),n.createElement("div",{className:(0,a.q)("px-4 py-2 space-y-1")},t.map((t,e)=>{var r;let{value:i,name:a}=t;return n.createElement(l,{key:"id-".concat(e),value:s(i),name:a,color:null!==(r=u.get(a))&&void 0!==r?r:o.fr.Blue})})))}return null}},92666:function(t,e,r){"use strict";r.d(e,{Z:function(){return i}});var n=r(13241),o=r(2265);let i=t=>{let{className:e,noDataText:r="No data"}=t;return o.createElement("div",{className:(0,n.q)("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},o.createElement("p",{className:(0,n.q)("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},r))}},32644:function(t,e,r){"use strict";r.d(e,{FB:function(){return i},i4:function(){return o},me:function(){return n},vZ:function(){return function t(e,r){if(e===r)return!0;if("object"!=typeof e||"object"!=typeof r||null===e||null===r)return!1;let n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(let i of n)if(!o.includes(i)||!t(e[i],r[i]))return!1;return!0}}});let n=(t,e)=>{let r=new Map;return t.forEach((t,n)=>{r.set(t,e[n%e.length])}),r},o=(t,e,r)=>[t?"auto":null!=e?e:0,null!=r?r:"auto"];function i(t,e){let r=[];for(let n of t)if(Object.prototype.hasOwnProperty.call(n,e)&&(r.push(n[e]),r.length>1))return!1;return!0}},49804:function(t,e,r){"use strict";r.d(e,{Z:function(){return l}});var n=r(5853),o=r(13241),i=r(1153),a=r(2265),u=r(9496);let c=(0,i.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:s,children:f,className:p}=t,h=(0,n._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),d=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,o.q)(c("root"),(()=>{let t=d(r,u.PT),e=d(i,u.SP),n=d(l,u.VS),a=d(s,u._w);return(0,o.q)(t,e,n,a)})(),p)},h),f)});l.displayName="Col"},97765:function(t,e,r){"use strict";r.d(e,{Z:function(){return c}});var n=r(5853),o=r(26898),i=r(13241),a=r(1153),u=r(2265);let c=u.forwardRef((t,e)=>{let{color:r,children:c,className:l}=t,s=(0,n._T)(t,["color","children","className"]);return u.createElement("p",Object.assign({ref:e,className:(0,i.q)(r?(0,a.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",l)},s),c)});c.displayName="Subtitle"},61134:function(t,e,r){var n;!function(o){"use strict";var i,a={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},u=!0,c="[DecimalError] ",l=c+"Invalid argument: ",s=c+"Exponent out of range: ",f=Math.floor,p=Math.pow,h=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=f(1286742750677284.5),y={};function v(t,e){var r,n,o,i,a,c,l,s,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s||(e=new f(t)),u?E(e,p):e;if(l=t.d,s=e.d,a=t.e,o=e.e,l=l.slice(),i=a-o){for(i<0?(n=l,i=-i,c=s.length):(n=s,o=a,c=l.length),i>(c=(a=Math.ceil(p/7))>c?a+1:c+1)&&(i=c,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((c=l.length)-(i=s.length)<0&&(i=c,n=s,s=l,l=n),r=0;i;)r=(l[--i]=l[i]+s[i]+r)/1e7|0,l[i]%=1e7;for(r&&(l.unshift(r),++o),c=l.length;0==l[--c];)l.pop();return e.d=l,e.e=o,u?E(e,p):e}function m(t,e,r){if(t!==~~t||tr)throw Error(l+t)}function b(t){var e,r,n,o=t.length-1,i="",a=t[0];if(o>0){for(i+=a,e=1;et.e^this.s<0?1:-1;for(e=0,r=(n=this.d.length)<(o=t.d.length)?n:o;et.d[e]^this.s<0?1:-1;return n===o?0:n>o^this.s<0?1:-1},y.decimalPlaces=y.dp=function(){var t=this.d.length-1,e=(t-this.e)*7;if(t=this.d[t])for(;t%10==0;t/=10)e--;return e<0?0:e},y.dividedBy=y.div=function(t){return g(this,new this.constructor(t))},y.dividedToIntegerBy=y.idiv=function(t){var e=this.constructor;return E(g(this,new e(t),0,1),e.precision)},y.equals=y.eq=function(t){return!this.cmp(t)},y.exponent=function(){return w(this)},y.greaterThan=y.gt=function(t){return this.cmp(t)>0},y.greaterThanOrEqualTo=y.gte=function(t){return this.cmp(t)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return 0===this.s},y.lessThan=y.lt=function(t){return 0>this.cmp(t)},y.lessThanOrEqualTo=y.lte=function(t){return 1>this.cmp(t)},y.logarithm=y.log=function(t){var e,r=this.constructor,n=r.precision,o=n+5;if(void 0===t)t=new r(10);else if((t=new r(t)).s<1||t.eq(i))throw Error(c+"NaN");if(this.s<1)throw Error(c+(this.s?"NaN":"-Infinity"));return this.eq(i)?new r(0):(u=!1,e=g(S(this,o),S(t,o),o),u=!0,E(e,n))},y.minus=y.sub=function(t){return t=new this.constructor(t),this.s==t.s?k(this,t):v(this,(t.s=-t.s,t))},y.modulo=y.mod=function(t){var e,r=this.constructor,n=r.precision;if(!(t=new r(t)).s)throw Error(c+"NaN");return this.s?(u=!1,e=g(this,t,0,1).times(t),u=!0,this.minus(e)):E(new r(this),n)},y.naturalExponential=y.exp=function(){return x(this)},y.naturalLogarithm=y.ln=function(){return S(this)},y.negated=y.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},y.plus=y.add=function(t){return t=new this.constructor(t),this.s==t.s?v(this,t):k(this,(t.s=-t.s,t))},y.precision=y.sd=function(t){var e,r,n;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(l+t);if(e=w(this)+1,r=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)r--;for(n=this.d[0];n>=10;n/=10)r++}return t&&e>r?e:r},y.squareRoot=y.sqrt=function(){var t,e,r,n,o,i,a,l=this.constructor;if(this.s<1){if(!this.s)return new l(0);throw Error(c+"NaN")}for(t=w(this),u=!1,0==(o=Math.sqrt(+this))||o==1/0?(((e=b(this.d)).length+t)%2==0&&(e+="0"),o=Math.sqrt(e),t=f((t+1)/2)-(t<0||t%2),n=new l(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)):n=new l(o.toString()),o=a=(r=l.precision)+3;;)if(n=(i=n).plus(g(this,i,a+2)).times(.5),b(i.d).slice(0,a)===(e=b(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),o==a&&"4999"==e){if(E(i,r+1,0),i.times(i).eq(this)){n=i;break}}else if("9999"!=e)break;a+=4}return u=!0,E(n,r)},y.times=y.mul=function(t){var e,r,n,o,i,a,c,l,s,f=this.constructor,p=this.d,h=(t=new f(t)).d;if(!this.s||!t.s)return new f(0);for(t.s*=this.s,r=this.e+t.e,(l=p.length)<(s=h.length)&&(i=p,p=h,h=i,a=l,l=s,s=a),i=[],n=a=l+s;n--;)i.push(0);for(n=s;--n>=0;){for(e=0,o=l+n;o>n;)c=i[o]+h[n]*p[o-n-1]+e,i[o--]=c%1e7|0,e=c/1e7|0;i[o]=(i[o]+e)%1e7|0}for(;!i[--a];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,u?E(t,f.precision):t},y.toDecimalPlaces=y.todp=function(t,e){var r=this,n=r.constructor;return(r=new n(r),void 0===t)?r:(m(t,0,1e9),void 0===e?e=n.rounding:m(e,0,8),E(r,t+w(r)+1,e))},y.toExponential=function(t,e){var r,n=this,o=n.constructor;return void 0===t?r=A(n,!0):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A(n=E(new o(n),t+1,e),!0,t+1)),r},y.toFixed=function(t,e){var r,n,o=this.constructor;return void 0===t?A(this):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A((n=E(new o(this),t+w(this)+1,e)).abs(),!1,t+w(n)+1),this.isneg()&&!this.isZero()?"-"+r:r)},y.toInteger=y.toint=function(){var t=this.constructor;return E(new t(this),w(this)+1,t.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(t){var e,r,n,o,a,l,s=this,p=s.constructor,h=+(t=new p(t));if(!t.s)return new p(i);if(!(s=new p(s)).s){if(t.s<1)throw Error(c+"Infinity");return s}if(s.eq(i))return s;if(n=p.precision,t.eq(i))return E(s,n);if(l=(e=t.e)>=(r=t.d.length-1),a=s.s,l){if((r=h<0?-h:h)<=9007199254740991){for(o=new p(i),e=Math.ceil(n/7+4),u=!1;r%2&&M((o=o.times(s)).d,e),0!==(r=f(r/2));)M((s=s.times(s)).d,e);return u=!0,t.s<0?new p(i).div(o):E(o,n)}}else if(a<0)throw Error(c+"NaN");return a=a<0&&1&t.d[Math.max(e,r)]?-1:1,s.s=1,u=!1,o=t.times(S(s,n+12)),u=!0,(o=x(o)).s=a,o},y.toPrecision=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?(r=w(o),n=A(o,r<=i.toExpNeg||r>=i.toExpPos)):(m(t,1,1e9),void 0===e?e=i.rounding:m(e,0,8),r=w(o=E(new i(o),t,e)),n=A(o,t<=r||r<=i.toExpNeg,t)),n},y.toSignificantDigits=y.tosd=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(m(t,1,1e9),void 0===e?e=r.rounding:m(e,0,8)),E(new r(this),t,e)},y.toString=y.valueOf=y.val=y.toJSON=function(){var t=w(this),e=this.constructor;return A(this,t<=e.toExpNeg||t>=e.toExpPos)};var g=function(){function t(t,e){var r,n=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+n,t[o]=r%1e7|0,n=r/1e7|0;return n&&t.unshift(n),t}function e(t,e,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function r(t,e,r){for(var n=0;r--;)t[r]-=n,n=t[r]1;)t.shift()}return function(n,o,i,a){var u,l,s,f,p,h,d,y,v,m,b,g,x,O,j,S,P,k,A=n.constructor,M=n.s==o.s?1:-1,_=n.d,T=o.d;if(!n.s)return new A(n);if(!o.s)throw Error(c+"Division by zero");for(s=0,l=n.e-o.e,P=T.length,j=_.length,y=(d=new A(M)).d=[];T[s]==(_[s]||0);)++s;if(T[s]>(_[s]||0)&&--l,(g=null==i?i=A.precision:a?i+(w(n)-w(o))+1:i)<0)return new A(0);if(g=g/7+2|0,s=0,1==P)for(f=0,T=T[0],g++;(s1&&(T=t(T,f),_=t(_,f),P=T.length,j=_.length),O=P,m=(v=_.slice(0,P)).length;m=1e7/2&&++S;do f=0,(u=e(T,v,P,m))<0?(b=v[0],P!=m&&(b=1e7*b+(v[1]||0)),(f=b/S|0)>1?(f>=1e7&&(f=1e7-1),h=(p=t(T,f)).length,m=v.length,1==(u=e(p,v,h,m))&&(f--,r(p,P16)throw Error(s+w(t));if(!t.s)return new h(i);for(null==e?(u=!1,c=d):c=e,a=new h(.03125);t.abs().gte(.1);)t=t.times(a),f+=5;for(c+=Math.log(p(2,f))/Math.LN10*2+5|0,r=n=o=new h(i),h.precision=c;;){if(n=E(n.times(t),c),r=r.times(++l),b((a=o.plus(g(n,r,c))).d).slice(0,c)===b(o.d).slice(0,c)){for(;f--;)o=E(o.times(o),c);return h.precision=d,null==e?(u=!0,E(o,d)):o}o=a}}function w(t){for(var e=7*t.e,r=t.d[0];r>=10;r/=10)e++;return e}function O(t,e,r){if(e>t.LN10.sd())throw u=!0,r&&(t.precision=r),Error(c+"LN10 precision limit exceeded");return E(new t(t.LN10),e)}function j(t){for(var e="";t--;)e+="0";return e}function S(t,e){var r,n,o,a,l,s,f,p,h,d=1,y=t,v=y.d,m=y.constructor,x=m.precision;if(y.s<1)throw Error(c+(y.s?"NaN":"-Infinity"));if(y.eq(i))return new m(0);if(null==e?(u=!1,p=x):p=e,y.eq(10))return null==e&&(u=!0),O(m,p);if(p+=10,m.precision=p,n=(r=b(v)).charAt(0),!(15e14>Math.abs(a=w(y))))return f=O(m,p+2,x).times(a+""),y=S(new m(n+"."+r.slice(1)),p-10).plus(f),m.precision=x,null==e?(u=!0,E(y,x)):y;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=b((y=y.times(t)).d)).charAt(0),d++;for(a=w(y),n>1?(y=new m("0."+r),a++):y=new m(n+"."+r.slice(1)),s=l=y=g(y.minus(i),y.plus(i),p),h=E(y.times(y),p),o=3;;){if(l=E(l.times(h),p),b((f=s.plus(g(l,new m(o),p))).d).slice(0,p)===b(s.d).slice(0,p))return s=s.times(2),0!==a&&(s=s.plus(O(m,p+2,x).times(a+""))),s=g(s,new m(d),p),m.precision=x,null==e?(u=!0,E(s,x)):s;s=f,o+=2}}function P(t,e){var r,n,o;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);)++n;for(o=e.length;48===e.charCodeAt(o-1);)--o;if(e=e.slice(n,o)){if(o-=n,r=r-n-1,t.e=f(r/7),t.d=[],n=(r+1)%7,r<0&&(n+=7),nd||t.e<-d))throw Error(s+r)}else t.s=0,t.e=0,t.d=[0];return t}function E(t,e,r){var n,o,i,a,c,l,h,y,v=t.d;for(a=1,i=v[0];i>=10;i/=10)a++;if((n=e-a)<0)n+=7,o=e,h=v[y=0];else{if((y=Math.ceil((n+1)/7))>=(i=v.length))return t;for(a=1,h=i=v[y];i>=10;i/=10)a++;n%=7,o=n-7+a}if(void 0!==r&&(c=h/(i=p(10,a-o-1))%10|0,l=e<0||void 0!==v[y+1]||h%i,l=r<4?(c||l)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||l||6==r&&(n>0?o>0?h/p(10,a-o):0:v[y-1])%10&1||r==(t.s<0?8:7))),e<1||!v[0])return l?(i=w(t),v.length=1,e=e-i-1,v[0]=p(10,(7-e%7)%7),t.e=f(-e/7)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(0==n?(v.length=y,i=1,y--):(v.length=y+1,i=p(10,7-n),v[y]=o>0?(h/p(10,a-o)%p(10,o)|0)*i:0),l)for(;;){if(0==y){1e7==(v[0]+=i)&&(v[0]=1,++t.e);break}if(v[y]+=i,1e7!=v[y])break;v[y--]=0,i=1}for(n=v.length;0===v[--n];)v.pop();if(u&&(t.e>d||t.e<-d))throw Error(s+w(t));return t}function k(t,e){var r,n,o,i,a,c,l,s,f,p,h=t.constructor,d=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),u?E(e,d):e;if(l=t.d,p=e.d,n=e.e,s=t.e,l=l.slice(),a=s-n){for((f=a<0)?(r=l,a=-a,c=p.length):(r=p,n=s,c=l.length),a>(o=Math.max(Math.ceil(d/7),c)+2)&&(a=o,r.length=1),r.reverse(),o=a;o--;)r.push(0);r.reverse()}else{for((f=(o=l.length)<(c=p.length))&&(c=o),o=0;o0;--o)l[c++]=0;for(o=p.length;o>a;){if(l[--o]0?i=i.charAt(0)+"."+i.slice(1)+j(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o<0?"e":"e+")+o):o<0?(i="0."+j(-o-1)+i,r&&(n=r-a)>0&&(i+=j(n))):o>=a?(i+=j(o+1-a),r&&(n=r-o-1)>0&&(i=i+"."+j(n))):((n=o+1)0&&(o+1===a&&(i+="."),i+=j(n))),t.s<0?"-"+i:i}function M(t,e){if(t.length>e)return t.length=e,!0}function _(t){if(!t||"object"!=typeof t)throw Error(c+"Object expected");var e,r,n,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e=o[e+1]&&n<=o[e+2])this[r]=n;else throw Error(l+r+": "+n)}if(void 0!==(n=t[r="LN10"])){if(n==Math.LN10)this[r]=new this(n);else throw Error(l+r+": "+n)}return this}(a=function t(e){var r,n,o;function i(t){if(!(this instanceof i))return new i(t);if(this.constructor=i,t instanceof i){this.s=t.s,this.e=t.e,this.d=(t=t.d)?t.slice():t;return}if("number"==typeof t){if(0*t!=0)throw Error(l+t);if(t>0)this.s=1;else if(t<0)t=-t,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(t===~~t&&t<1e7){this.e=0,this.d=[t];return}return P(this,t.toString())}if("string"!=typeof t)throw Error(l+t);if(45===t.charCodeAt(0)?(t=t.slice(1),this.s=-1):this.s=1,h.test(t))P(this,t);else throw Error(l+t)}if(i.prototype=y,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=t,i.config=i.set=_,void 0===e&&(e={}),e)for(r=0,o=["precision","rounding","toExpNeg","toExpPos","LN10"];r-1}},56883:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n0&&i(s)?r>1?t(s,r-1,i,a,u):n(u,s):a||(u[u.length]=s)}return u}},63321:function(t,e,r){var n=r(33023)();t.exports=n},98060:function(t,e,r){var n=r(63321),o=r(43228);t.exports=function(t,e){return t&&n(t,e,o)}},92167:function(t,e,r){var n=r(67906),o=r(70235);t.exports=function(t,e){e=n(e,t);for(var r=0,i=e.length;null!=t&&re}},93012:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},47909:function(t,e,r){var n=r(8235),o=r(31953),i=r(35281);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},90370:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},56318:function(t,e,r){var n=r(6791),o=r(10303);t.exports=function t(e,r,i,a,u){return e===r||(null!=e&&null!=r&&(o(e)||o(r))?n(e,r,i,a,t,u):e!=e&&r!=r)}},6791:function(t,e,r){var n=r(85885),o=r(97638),i=r(88030),a=r(64974),u=r(81690),c=r(25614),l=r(98051),s=r(9792),f="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,y,v,m){var b=c(t),g=c(e),x=b?p:u(t),w=g?p:u(e);x=x==f?h:x,w=w==f?h:w;var O=x==h,j=w==h,S=x==w;if(S&&l(t)){if(!l(e))return!1;b=!0,O=!1}if(S&&!O)return m||(m=new n),b||s(t)?o(t,e,r,y,v,m):i(t,e,x,r,y,v,m);if(!(1&r)){var P=O&&d.call(t,"__wrapped__"),E=j&&d.call(e,"__wrapped__");if(P||E){var k=P?t.value():t,A=E?e.value():e;return m||(m=new n),v(k,A,r,y,m)}}return!!S&&(m||(m=new n),a(t,e,r,y,v,m))}},62538:function(t,e,r){var n=r(85885),o=r(56318);t.exports=function(t,e,r,i){var a=r.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=r[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++ao?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n=200){var y=e?null:u(t);if(y)return c(y);p=!1,s=a,d=new n}else d=e?[]:h;t:for(;++l=o?t:n(t,e,r)}},1536:function(t,e,r){var n=r(78371);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,a=n(t),u=void 0!==e,c=null===e,l=e==e,s=n(e);if(!c&&!s&&!a&&t>e||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&t=c)return l;return l*("desc"==r[o]?-1:1)}}return t.index-e.index}},92077:function(t,e,r){var n=r(74288)["__core-js_shared__"];t.exports=n},97930:function(t,e,r){var n=r(5629);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,a=e?i:-1,u=Object(r);(e?a--:++a-1?u[c?e[l]:l]:void 0}}},35464:function(t,e,r){var n=r(19608),o=r(49639),i=r(175);t.exports=function(t){return function(e,r,a){return a&&"number"!=typeof a&&o(e,r,a)&&(r=a=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),a=void 0===a?es))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++d-1&&t%1==0&&t-1}},13368:function(t,e,r){var n=r(24457);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},38764:function(t,e,r){var n=r(9855),o=r(99078),i=r(88675);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},78615:function(t,e,r){var n=r(1507);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},83391:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).get(t)}},53483:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).has(t)}},74724:function(t,e,r){var n=r(1507);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},22523:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}},47073:function(t){t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},23787:function(t,e,r){var n=r(50967);t.exports=function(t){var e=n(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}},20453:function(t,e,r){var n=r(39866)(Object,"create");t.exports=n},77184:function(t,e,r){var n=r(45070)(Object.keys,Object);t.exports=n},39931:function(t,e,r){t=r.nmd(t);var n=r(17071),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,u=function(){try{var t=i&&i.require&&i.require("util").types;if(t)return t;return a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u},45070:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},49478:function(t,e,r){var n=r(68680),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,u=o(i.length-e,0),c=Array(u);++a0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},84092:function(t,e,r){var n=r(99078);t.exports=function(){this.__data__=new n,this.size=0}},31663:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},69135:function(t){t.exports=function(t){return this.__data__.get(t)}},39552:function(t){t.exports=function(t){return this.__data__.has(t)}},63960:function(t,e,r){var n=r(99078),o=r(88675),i=r(76219);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},35281:function(t){t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n-1&&t%1==0&&t<=9007199254740991}},82559:function(t,e,r){var n=r(22345);t.exports=function(t){return n(t)&&t!=+t}},77571:function(t){t.exports=function(t){return null==t}},22345:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==n(t)}},90231:function(t,e,r){var n=r(54506),o=r(62602),i=r(10303),a=Object.prototype,u=Function.prototype.toString,c=a.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},42715:function(t,e,r){var n=r(54506),o=r(25614),i=r(10303);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},9792:function(t,e,r){var n=r(59332),o=r(23305),i=r(39931),a=i&&i.isTypedArray,u=a?o(a):n;t.exports=u},43228:function(t,e,r){var n=r(28579),o=r(4578),i=r(5629);t.exports=function(t){return i(t)?n(t):o(t)}},86185:function(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},89238:function(t,e,r){var n=r(73819),o=r(88157),i=r(24240),a=r(25614);t.exports=function(t,e){return(a(t)?n:i)(t,o(e,3))}},41443:function(t,e,r){var n=r(83023),o=r(98060),i=r(88157);t.exports=function(t,e){var r={};return e=i(e,3),o(t,function(t,o,i){n(r,o,e(t,o,i))}),r}},95645:function(t,e,r){var n=r(67646),o=r(58905),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},50967:function(t,e,r){var n=r(76219);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},99008:function(t,e,r){var n=r(67646),o=r(20121),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},93810:function(t){t.exports=function(){}},22350:function(t,e,r){var n=r(18155),o=r(73584),i=r(67352),a=r(70235);t.exports=function(t){return i(t)?n(a(t)):o(t)}},99676:function(t,e,r){var n=r(35464)();t.exports=n},33645:function(t,e,r){var n=r(25253),o=r(88157),i=r(12327),a=r(25614),u=r(49639);t.exports=function(t,e,r){var c=a(t)?n:i;return r&&u(t,e,r)&&(e=void 0),c(t,o(e,3))}},34935:function(t,e,r){var n=r(72569),o=r(84046),i=r(44843),a=r(49639),u=i(function(t,e){if(null==t)return[];var r=e.length;return r>1&&a(t,e[0],e[1])?e=[]:r>2&&a(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])});t.exports=u},55716:function(t){t.exports=function(){return[]}},7406:function(t){t.exports=function(){return!1}},37065:function(t,e,r){var n=r(7310),o=r(28302);t.exports=function(t,e,r){var i=!0,a=!0;if("function"!=typeof t)throw TypeError("Expected a function");return o(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),n(t,e,{leading:i,maxWait:e,trailing:a})}},175:function(t,e,r){var n=r(6660),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-o?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0}},85759:function(t,e,r){var n=r(175);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},3641:function(t,e,r){var n=r(65020);t.exports=function(t){return null==t?"":n(t)}},47230:function(t,e,r){var n=r(88157),o=r(13826);t.exports=function(t,e){return t&&t.length?o(t,n(e,2)):[]}},75551:function(t,e,r){var n=r(80675)("toUpperCase");t.exports=n},48049:function(t,e,r){"use strict";var n=r(14397);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,r,o,i,a){if(a!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},40718:function(t,e,r){t.exports=r(48049)()},14397:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},84735:function(t,e,r){"use strict";r.d(e,{ZP:function(){return tS}});var n=r(2265),o=r(40718),i=r.n(o),a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty;function l(t,e){return function(r,n,o){return t(r,n,o)&&e(r,n,o)}}function s(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);var o=n.cache,i=o.get(e),a=o.get(r);if(i&&a)return i===r&&a===e;o.set(e,r),o.set(r,e);var u=t(e,r,n);return o.delete(e),o.delete(r),u}}function f(t){return a(t).concat(u(t))}var p=Object.hasOwn||function(t,e){return c.call(t,e)};function h(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var d=Object.getOwnPropertyDescriptor,y=Object.keys;function v(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return h(t.getTime(),e.getTime())}function b(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function g(t,e){return t===e}function x(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.entries(),c=0;(n=u.next())&&!n.done;){for(var l=e.entries(),s=!1,f=0;(o=l.next())&&!o.done;){if(a[f]){f++;continue}var p=n.value,h=o.value;if(r.equals(p[0],h[0],c,f,t,e,r)&&r.equals(p[1],h[1],p[0],h[0],t,e,r)){s=a[f]=!0;break}f++}if(!s)return!1;c++}return!0}function w(t,e,r){var n=y(t),o=n.length;if(y(e).length!==o)return!1;for(;o-- >0;)if(!A(t,e,r,n[o]))return!1;return!0}function O(t,e,r){var n,o,i,a=f(t),u=a.length;if(f(e).length!==u)return!1;for(;u-- >0;)if(!A(t,e,r,n=a[u])||(o=d(t,n),i=d(e,n),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable)))return!1;return!0}function j(t,e){return h(t.valueOf(),e.valueOf())}function S(t,e){return t.source===e.source&&t.flags===e.flags}function P(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.values();(n=u.next())&&!n.done;){for(var c=e.values(),l=!1,s=0;(o=c.next())&&!o.done;){if(!a[s]&&r.equals(n.value,o.value,n.value,o.value,t,e,r)){l=a[s]=!0;break}s++}if(!l)return!1}return!0}function E(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function k(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function A(t,e,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!t.$$typeof||!!e.$$typeof)||p(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var M=Array.isArray,_="undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView:null,T=Object.assign,C=Object.prototype.toString.call.bind(Object.prototype.toString),N=D();function D(t){void 0===t&&(t={});var e,r,n,o,i,a,u,c,f,p,d,y,A,N,D=t.circular,I=t.createInternalComparator,L=t.createState,B=t.strict,R=(r=(e=function(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?O:v,areDatesEqual:m,areErrorsEqual:b,areFunctionsEqual:g,areMapsEqual:n?l(x,O):x,areNumbersEqual:h,areObjectsEqual:n?O:w,arePrimitiveWrappersEqual:j,areRegExpsEqual:S,areSetsEqual:n?l(P,O):P,areTypedArraysEqual:n?O:E,areUrlsEqual:k,unknownTagComparators:void 0};if(r&&(o=T({},o,r(o))),e){var i=s(o.areArraysEqual),a=s(o.areMapsEqual),u=s(o.areObjectsEqual),c=s(o.areSetsEqual);o=T({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return o}(t)).areArraysEqual,n=e.areDatesEqual,o=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,u=e.areNumbersEqual,c=e.areObjectsEqual,f=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,d=e.areSetsEqual,y=e.areTypedArraysEqual,A=e.areUrlsEqual,N=e.unknownTagComparators,function(t,e,l){if(t===e)return!0;if(null==t||null==e)return!1;var s=typeof t;if(s!==typeof e)return!1;if("object"!==s)return"number"===s?u(t,e,l):"function"===s&&i(t,e,l);var h=t.constructor;if(h!==e.constructor)return!1;if(h===Object)return c(t,e,l);if(M(t))return r(t,e,l);if(null!=_&&_(t))return y(t,e,l);if(h===Date)return n(t,e,l);if(h===RegExp)return p(t,e,l);if(h===Map)return a(t,e,l);if(h===Set)return d(t,e,l);var v=C(t);if("[object Date]"===v)return n(t,e,l);if("[object RegExp]"===v)return p(t,e,l);if("[object Map]"===v)return a(t,e,l);if("[object Set]"===v)return d(t,e,l);if("[object Object]"===v)return"function"!=typeof t.then&&"function"!=typeof e.then&&c(t,e,l);if("[object URL]"===v)return A(t,e,l);if("[object Error]"===v)return o(t,e,l);if("[object Arguments]"===v)return c(t,e,l);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return f(t,e,l);if(N){var m=N[v];if(!m){var b=null!=t?t[Symbol.toStringTag]:void 0;b&&(m=N[b])}if(m)return m(t,e,l)}return!1}),z=I?I(R):function(t,e,r,n,o,i,a){return R(t,e,a)};return function(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,i=t.strict;if(n)return function(t,a){var u=n(),c=u.cache;return r(t,a,{cache:void 0===c?e?new WeakMap:void 0:c,equals:o,meta:u.meta,strict:i})};if(e)return function(t,e){return r(t,e,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(t,e){return r(t,e,a)}}({circular:void 0!==D&&D,comparator:R,createState:L,equals:z,strict:void 0!==B&&B})}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1;requestAnimationFrame(function n(o){if(r<0&&(r=o),o-r>e)t(o),r=-1;else{var i;i=n,"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(i)}})}function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0&&t<=1}),"[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s",n);var p=V(i,u),h=V(a,c),d=(t=i,e=u,function(r){var n;return G([].concat(function(t){if(Array.isArray(t))return H(t)}(n=X(t,e).map(function(t,e){return t*e}).slice(1))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Y(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[0]),r)}),y=function(t){for(var e=t>1?1:t,r=e,n=0;n<8;++n){var o,i=p(r)-e,a=d(r);if(1e-4>Math.abs(i-e)||a<1e-4)break;r=(o=r-i/a)>1?1:o<0?0:o}return h(r)};return y.isStepper=!1,y},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.stiff,r=void 0===e?100:e,n=t.damping,o=void 0===n?8:n,i=t.dt,a=void 0===i?17:i,u=function(t,e,n){var i=n+(-(t-e)*r-n*o)*a/1e3,u=n*a/1e3+t;return 1e-4>Math.abs(u-e)&&1e-4>Math.abs(i)?[e,0]:[u,i]};return u.isStepper=!0,u.dt=a,u},J=function(){for(var t=arguments.length,e=Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r0?r[o-1]:n,p=l||Object.keys(c);if("function"==typeof u||"spring"===u)return[].concat(th(t),[e.runJSAnimation.bind(e,{from:f.style,to:c,duration:i,easing:u}),i]);var h=Z(p,i,u),d=tv(tv(tv({},f.style),c),{},{transition:h});return[].concat(th(t),[d,i,s]).filter($)},[a,Math.max(void 0===u?0:u,n)])),[t.onAnimationEnd]))}},{key:"runAnimation",value:function(t){if(!this.manager){var e,r,n;this.manager=(e=function(){return null},r=!1,n=function t(n){if(!r){if(Array.isArray(n)){if(!n.length)return;var o=function(t){if(Array.isArray(t))return t}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return B(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,void 0)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],a=o.slice(1);if("number"==typeof i){I(t.bind(null,a),i);return}t(i),I(t.bind(null,a));return}"object"===L(n)&&e(n),"function"==typeof n&&n()}},{stop:function(){r=!0},start:function(t){r=!1,n(t)},subscribe:function(t){return e=t,function(){e=function(){return null}}}})}var o=t.begin,i=t.duration,a=t.attributeName,u=t.to,c=t.easing,l=t.onAnimationStart,s=t.onAnimationEnd,f=t.steps,p=t.children,h=this.manager;if(this.unSubscribe=h.subscribe(this.handleStyleChange),"function"==typeof c||"function"==typeof p||"spring"===c){this.runJSAnimation(t);return}if(f.length>1){this.runStepAnimation(t);return}var d=a?tm({},a,u):u,y=Z(Object.keys(d),i,c);h.start([l,o,tv(tv({},d),{},{transition:y}),i,s])}},{key:"render",value:function(){var t=this.props,e=t.children,r=(t.begin,t.duration),o=(t.attributeName,t.easing,t.isActive),i=(t.steps,t.from,t.to,t.canBegin,t.onAnimationEnd,t.shouldReAnimate,t.onAnimationReStart,function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,tp)),a=n.Children.count(e),u=this.state.style;if("function"==typeof e)return e(u);if(!o||0===a||r<=0)return e;var c=function(t){var e=t.props,r=e.style,o=e.className;return(0,n.cloneElement)(t,tv(tv({},i),{},{style:tv(tv({},void 0===r?{}:r),u),className:o}))};return 1===a?c(n.Children.only(e)):n.createElement("div",null,n.Children.map(e,function(t){return c(t)}))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,w),i=parseInt("".concat(r),10),a=parseInt("".concat(n),10),u=parseInt("".concat(e.height||o.height),10),c=parseInt("".concat(e.width||o.width),10);return P(P(P(P(P({},e),o),i?{x:i}:{}),a?{y:a}:{}),{},{height:u,width:c,name:e.name,radius:e.radius})}function k(t){return n.createElement(x.bn,j({shapeType:"rectangle",propTransformer:E,activeClassName:"recharts-active-bar"},t))}var A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(r,n){if("number"==typeof t)return t;var o=(0,d.hj)(r)||(0,d.Rw)(r);return o?t(r,n):(o||(0,g.Z)(!1),e)}},M=["value","background"];function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){return(T=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,M);if(!u)return null;var l=N(N(N(N(N({},c),{},{fill:"#eee"},u),a),(0,b.bw)(t.props,e,r)),{},{onAnimationStart:t.handleAnimationStart,onAnimationEnd:t.handleAnimationEnd,dataKey:o,index:r,className:"recharts-bar-background-rectangle"});return n.createElement(k,T({key:"background-bar-".concat(r),option:t.props.background,isActive:r===i},l))})}},{key:"renderErrorBar",value:function(t,e){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.data,i=r.xAxis,a=r.yAxis,u=r.layout,c=r.children,l=(0,y.NN)(c,f.W);if(!l)return null;var p="vertical"===u?o[0].height/2:o[0].width/2,h=function(t,e){var r=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:r,errorVal:(0,m.F$)(t,e)}};return n.createElement(s.m,{clipPath:t?"url(#clipPath-".concat(e,")"):null},l.map(function(t){return n.cloneElement(t,{key:"error-bar-".concat(e,"-").concat(t.props.dataKey),data:o,xAxis:i,yAxis:a,layout:u,offset:p,dataPointFormatter:h})}))}},{key:"render",value:function(){var t=this.props,e=t.hide,r=t.data,i=t.className,a=t.xAxis,u=t.yAxis,c=t.left,f=t.top,p=t.width,d=t.height,y=t.isAnimationActive,v=t.background,m=t.id;if(e||!r||!r.length)return null;var b=this.state.isAnimationFinished,g=(0,o.Z)("recharts-bar",i),x=a&&a.allowDataOverflow,w=u&&u.allowDataOverflow,O=x||w,j=l()(m)?this.id:m;return n.createElement(s.m,{className:g},x||w?n.createElement("defs",null,n.createElement("clipPath",{id:"clipPath-".concat(j)},n.createElement("rect",{x:x?c:c-p/2,y:w?f:f-d/2,width:x?p:2*p,height:w?d:2*d}))):null,n.createElement(s.m,{className:"recharts-bar-rectangles",clipPath:O?"url(#clipPath-".concat(j,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(O,j),(!y||b)&&h.e.renderCallByParent(this.props,r))}}],r=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curData:t.data,prevData:e.curData}:t.data!==e.curData?{curData:t.data}:null}}],e&&D(a.prototype,e),r&&D(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}(n.PureComponent);R(U,"displayName","Bar"),R(U,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!v.x.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"}),R(U,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,o=t.bandSize,i=t.xAxis,a=t.yAxis,u=t.xAxisTicks,c=t.yAxisTicks,l=t.stackedData,s=t.dataStartIndex,f=t.displayedData,h=t.offset,v=(0,m.Bu)(n,r);if(!v)return null;var b=e.layout,g=r.type.defaultProps,x=void 0!==g?N(N({},g),r.props):r.props,w=x.dataKey,O=x.children,j=x.minPointSize,S="horizontal"===b?a:i,P=l?S.scale.domain():null,E=(0,m.Yj)({numericAxis:S}),k=(0,y.NN)(O,p.b),M=f.map(function(t,e){l?f=(0,m.Vv)(l[s+e],P):Array.isArray(f=(0,m.F$)(t,w))||(f=[E,f]);var n=A(j,U.defaultProps.minPointSize)(f[1],e);if("horizontal"===b){var f,p,h,y,g,x,O,S=[a.scale(f[0]),a.scale(f[1])],M=S[0],_=S[1];p=(0,m.Fy)({axis:i,ticks:u,bandSize:o,offset:v.offset,entry:t,index:e}),h=null!==(O=null!=_?_:M)&&void 0!==O?O:void 0,y=v.size;var T=M-_;if(g=Number.isNaN(T)?0:T,x={x:p,y:a.y,width:y,height:a.height},Math.abs(n)>0&&Math.abs(g)0&&Math.abs(y)=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function P(t,e){for(var r=0;r0?this.props:d)),o<=0||a<=0||!y||!y.length)?null:n.createElement(s.m,{className:(0,c.Z)("recharts-cartesian-axis",l),ref:function(e){t.layerReference=e}},r&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),p._.renderCallByParent(this.props))}}],r=[{key:"renderTickItem",value:function(t,e,r){var o=(0,c.Z)(e.className,"recharts-cartesian-axis-tick-value");return n.isValidElement(t)?n.cloneElement(t,j(j({},e),{},{className:o})):i()(t)?t(j(j({},e),{},{className:o})):n.createElement(f.x,w({},e,{className:"recharts-cartesian-axis-tick-value"}),r)}}],e&&P(o.prototype,e),r&&P(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.Component);M(T,"displayName","CartesianAxis"),M(T,"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"})},56940:function(t,e,r){"use strict";r.d(e,{q:function(){return M}});var n=r(2265),o=r(86757),i=r.n(o),a=r(1175),u=r(16630),c=r(82944),l=r(85355),s=r(78242),f=r(80285),p=r(25739),h=["x1","y1","x2","y2","key"],d=["offset"];function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var x=function(t){var e=t.fill;if(!e||"none"===e)return null;var r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.ry;return n.createElement("rect",{x:o,y:i,ry:c,width:a,height:u,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function w(t,e){var r;if(n.isValidElement(t))r=n.cloneElement(t,e);else if(i()(t))r=t(e);else{var o=e.x1,a=e.y1,u=e.x2,l=e.y2,s=e.key,f=g(e,h),p=(0,c.L6)(f,!1),y=(p.offset,g(p,d));r=n.createElement("line",b({},y,{x1:o,y1:a,x2:u,y2:l,fill:"none",key:s}))}return r}function O(t){var e=t.x,r=t.width,o=t.horizontal,i=void 0===o||o,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:e,y1:n,x2:e+r,y2:n,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function j(t){var e=t.y,r=t.height,o=t.vertical,i=void 0===o||o,a=t.verticalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:n,y1:e,x2:n,y2:e+r,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function S(t){var e=t.horizontalFill,r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.horizontalPoints,l=t.horizontal;if(!(void 0===l||l)||!e||!e.length)return null;var s=c.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,c){var l=s[c+1]?s[c+1]-t:i+u-t;if(l<=0)return null;var f=c%e.length;return n.createElement("rect",{key:"react-".concat(c),y:t,x:o,height:l,width:a,stroke:"none",fill:e[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function P(t){var e=t.vertical,r=t.verticalFill,o=t.fillOpacity,i=t.x,a=t.y,u=t.width,c=t.height,l=t.verticalPoints;if(!(void 0===e||e)||!r||!r.length)return null;var s=l.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,e){var l=s[e+1]?s[e+1]-t:i+u-t;if(l<=0)return null;var f=e%r.length;return n.createElement("rect",{key:"react-".concat(e),x:t,y:a,width:l,height:c,stroke:"none",fill:r[f],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var E=function(t,e){var r=t.xAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.left,i.left+i.width,e)},k=function(t,e){var r=t.yAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.top,i.top+i.height,e)},A={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function M(t){var e,r,o,c,l,s,f=(0,p.zn)(),h=(0,p.Mw)(),d=(0,p.qD)(),v=m(m({},t),{},{stroke:null!==(e=t.stroke)&&void 0!==e?e:A.stroke,fill:null!==(r=t.fill)&&void 0!==r?r:A.fill,horizontal:null!==(o=t.horizontal)&&void 0!==o?o:A.horizontal,horizontalFill:null!==(c=t.horizontalFill)&&void 0!==c?c:A.horizontalFill,vertical:null!==(l=t.vertical)&&void 0!==l?l:A.vertical,verticalFill:null!==(s=t.verticalFill)&&void 0!==s?s:A.verticalFill,x:(0,u.hj)(t.x)?t.x:d.left,y:(0,u.hj)(t.y)?t.y:d.top,width:(0,u.hj)(t.width)?t.width:d.width,height:(0,u.hj)(t.height)?t.height:d.height}),g=v.x,w=v.y,M=v.width,_=v.height,T=v.syncWithTicks,C=v.horizontalValues,N=v.verticalValues,D=(0,p.CW)(),I=(0,p.Nf)();if(!(0,u.hj)(M)||M<=0||!(0,u.hj)(_)||_<=0||!(0,u.hj)(g)||g!==+g||!(0,u.hj)(w)||w!==+w)return null;var L=v.verticalCoordinatesGenerator||E,B=v.horizontalCoordinatesGenerator||k,R=v.horizontalPoints,z=v.verticalPoints;if((!R||!R.length)&&i()(B)){var U=C&&C.length,F=B({yAxis:I?m(m({},I),{},{ticks:U?C:I.ticks}):void 0,width:f,height:h,offset:d},!!U||T);(0,a.Z)(Array.isArray(F),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(y(F),"]")),Array.isArray(F)&&(R=F)}if((!z||!z.length)&&i()(L)){var $=N&&N.length,q=L({xAxis:D?m(m({},D),{},{ticks:$?N:D.ticks}):void 0,width:f,height:h,offset:d},!!$||T);(0,a.Z)(Array.isArray(q),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(y(q),"]")),Array.isArray(q)&&(z=q)}return n.createElement("g",{className:"recharts-cartesian-grid"},n.createElement(x,{fill:v.fill,fillOpacity:v.fillOpacity,x:v.x,y:v.y,width:v.width,height:v.height,ry:v.ry}),n.createElement(O,b({},v,{offset:d,horizontalPoints:R,xAxis:D,yAxis:I})),n.createElement(j,b({},v,{offset:d,verticalPoints:z,xAxis:D,yAxis:I})),n.createElement(S,b({},v,{horizontalPoints:R})),n.createElement(P,b({},v,{verticalPoints:z})))}M.displayName="CartesianGrid"},13137:function(t,e,r){"use strict";r.d(e,{W:function(){return v}});var n=r(2265),o=r(69398),i=r(9841),a=r(82944),u=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,u),m=(0,a.L6)(v,!1);"x"===this.props.direction&&"number"!==d.type&&(0,o.Z)(!1);var b=p.map(function(t){var o,a,u=h(t,f),p=u.x,v=u.y,b=u.value,g=u.errorVal;if(!g)return null;var x=[];if(Array.isArray(g)){var w=function(t){if(Array.isArray(t))return t}(g)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(g,2)||function(t,e){if(t){if("string"==typeof t)return s(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,2)}}(g,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();o=w[0],a=w[1]}else o=a=g;if("vertical"===r){var O=d.scale,j=v+e,S=j+c,P=j-c,E=O(b-o),k=O(b+a);x.push({x1:k,y1:S,x2:k,y2:P}),x.push({x1:E,y1:j,x2:k,y2:j}),x.push({x1:E,y1:S,x2:E,y2:P})}else if("horizontal"===r){var A=y.scale,M=p+e,_=M-c,T=M+c,C=A(b-o),N=A(b+a);x.push({x1:_,y1:N,x2:T,y2:N}),x.push({x1:M,y1:C,x2:M,y2:N}),x.push({x1:_,y1:C,x2:T,y2:C})}return n.createElement(i.m,l({className:"recharts-errorBar",key:"bar-".concat(x.map(function(t){return"".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))},m),x.map(function(t){return n.createElement("line",l({},t,{key:"line-".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))}))});return n.createElement(i.m,{className:"recharts-errorBars"},b)}}],function(t,e){for(var r=0;rt*o)return!1;var i=r();return t*(e-t*i/2-n)>=0&&t*(e+t*i/2-o)<=0}function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t){for(var e=1;e=2?(0,i.uY)(m[1].coordinate-m[0].coordinate):1,M=(n="width"===P,f=b.x,p=b.y,d=b.width,y=b.height,1===A?{start:n?f:p,end:n?f+d:p+y}:{start:n?f+d:p+y,end:n?f:p});return"equidistantPreserveStart"===w?function(t,e,r,n,o){for(var i,a=(n||[]).slice(),u=e.start,c=e.end,f=0,p=1,h=u;p<=a.length;)if(i=function(){var e,i=null==n?void 0:n[f];if(void 0===i)return{v:l(n,p)};var a=f,d=function(){return void 0===e&&(e=r(i,a)),e},y=i.coordinate,v=0===f||s(t,y,d,h,c);v||(f=0,h=u,p+=1),v&&(h=y+t*(d()/2+o),f+=p)}())return i.v;return[]}(A,M,k,m,g):("preserveStart"===w||"preserveStartEnd"===w?function(t,e,r,n,o,i){var a=(n||[]).slice(),u=a.length,c=e.start,l=e.end;if(i){var f=n[u-1],p=r(f,u-1),d=t*(f.coordinate+t*p/2-l);a[u-1]=f=h(h({},f),{},{tickCoord:d>0?f.coordinate-d*t:f.coordinate}),s(t,f.tickCoord,function(){return p},c,l)&&(l=f.tickCoord-t*(p/2+o),a[u-1]=h(h({},f),{},{isShow:!0}))}for(var y=i?u-1:u,v=function(e){var n,i=a[e],u=function(){return void 0===n&&(n=r(i,e)),n};if(0===e){var f=t*(i.coordinate-t*u()/2-c);a[e]=i=h(h({},i),{},{tickCoord:f<0?i.coordinate-f*t:i.coordinate})}else a[e]=i=h(h({},i),{},{tickCoord:i.coordinate});s(t,i.tickCoord,u,c,l)&&(c=i.tickCoord+t*(u()/2+o),a[e]=h(h({},i),{},{isShow:!0}))},m=0;m0?l.coordinate-p*t:l.coordinate})}else i[e]=l=h(h({},l),{},{tickCoord:l.coordinate});s(t,l.tickCoord,f,u,c)&&(c=l.tickCoord-t*(f()/2+o),i[e]=h(h({},l),{},{isShow:!0}))},f=a-1;f>=0;f--)l(f);return i}(A,M,k,m,g)).filter(function(t){return t.isShow})}},93765:function(t,e,r){"use strict";r.d(e,{z:function(){return eD}});var n,o,i=r(2265),a=r(77571),u=r.n(a),c=r(86757),l=r.n(c),s=r(99676),f=r.n(s),p=r(13735),h=r.n(p),d=r(34935),y=r.n(d),v=r(37065),m=r.n(v),b=r(87602),g=r(69398),x=r(48777),w=r(9841),O=r(8147),j=r(22190),S=r(81889),P=r(73649),E=r(82944),k=r(55284),A=r(58811),M=r(85355),_=r(16630);function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e0&&e.handleDrag(t.changedTouches[0])}),W(e,"handleDragEnd",function(){e.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var t=e.props,r=t.endIndex,n=t.onDragEnd,o=t.startIndex;null==n||n({endIndex:r,startIndex:o})}),e.detachDragEndListener()}),W(e,"handleLeaveWrapper",function(){(e.state.isTravellerMoving||e.state.isSlideMoving)&&(e.leaveTimer=window.setTimeout(e.handleDragEnd,e.props.leaveTimeOut))}),W(e,"handleEnterSlideOrTraveller",function(){e.setState({isTextActive:!0})}),W(e,"handleLeaveSlideOrTraveller",function(){e.setState({isTextActive:!1})}),W(e,"handleSlideDragStart",function(t){var r=X(t)?t.changedTouches[0]:t;e.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:r.pageX}),e.attachDragEndListener()}),e.travellerDragStartHandlers={startX:e.handleTravellerDragStart.bind(e,"startX"),endX:e.handleTravellerDragStart.bind(e,"endX")},e.state={},e}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(n,t),e=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var e=t.startX,r=t.endX,o=this.state.scaleValues,i=this.props,a=i.gap,u=i.data.length-1,c=n.getIndexInRange(o,Math.min(e,r)),l=n.getIndexInRange(o,Math.max(e,r));return{startIndex:c-c%a,endIndex:l===u?u:l-l%a}}},{key:"getTextOfTick",value:function(t){var e=this.props,r=e.data,n=e.tickFormatter,o=e.dataKey,i=(0,M.F$)(r[t],o,t);return l()(n)?n(i,t):i}},{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(t){var e=this.state,r=e.slideMoveStartX,n=e.startX,o=e.endX,i=this.props,a=i.x,u=i.width,c=i.travellerWidth,l=i.startIndex,s=i.endIndex,f=i.onChange,p=t.pageX-r;p>0?p=Math.min(p,a+u-c-o,a+u-c-n):p<0&&(p=Math.max(p,a-n,a-o));var h=this.getIndex({startX:n+p,endX:o+p});(h.startIndex!==l||h.endIndex!==s)&&f&&f(h),this.setState({startX:n+p,endX:o+p,slideMoveStartX:t.pageX})}},{key:"handleTravellerDragStart",value:function(t,e){var r=X(e)?e.changedTouches[0]:e;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:r.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(t){var e=this.state,r=e.brushMoveStartX,n=e.movingTravellerId,o=e.endX,i=e.startX,a=this.state[n],u=this.props,c=u.x,l=u.width,s=u.travellerWidth,f=u.onChange,p=u.gap,h=u.data,d={startX:this.state.startX,endX:this.state.endX},y=t.pageX-r;y>0?y=Math.min(y,c+l-s-a):y<0&&(y=Math.max(y,c-a)),d[n]=a+y;var v=this.getIndex(d),m=v.startIndex,b=v.endIndex,g=function(){var t=h.length-1;return"startX"===n&&(o>i?m%p==0:b%p==0)||oi?b%p==0:m%p==0)||o>i&&b===t};this.setState(W(W({},n,a+y),"brushMoveStartX",t.pageX),function(){f&&g()&&f(v)})}},{key:"handleTravellerMoveKeyboard",value:function(t,e){var r=this,n=this.state,o=n.scaleValues,i=n.startX,a=n.endX,u=this.state[e],c=o.indexOf(u);if(-1!==c){var l=c+t;if(-1!==l&&!(l>=o.length)){var s=o[l];"startX"===e&&s>=a||"endX"===e&&s<=i||this.setState(W({},e,s),function(){r.props.onChange(r.getIndex({startX:r.state.startX,endX:r.state.endX}))})}}}},{key:"renderBackground",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.fill,u=t.stroke;return i.createElement("rect",{stroke:u,fill:a,x:e,y:r,width:n,height:o})}},{key:"renderPanorama",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.data,u=t.children,c=t.padding,l=i.Children.only(u);return l?i.cloneElement(l,{x:e,y:r,width:n,height:o,margin:c,compact:!0,data:a}):null}},{key:"renderTravellerLayer",value:function(t,e){var r,o,a=this,u=this.props,c=u.y,l=u.travellerWidth,s=u.height,f=u.traveller,p=u.ariaLabel,h=u.data,d=u.startIndex,y=u.endIndex,v=Math.max(t,this.props.x),m=U(U({},(0,E.L6)(this.props,!1)),{},{x:v,y:c,width:l,height:s}),b=p||"Min value: ".concat(null===(r=h[d])||void 0===r?void 0:r.name,", Max value: ").concat(null===(o=h[y])||void 0===o?void 0:o.name);return i.createElement(w.m,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[e],onTouchStart:this.travellerDragStartHandlers[e],onKeyDown:function(t){["ArrowLeft","ArrowRight"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),a.handleTravellerMoveKeyboard("ArrowRight"===t.key?1:-1,e))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},n.renderTraveller(f,m))}},{key:"renderSlide",value:function(t,e){var r=this.props,n=r.y,o=r.height,a=r.stroke,u=r.travellerWidth;return i.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:a,fillOpacity:.2,x:Math.min(t,e)+u,y:n,width:Math.max(Math.abs(e-t)-u,0),height:o})}},{key:"renderText",value:function(){var t=this.props,e=t.startIndex,r=t.endIndex,n=t.y,o=t.height,a=t.travellerWidth,u=t.stroke,c=this.state,l=c.startX,s=c.endX,f={pointerEvents:"none",fill:u};return i.createElement(w.m,{className:"recharts-brush-texts"},i.createElement(A.x,R({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,s)-5,y:n+o/2},f),this.getTextOfTick(e)),i.createElement(A.x,R({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,s)+a+5,y:n+o/2},f),this.getTextOfTick(r)))}},{key:"render",value:function(){var t=this.props,e=t.data,r=t.className,n=t.children,o=t.x,a=t.y,u=t.width,c=t.height,l=t.alwaysShowText,s=this.state,f=s.startX,p=s.endX,h=s.isTextActive,d=s.isSlideMoving,y=s.isTravellerMoving,v=s.isTravellerFocused;if(!e||!e.length||!(0,_.hj)(o)||!(0,_.hj)(a)||!(0,_.hj)(u)||!(0,_.hj)(c)||u<=0||c<=0)return null;var m=(0,b.Z)("recharts-brush",r),g=1===i.Children.count(n),x=L("userSelect","none");return i.createElement(w.m,{className:m,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:x},this.renderBackground(),g&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(h||d||y||v||l)&&this.renderText())}}],r=[{key:"renderDefaultTraveller",value:function(t){var e=t.x,r=t.y,n=t.width,o=t.height,a=t.stroke,u=Math.floor(r+o/2)-1;return i.createElement(i.Fragment,null,i.createElement("rect",{x:e,y:r,width:n,height:o,fill:a,stroke:"none"}),i.createElement("line",{x1:e+1,y1:u,x2:e+n-1,y2:u,fill:"none",stroke:"#fff"}),i.createElement("line",{x1:e+1,y1:u+2,x2:e+n-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,e){return i.isValidElement(t)?i.cloneElement(t,e):l()(t)?t(e):n.renderDefaultTraveller(e)}},{key:"getDerivedStateFromProps",value:function(t,e){var r=t.data,n=t.width,o=t.x,i=t.travellerWidth,a=t.updateId,u=t.startIndex,c=t.endIndex;if(r!==e.prevData||a!==e.prevUpdateId)return U({prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n},r&&r.length?H({data:r,width:n,x:o,travellerWidth:i,startIndex:u,endIndex:c}):{scale:null,scaleValues:null});if(e.scale&&(n!==e.prevWidth||o!==e.prevX||i!==e.prevTravellerWidth)){e.scale.range([o,o+n-i]);var l=e.scale.domain().map(function(t){return e.scale(t)});return{prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n,startX:e.scale(t.startIndex),endX:e.scale(t.endIndex),scaleValues:l}}return null}},{key:"getIndexInRange",value:function(t,e){for(var r=t.length,n=0,o=r-1;o-n>1;){var i=Math.floor((n+o)/2);t[i]>e?o=i:n=i}return e>=t[o]?o:n}}],e&&F(n.prototype,e),r&&F(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}(i.PureComponent);W(G,"displayName","Brush"),W(G,"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 V=r(4094),K=r(38569),Q=r(26680),J=function(t,e){var r=t.alwaysShow,n=t.ifOverflow;return r&&(n="extendDomain"),n===e},tt=r(25311),te=r(1175);function tr(){return(tr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,t2));return(0,_.hj)(r)&&(0,_.hj)(o)&&(0,_.hj)(f)&&(0,_.hj)(h)&&(0,_.hj)(u)&&(0,_.hj)(l)?i.createElement("path",t5({},(0,E.L6)(y,!0),{className:(0,b.Z)("recharts-cross",d),d:"M".concat(r,",").concat(u,"v").concat(h,"M").concat(l,",").concat(o,"h").concat(f)})):null};function t7(t){var e=t.cx,r=t.cy,n=t.radius,o=t.startAngle,i=t.endAngle;return{points:[(0,tq.op)(e,r,n,o),(0,tq.op)(e,r,n,i)],cx:e,cy:r,radius:n,startAngle:o,endAngle:i}}var t8=r(60474);function t4(t){return(t4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ec=function(){return!!t})()}function el(t){return(el=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function es(t,e){return(es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ef(t){return function(t){if(Array.isArray(t))return eh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ep(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ep(t,e){if(t){if("string"==typeof t)return eh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eh(t,e)}}function eh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0?i:t&&t.length&&(0,_.hj)(n)&&(0,_.hj)(o)?t.slice(n,o+1):[]};function eS(t){return"number"===t?[0,"auto"]:void 0}var eP=function(t,e,r,n){var o=t.graphicalItems,i=t.tooltipAxis,a=ej(e,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(o,u){var c,l,s=null!==(c=u.props.data)&&void 0!==c?c:e;if(s&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(s=s.slice(t.dataStartIndex,t.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory){var f=void 0===s?a:s;l=(0,_.Ap)(f,i.dataKey,n)}else l=s&&s[r]||a[r];return l?[].concat(ef(o),[(0,M.Qo)(u,l)]):o},[])},eE=function(t,e,r,n){var o=n||{x:t.chartX,y:t.chartY},i="horizontal"===r?o.x:"vertical"===r?o.y:"centric"===r?o.angle:o.radius,a=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,l=(0,M.VO)(i,a,c,u);if(l>=0&&c){var s=c[l]&&c[l].value,f=eP(t,e,l,s),p=eO(r,a,l,o);return{activeTooltipIndex:l,activeLabel:s,activePayload:f,activeCoordinate:p}}return null},ek=function(t,e){var r=e.axes,n=e.graphicalItems,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,l=e.dataEndIndex,s=t.layout,p=t.children,h=t.stackOffset,d=(0,M.NA)(s,o);return r.reduce(function(e,r){var y=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,v=y.type,m=y.dataKey,b=y.allowDataOverflow,g=y.allowDuplicatedCategory,x=y.scale,w=y.ticks,O=y.includeHidden,j=y[i];if(e[j])return e;var S=ej(t.data,{graphicalItems:n.filter(function(t){var e;return(i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i])===j}),dataStartIndex:c,dataEndIndex:l}),P=S.length;(function(t,e,r){if("number"===r&&!0===e&&Array.isArray(t)){var n=null==t?void 0:t[0],o=null==t?void 0:t[1];if(n&&o&&(0,_.hj)(n)&&(0,_.hj)(o))return!0}return!1})(y.domain,b,v)&&(A=(0,M.LG)(y.domain,null,b),d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category")));var E=eS(v);if(!A||0===A.length){var k,A,T,C,N,D=null!==(N=y.domain)&&void 0!==N?N:E;if(m){if(A=(0,M.gF)(S,m,v),"category"===v&&d){var I=(0,_.bv)(A);g&&I?(T=A,A=f()(0,P)):g||(A=(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0?t:[].concat(ef(t),[e])},[]))}else if("category"===v)A=g?A.filter(function(t){return""!==t&&!u()(t)}):(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0||""===e||u()(e)?t:[].concat(ef(t),[e])},[]);else if("number"===v){var L=(0,M.ZI)(S,n.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===j&&(O||!o)}),m,o,s);L&&(A=L)}d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category"))}else A=d?f()(0,P):a&&a[j]&&a[j].hasStack&&"number"===v?"expand"===h?[0,1]:(0,M.EB)(a[j].stackGroups,c,l):(0,M.s6)(S,n.filter(function(t){var e=i in t.props?t.props[i]:t.type.defaultProps[i],r="hide"in t.props?t.props.hide:t.type.defaultProps.hide;return e===j&&(O||!r)}),v,s,!0);"number"===v?(A=t$(p,A,j,o,w),D&&(A=(0,M.LG)(D,A,b))):"category"===v&&D&&A.every(function(t){return D.indexOf(t)>=0})&&(A=D)}return ey(ey({},e),{},ev({},j,ey(ey({},y),{},{axisType:o,domain:A,categoricalDomain:C,duplicateDomain:T,originalDomain:null!==(k=y.domain)&&void 0!==k?k:E,isCategorical:d,layout:s})))},{})},eA=function(t,e){var r=e.graphicalItems,n=e.Axis,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.layout,s=t.children,p=ej(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:c}),d=p.length,y=(0,M.NA)(l,o),v=-1;return r.reduce(function(t,e){var m,b=(void 0!==e.type.defaultProps?ey(ey({},e.type.defaultProps),e.props):e.props)[i],g=eS("number");return t[b]?t:(v++,m=y?f()(0,d):a&&a[b]&&a[b].hasStack?t$(s,m=(0,M.EB)(a[b].stackGroups,u,c),b,o):t$(s,m=(0,M.LG)(g,(0,M.s6)(p,r.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===b&&!o}),"number",l),n.defaultProps.allowDataOverflow),b,o),ey(ey({},t),{},ev({},b,ey(ey({axisType:o},n.defaultProps),{},{hide:!0,orientation:h()(eb,"".concat(o,".").concat(v%2),null),domain:m,originalDomain:g,isCategorical:y,layout:l}))))},{})},eM=function(t,e){var r=e.axisType,n=void 0===r?"xAxis":r,o=e.AxisComp,i=e.graphicalItems,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.children,s="".concat(n,"Id"),f=(0,E.NN)(l,o),p={};return f&&f.length?p=ek(t,{axes:f,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c}):i&&i.length&&(p=eA(t,{Axis:o,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c})),p},e_=function(t){var e=(0,_.Kt)(t),r=(0,M.uY)(e,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:y()(r,function(t){return t.coordinate}),tooltipAxis:e,tooltipAxisBandSize:(0,M.zT)(e,r)}},eT=function(t){var e=t.children,r=t.defaultShowTooltip,n=(0,E.sP)(e,G),o=0,i=0;return t.data&&0!==t.data.length&&(i=t.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(i=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},eC=function(t){return"horizontal"===t?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===t?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===t?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},eN=function(t,e){var r=t.props,n=t.graphicalItems,o=t.xAxisMap,i=void 0===o?{}:o,a=t.yAxisMap,u=void 0===a?{}:a,c=r.width,l=r.height,s=r.children,f=r.margin||{},p=(0,E.sP)(s,G),d=(0,E.sP)(s,j.D),y=Object.keys(u).reduce(function(t,e){var r=u[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,t[n]+r.width))},{left:f.left||0,right:f.right||0}),v=Object.keys(i).reduce(function(t,e){var r=i[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,h()(t,"".concat(n))+r.height))},{top:f.top||0,bottom:f.bottom||0}),m=ey(ey({},v),y),b=m.bottom;p&&(m.bottom+=p.props.height||G.defaultProps.height),d&&e&&(m=(0,M.By)(m,n,r,e));var g=c-m.left-m.right,x=l-m.top-m.bottom;return ey(ey({brushBottom:b},m),{},{width:Math.max(g,0),height:Math.max(x,0)})},eD=function(t){var e=t.chartName,r=t.GraphicalChild,n=t.defaultTooltipEventType,o=void 0===n?"axis":n,a=t.validateTooltipEventTypes,c=void 0===a?["axis"]:a,s=t.axisComponents,f=t.legendContent,p=t.formatAxisMap,d=t.defaultProps,y=function(t,e){var r=e.graphicalItems,n=e.stackGroups,o=e.offset,i=e.updateId,a=e.dataStartIndex,c=e.dataEndIndex,l=t.barSize,f=t.layout,p=t.barGap,h=t.barCategoryGap,d=t.maxBarSize,y=eC(f),v=y.numericAxisName,m=y.cateAxisName,b=!!r&&!!r.length&&r.some(function(t){var e=(0,E.Gf)(t&&t.type);return e&&e.indexOf("Bar")>=0}),x=[];return r.forEach(function(r,y){var w=ej(t.data,{graphicalItems:[r],dataStartIndex:a,dataEndIndex:c}),O=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,j=O.dataKey,S=O.maxBarSize,P=O["".concat(v,"Id")],k=O["".concat(m,"Id")],A=s.reduce(function(t,r){var n=e["".concat(r.axisType,"Map")],o=O["".concat(r.axisType,"Id")];n&&n[o]||"zAxis"===r.axisType||(0,g.Z)(!1);var i=n[o];return ey(ey({},t),{},ev(ev({},r.axisType,i),"".concat(r.axisType,"Ticks"),(0,M.uY)(i)))},{}),_=A[m],T=A["".concat(m,"Ticks")],C=n&&n[P]&&n[P].hasStack&&(0,M.O3)(r,n[P].stackGroups),N=(0,E.Gf)(r.type).indexOf("Bar")>=0,D=(0,M.zT)(_,T),I=[],L=b&&(0,M.pt)({barSize:l,stackGroups:n,totalSize:"xAxis"===m?A[m].width:"yAxis"===m?A[m].height:void 0});if(N){var B,R,z=u()(S)?d:S,U=null!==(B=null!==(R=(0,M.zT)(_,T,!0))&&void 0!==R?R:z)&&void 0!==B?B:0;I=(0,M.qz)({barGap:p,barCategoryGap:h,bandSize:U!==D?U:D,sizeList:L[k],maxBarSize:z}),U!==D&&(I=I.map(function(t){return ey(ey({},t),{},{position:ey(ey({},t.position),{},{offset:t.position.offset-U/2})})}))}var F=r&&r.type&&r.type.getComposedData;F&&x.push({props:ey(ey({},F(ey(ey({},A),{},{displayedData:w,props:t,dataKey:j,item:r,bandSize:D,barPosition:I,offset:o,stackedData:C,layout:f,dataStartIndex:a,dataEndIndex:c}))),{},ev(ev(ev({key:r.key||"item-".concat(y)},v,A[v]),m,A[m]),"animationId",i)),childIndex:(0,E.$R)(r,t.children),item:r})}),x},v=function(t,n){var o=t.props,i=t.dataStartIndex,a=t.dataEndIndex,u=t.updateId;if(!(0,E.TT)({props:o}))return null;var c=o.children,l=o.layout,f=o.stackOffset,h=o.data,d=o.reverseStackOrder,v=eC(l),m=v.numericAxisName,b=v.cateAxisName,g=(0,E.NN)(c,r),x=(0,M.wh)(h,g,"".concat(m,"Id"),"".concat(b,"Id"),f,d),w=s.reduce(function(t,e){var r="".concat(e.axisType,"Map");return ey(ey({},t),{},ev({},r,eM(o,ey(ey({},e),{},{graphicalItems:g,stackGroups:e.axisType===m&&x,dataStartIndex:i,dataEndIndex:a}))))},{}),O=eN(ey(ey({},w),{},{props:o,graphicalItems:g}),null==n?void 0:n.legendBBox);Object.keys(w).forEach(function(t){w[t]=p(o,w[t],O,t.replace("Map",""),e)});var j=e_(w["".concat(b,"Map")]),S=y(o,ey(ey({},w),{},{dataStartIndex:i,dataEndIndex:a,updateId:u,graphicalItems:g,stackGroups:x,offset:O}));return ey(ey({formattedGraphicalItems:S,graphicalItems:g,offset:O,stackGroups:x},j),w)},j=function(t){var r;function n(t){var r,o,a,c,s;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,n),c=n,s=[t],c=el(c),ev(a=function(t,e){if(e&&("object"===eo(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,ec()?Reflect.construct(c,s||[],el(this).constructor):c.apply(this,s)),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ev(a,"accessibilityManager",new tQ),ev(a,"handleLegendBBoxUpdate",function(t){if(t){var e=a.state,r=e.dataStartIndex,n=e.dataEndIndex,o=e.updateId;a.setState(ey({legendBBox:t},v({props:a.props,dataStartIndex:r,dataEndIndex:n,updateId:o},ey(ey({},a.state),{},{legendBBox:t}))))}}),ev(a,"handleReceiveSyncEvent",function(t,e,r){a.props.syncId===t&&(r!==a.eventEmitterSymbol||"function"==typeof a.props.syncMethod)&&a.applySyncEvent(e)}),ev(a,"handleBrushChange",function(t){var e=t.startIndex,r=t.endIndex;if(e!==a.state.dataStartIndex||r!==a.state.dataEndIndex){var n=a.state.updateId;a.setState(function(){return ey({dataStartIndex:e,dataEndIndex:r},v({props:a.props,dataStartIndex:e,dataEndIndex:r,updateId:n},a.state))}),a.triggerSyncEvent({dataStartIndex:e,dataEndIndex:r})}}),ev(a,"handleMouseEnter",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseEnter;l()(n)&&n(r,t)}}),ev(a,"triggeredAfterMouseMove",function(t){var e=a.getMouseInfo(t),r=e?ey(ey({},e),{},{isTooltipActive:!0}):{isTooltipActive:!1};a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseMove;l()(n)&&n(r,t)}),ev(a,"handleItemMouseEnter",function(t){a.setState(function(){return{isTooltipActive:!0,activeItem:t,activePayload:t.tooltipPayload,activeCoordinate:t.tooltipPosition||{x:t.cx,y:t.cy}}})}),ev(a,"handleItemMouseLeave",function(){a.setState(function(){return{isTooltipActive:!1}})}),ev(a,"handleMouseMove",function(t){t.persist(),a.throttleTriggeredAfterMouseMove(t)}),ev(a,"handleMouseLeave",function(t){a.throttleTriggeredAfterMouseMove.cancel();var e={isTooltipActive:!1};a.setState(e),a.triggerSyncEvent(e);var r=a.props.onMouseLeave;l()(r)&&r(e,t)}),ev(a,"handleOuterEvent",function(t){var e,r=(0,E.Bh)(t),n=h()(a.props,"".concat(r));r&&l()(n)&&n(null!==(e=/.*touch.*/i.test(r)?a.getMouseInfo(t.changedTouches[0]):a.getMouseInfo(t))&&void 0!==e?e:{},t)}),ev(a,"handleClick",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onClick;l()(n)&&n(r,t)}}),ev(a,"handleMouseDown",function(t){var e=a.props.onMouseDown;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleMouseUp",function(t){var e=a.props.onMouseUp;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleTouchMove",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.throttleTriggeredAfterMouseMove(t.changedTouches[0])}),ev(a,"handleTouchStart",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseDown(t.changedTouches[0])}),ev(a,"handleTouchEnd",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseUp(t.changedTouches[0])}),ev(a,"handleDoubleClick",function(t){var e=a.props.onDoubleClick;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleContextMenu",function(t){var e=a.props.onContextMenu;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"triggerSyncEvent",function(t){void 0!==a.props.syncId&&tY.emit(tH,a.props.syncId,t,a.eventEmitterSymbol)}),ev(a,"applySyncEvent",function(t){var e=a.props,r=e.layout,n=e.syncMethod,o=a.state.updateId,i=t.dataStartIndex,u=t.dataEndIndex;if(void 0!==t.dataStartIndex||void 0!==t.dataEndIndex)a.setState(ey({dataStartIndex:i,dataEndIndex:u},v({props:a.props,dataStartIndex:i,dataEndIndex:u,updateId:o},a.state)));else if(void 0!==t.activeTooltipIndex){var c=t.chartX,l=t.chartY,s=t.activeTooltipIndex,f=a.state,p=f.offset,h=f.tooltipTicks;if(!p)return;if("function"==typeof n)s=n(h,t);else if("value"===n){s=-1;for(var d=0;d=0){if(s.dataKey&&!s.allowDuplicatedCategory){var A="function"==typeof s.dataKey?function(t){return"function"==typeof s.dataKey?s.dataKey(t.payload):null}:"payload.".concat(s.dataKey.toString());C=(0,_.Ap)(v,A,p),N=m&&b&&(0,_.Ap)(b,A,p)}else C=null==v?void 0:v[f],N=m&&b&&b[f];if(S||j){var T=void 0!==t.props.activeIndex?t.props.activeIndex:f;return[(0,i.cloneElement)(t,ey(ey(ey({},n.props),P),{},{activeIndex:T})),null,null]}if(!u()(C))return[k].concat(ef(a.renderActivePoints({item:n,activePoint:C,basePoint:N,childIndex:f,isRange:m})))}else{var C,N,D,I=(null!==(D=a.getItemByXY(a.state.activeCoordinate))&&void 0!==D?D:{graphicalItem:k}).graphicalItem,L=I.item,B=void 0===L?t:L,R=I.childIndex,z=ey(ey(ey({},n.props),P),{},{activeIndex:R});return[(0,i.cloneElement)(B,z),null,null]}}return m?[k,null,null]:[k,null]}),ev(a,"renderCustomized",function(t,e,r){return(0,i.cloneElement)(t,ey(ey({key:"recharts-customized-".concat(r)},a.props),a.state))}),ev(a,"renderMap",{CartesianGrid:{handler:ew,once:!0},ReferenceArea:{handler:a.renderReferenceElement},ReferenceLine:{handler:ew},ReferenceDot:{handler:a.renderReferenceElement},XAxis:{handler:ew},YAxis:{handler:ew},Brush:{handler:a.renderBrush,once:!0},Bar:{handler:a.renderGraphicChild},Line:{handler:a.renderGraphicChild},Area:{handler:a.renderGraphicChild},Radar:{handler:a.renderGraphicChild},RadialBar:{handler:a.renderGraphicChild},Scatter:{handler:a.renderGraphicChild},Pie:{handler:a.renderGraphicChild},Funnel:{handler:a.renderGraphicChild},Tooltip:{handler:a.renderCursor,once:!0},PolarGrid:{handler:a.renderPolarGrid,once:!0},PolarAngleAxis:{handler:a.renderPolarAxis},PolarRadiusAxis:{handler:a.renderPolarAxis},Customized:{handler:a.renderCustomized}}),a.clipPathId="".concat(null!==(r=t.id)&&void 0!==r?r:(0,_.EL)("recharts"),"-clip"),a.throttleTriggeredAfterMouseMove=m()(a.triggeredAfterMouseMove,null!==(o=t.throttleDelay)&&void 0!==o?o:1e3/60),a.state={},a}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&es(t,e)}(n,t),r=[{key:"componentDidMount",value:function(){var t,e;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(t=this.props.margin.left)&&void 0!==t?t:0,top:null!==(e=this.props.margin.top)&&void 0!==e?e:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var t=this.props,e=t.children,r=t.data,n=t.height,o=t.layout,i=(0,E.sP)(e,O.u);if(i){var a=i.props.defaultIndex;if("number"==typeof a&&!(a<0)&&!(a>this.state.tooltipTicks.length-1)){var u=this.state.tooltipTicks[a]&&this.state.tooltipTicks[a].value,c=eP(this.state,r,a,u),l=this.state.tooltipTicks[a].coordinate,s=(this.state.offset.top+n)/2,f="horizontal"===o?{x:l,y:s}:{y:l,x:s},p=this.state.formattedGraphicalItems.find(function(t){return"Scatter"===t.item.type.name});p&&(f=ey(ey({},f),p.props.points[a].tooltipPosition),c=p.props.points[a].tooltipPayload);var h={activeTooltipIndex:a,isTooltipActive:!0,activeLabel:u,activePayload:c,activeCoordinate:f};this.setState(h),this.renderCursor(i),this.accessibilityManager.setIndex(a)}}}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==e.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==t.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==t.margin){var r,n;this.accessibilityManager.setDetails({offset:{left:null!==(r=this.props.margin.left)&&void 0!==r?r:0,top:null!==(n=this.props.margin.top)&&void 0!==n?n:0}})}return null}},{key:"componentDidUpdate",value:function(t){(0,E.rL)([(0,E.sP)(t.children,O.u)],[(0,E.sP)(this.props.children,O.u)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var t=(0,E.sP)(this.props.children,O.u);if(t&&"boolean"==typeof t.props.shared){var e=t.props.shared?"axis":"item";return c.indexOf(e)>=0?e:o}return o}},{key:"getMouseInfo",value:function(t){if(!this.container)return null;var e=this.container,r=e.getBoundingClientRect(),n=(0,V.os)(r),o={chartX:Math.round(t.pageX-n.left),chartY:Math.round(t.pageY-n.top)},i=r.width/e.offsetWidth||1,a=this.inRange(o.chartX,o.chartY,i);if(!a)return null;var u=this.state,c=u.xAxisMap,l=u.yAxisMap,s=this.getTooltipEventType(),f=eE(this.state,this.props.data,this.props.layout,a);if("axis"!==s&&c&&l){var p=(0,_.Kt)(c).scale,h=(0,_.Kt)(l).scale,d=p&&p.invert?p.invert(o.chartX):null,y=h&&h.invert?h.invert(o.chartY):null;return ey(ey({},o),{},{xValue:d,yValue:y},f)}return f?ey(ey({},o),f):null}},{key:"inRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.props.layout,o=t/r,i=e/r;if("horizontal"===n||"vertical"===n){var a=this.state.offset;return o>=a.left&&o<=a.left+a.width&&i>=a.top&&i<=a.top+a.height?{x:o,y:i}:null}var u=this.state,c=u.angleAxisMap,l=u.radiusAxisMap;if(c&&l){var s=(0,_.Kt)(c);return(0,tq.z3)({x:o,y:i},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var t=this.props.children,e=this.getTooltipEventType(),r=(0,E.sP)(t,O.u),n={};return r&&"axis"===e&&(n="click"===r.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),ey(ey({},(0,tX.Ym)(this.props,this.handleOuterEvent)),n)}},{key:"addListener",value:function(){tY.on(tH,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){tY.removeListener(tH,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(t,e,r){for(var n=this.state.formattedGraphicalItems,o=0,i=n.length;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1;"insideStart"===u?(o=b+S*l,a=w):"insideEnd"===u?(o=g-S*l,a=!w):"end"===u&&(o=g+S*l,a=w),a=j<=0?a:!a;var P=(0,d.op)(p,y,O,o),E=(0,d.op)(p,y,O,o+(a?1:-1)*359),k="M".concat(P.x,",").concat(P.y,"\n A").concat(O,",").concat(O,",0,1,").concat(a?0:1,",\n ").concat(E.x,",").concat(E.y),A=i()(t.id)?(0,h.EL)("recharts-radial-line-"):t.id;return n.createElement("text",x({},r,{dominantBaseline:"central",className:(0,s.Z)("recharts-radial-bar-label",f)}),n.createElement("defs",null,n.createElement("path",{id:A,d:k})),n.createElement("textPath",{xlinkHref:"#".concat(A)},e))},j=function(t){var e=t.viewBox,r=t.offset,n=t.position,o=e.cx,i=e.cy,a=e.innerRadius,u=e.outerRadius,c=(e.startAngle+e.endAngle)/2;if("outside"===n){var l=(0,d.op)(o,i,u+r,c),s=l.x;return{x:s,y:l.y,textAnchor:s>=o?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"end"};var f=(0,d.op)(o,i,(a+u)/2,c);return{x:f.x,y:f.y,textAnchor:"middle",verticalAnchor:"middle"}},S=function(t){var e=t.viewBox,r=t.parentViewBox,n=t.offset,o=t.position,i=e.x,a=e.y,u=e.width,c=e.height,s=c>=0?1:-1,f=s*n,p=s>0?"end":"start",d=s>0?"start":"end",y=u>=0?1:-1,v=y*n,m=y>0?"end":"start",b=y>0?"start":"end";if("top"===o)return g(g({},{x:i+u/2,y:a-s*n,textAnchor:"middle",verticalAnchor:p}),r?{height:Math.max(a-r.y,0),width:u}:{});if("bottom"===o)return g(g({},{x:i+u/2,y:a+c+f,textAnchor:"middle",verticalAnchor:d}),r?{height:Math.max(r.y+r.height-(a+c),0),width:u}:{});if("left"===o){var x={x:i-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"};return g(g({},x),r?{width:Math.max(x.x-r.x,0),height:c}:{})}if("right"===o){var w={x:i+u+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"};return g(g({},w),r?{width:Math.max(r.x+r.width-w.x,0),height:c}:{})}var O=r?{width:u,height:c}:{};return"insideLeft"===o?g({x:i+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"},O):"insideRight"===o?g({x:i+u-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"},O):"insideTop"===o?g({x:i+u/2,y:a+f,textAnchor:"middle",verticalAnchor:d},O):"insideBottom"===o?g({x:i+u/2,y:a+c-f,textAnchor:"middle",verticalAnchor:p},O):"insideTopLeft"===o?g({x:i+v,y:a+f,textAnchor:b,verticalAnchor:d},O):"insideTopRight"===o?g({x:i+u-v,y:a+f,textAnchor:m,verticalAnchor:d},O):"insideBottomLeft"===o?g({x:i+v,y:a+c-f,textAnchor:b,verticalAnchor:p},O):"insideBottomRight"===o?g({x:i+u-v,y:a+c-f,textAnchor:m,verticalAnchor:p},O):l()(o)&&((0,h.hj)(o.x)||(0,h.hU)(o.x))&&((0,h.hj)(o.y)||(0,h.hU)(o.y))?g({x:i+(0,h.h1)(o.x,u),y:a+(0,h.h1)(o.y,c),textAnchor:"end",verticalAnchor:"end"},O):g({x:i+u/2,y:a+c/2,textAnchor:"middle",verticalAnchor:"middle"},O)};function P(t){var e,r=t.offset,o=g({offset:void 0===r?5:r},function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,v)),a=o.viewBox,c=o.position,l=o.value,d=o.children,y=o.content,m=o.className,b=o.textBreakAll;if(!a||i()(l)&&i()(d)&&!(0,n.isValidElement)(y)&&!u()(y))return null;if((0,n.isValidElement)(y))return(0,n.cloneElement)(y,o);if(u()(y)){if(e=(0,n.createElement)(y,o),(0,n.isValidElement)(e))return e}else e=w(o);var P="cx"in a&&(0,h.hj)(a.cx),E=(0,p.L6)(o,!0);if(P&&("insideStart"===c||"insideEnd"===c||"end"===c))return O(o,e,E);var k=P?j(o):S(o);return n.createElement(f.x,x({className:(0,s.Z)("recharts-label",void 0===m?"":m)},E,k,{breakAll:b}),e)}P.displayName="Label";var E=function(t){var e=t.cx,r=t.cy,n=t.angle,o=t.startAngle,i=t.endAngle,a=t.r,u=t.radius,c=t.innerRadius,l=t.outerRadius,s=t.x,f=t.y,p=t.top,d=t.left,y=t.width,v=t.height,m=t.clockWise,b=t.labelViewBox;if(b)return b;if((0,h.hj)(y)&&(0,h.hj)(v)){if((0,h.hj)(s)&&(0,h.hj)(f))return{x:s,y:f,width:y,height:v};if((0,h.hj)(p)&&(0,h.hj)(d))return{x:p,y:d,width:y,height:v}}return(0,h.hj)(s)&&(0,h.hj)(f)?{x:s,y:f,width:0,height:0}:(0,h.hj)(e)&&(0,h.hj)(r)?{cx:e,cy:r,startAngle:o||n||0,endAngle:i||n||0,innerRadius:c||0,outerRadius:l||u||a||0,clockWise:m}:t.viewBox?t.viewBox:{}};P.parseViewBox=E,P.renderCallByParent=function(t,e){var r,o,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&i&&!t.label)return null;var a=t.children,c=E(t),s=(0,p.NN)(a,P).map(function(t,r){return(0,n.cloneElement)(t,{viewBox:e||c,key:"label-".concat(r)})});return i?[(r=t.label,o=e||c,r?!0===r?n.createElement(P,{key:"label-implicit",viewBox:o}):(0,h.P2)(r)?n.createElement(P,{key:"label-implicit",viewBox:o,value:r}):(0,n.isValidElement)(r)?r.type===P?(0,n.cloneElement)(r,{key:"label-implicit",viewBox:o}):n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):u()(r)?n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):l()(r)?n.createElement(P,x({viewBox:o},r,{key:"label-implicit"})):null:null)].concat(function(t){if(Array.isArray(t))return m(t)}(s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return m(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s}},58772:function(t,e,r){"use strict";r.d(e,{e:function(){return P}});var n=r(2265),o=r(77571),i=r.n(o),a=r(28302),u=r.n(a),c=r(86757),l=r.n(c),s=r(86185),f=r.n(s),p=r(26680),h=r(9841),d=r(82944),y=r(85355);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var m=["valueAccessor"],b=["data","dataKey","clockWise","id","textBreakAll"];function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var S=function(t){return Array.isArray(t.value)?f()(t.value):t.value};function P(t){var e=t.valueAccessor,r=void 0===e?S:e,o=j(t,m),a=o.data,u=o.dataKey,c=o.clockWise,l=o.id,s=o.textBreakAll,f=j(o,b);return a&&a.length?n.createElement(h.m,{className:"recharts-label-list"},a.map(function(t,e){var o=i()(u)?r(t,e):(0,y.F$)(t&&t.payload,u),a=i()(l)?{}:{id:"".concat(l,"-").concat(e)};return n.createElement(p._,x({},(0,d.L6)(t,!0),f,a,{parentViewBox:t.parentViewBox,value:o,textBreakAll:s,viewBox:p._.parseViewBox(i()(c)?t:O(O({},t),{},{clockWise:c})),key:"label-".concat(e),index:e}))})):null}P.displayName="LabelList",P.renderCallByParent=function(t,e){var r,o=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&o&&!t.label)return null;var i=t.children,a=(0,d.NN)(i,P).map(function(t,r){return(0,n.cloneElement)(t,{data:e,key:"labelList-".concat(r)})});return o?[(r=t.label)?!0===r?n.createElement(P,{key:"labelList-implicit",data:e}):n.isValidElement(r)||l()(r)?n.createElement(P,{key:"labelList-implicit",data:e,content:r}):u()(r)?n.createElement(P,x({data:e},r,{key:"labelList-implicit"})):null:null].concat(function(t){if(Array.isArray(t))return g(t)}(a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,void 0)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):a}},22190:function(t,e,r){"use strict";r.d(e,{D:function(){return N}});var n=r(2265),o=r(86757),i=r.n(o),a=r(87602),u=r(1175),c=r(48777),l=r(14870),s=r(41637);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(){return(p=Object.assign?Object.assign.bind():function(t){for(var e=1;e');var x=e.inactive?h:e.color;return n.createElement("li",p({className:b,style:y,key:"legend-item-".concat(r)},(0,s.bw)(t.props,e,r)),n.createElement(c.T,{width:o,height:o,viewBox:d,style:v},t.renderIcon(e)),n.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},l?l(g,e,r):g))})}},{key:"render",value:function(){var t=this.props,e=t.payload,r=t.layout,o=t.align;return e&&e.length?n.createElement("ul",{className:"recharts-default-legend",style:{padding:0,margin:0,textAlign:"horizontal"===r?o:"left"}},this.renderItems()):null}}],function(t,e){for(var r=0;r1||Math.abs(e.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=e.width,this.lastBoundingBox.height=e.height,t&&t(e)):(-1!==this.lastBoundingBox.width||-1!==this.lastBoundingBox.height)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,t&&t(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?P({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(t){var e,r,n=this.props,o=n.layout,i=n.align,a=n.verticalAlign,u=n.margin,c=n.chartWidth,l=n.chartHeight;return t&&(void 0!==t.left&&null!==t.left||void 0!==t.right&&null!==t.right)||(e="center"===i&&"vertical"===o?{left:((c||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:u&&u.right||0}:{left:u&&u.left||0}),t&&(void 0!==t.top&&null!==t.top||void 0!==t.bottom&&null!==t.bottom)||(r="middle"===a?{top:((l||0)-this.getBBoxSnapshot().height)/2}:"bottom"===a?{bottom:u&&u.bottom||0}:{top:u&&u.top||0}),P(P({},e),r)}},{key:"render",value:function(){var t=this,e=this.props,r=e.content,o=e.width,i=e.height,a=e.wrapperStyle,u=e.payloadUniqBy,c=e.payload,l=P(P({position:"absolute",width:o||"auto",height:i||"auto"},this.getDefaultPosition(a)),a);return n.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(e){t.wrapperNode=e}},function(t,e){if(n.isValidElement(t))return n.cloneElement(t,e);if("function"==typeof t)return n.createElement(t,e);e.ref;var r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,j);return n.createElement(g,r)}(r,P(P({},this.props),{},{payload:(0,w.z)(c,u,C)})))}}],r=[{key:"getWithHeight",value:function(t,e){var r=P(P({},this.defaultProps),t.props).layout;return"vertical"===r&&(0,x.hj)(t.props.height)?{height:t.props.height}:"horizontal"===r?{width:t.props.width||e}:null}}],e&&E(o.prototype,e),r&&E(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.PureComponent);_(N,"displayName","Legend"),_(N,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"})},47625:function(t,e,r){"use strict";r.d(e,{h:function(){return d}});var n=r(87602),o=r(2265),i=r(37065),a=r.n(i),u=r(16630),c=r(1175),l=r(82944);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&(t=a()(t,S,{trailing:!0,leading:!1}));var e=new ResizeObserver(t),r=M.current.getBoundingClientRect();return D(r.width,r.height),e.observe(M.current),function(){e.disconnect()}},[D,S]);var I=(0,o.useMemo)(function(){var t=C.containerWidth,e=C.containerHeight;if(t<0||e<0)return null;(0,c.Z)((0,u.hU)(y)||(0,u.hU)(m),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",y,m),(0,c.Z)(!i||i>0,"The aspect(%s) must be greater than zero.",i);var r=(0,u.hU)(y)?t:y,n=(0,u.hU)(m)?e:m;i&&i>0&&(r?n=r/i:n&&(r=n*i),w&&n>w&&(n=w)),(0,c.Z)(r>0||n>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,n,y,m,g,x,i);var a=!Array.isArray(O)&&(0,l.Gf)(O.type).endsWith("Chart");return o.Children.map(O,function(t){return o.isValidElement(t)?(0,o.cloneElement)(t,p({width:r,height:n},a?{style:p({height:"100%",width:"100%",maxHeight:n,maxWidth:r},t.props.style)}:{})):t})},[i,O,m,w,x,g,C,y]);return o.createElement("div",{id:P?"".concat(P):void 0,className:(0,n.Z)("recharts-responsive-container",E),style:p(p({},void 0===A?{}:A),{},{width:y,height:m,minWidth:g,minHeight:x,maxHeight:w}),ref:M},I)})},58811:function(t,e,r){"use strict";r.d(e,{x:function(){return B}});var n=r(2265),o=r(77571),i=r.n(o),a=r(87602),u=r(16630),c=r(34067),l=r(82944),s=r(4094);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(function(t,e){var i=e.word,a=e.width,u=t[t.length-1];return u&&(null==n||o||u.width+a+ra||e.reduce(function(t,e){return t.width>e.width?t:e}).width>Number(n),e]},y=0,v=c.length-1,m=0;y<=v&&m<=c.length-1;){var b=Math.floor((y+v)/2),g=M(d(b-1),2),x=g[0],w=g[1],O=M(d(b),1)[0];if(x||O||(y=b+1),x&&O&&(v=b-1),!x&&O){i=w;break}m++}return i||h},D=function(t){return[{words:i()(t)?[]:t.toString().split(T)}]},I=function(t){var e=t.width,r=t.scaleToFit,n=t.children,o=t.style,i=t.breakAll,a=t.maxLines;if((e||r)&&!c.x.isSsr){var u=C({breakAll:i,children:n,style:o});return u?N({breakAll:i,children:n,maxLines:a,style:o},u.wordsWithComputedWidth,u.spaceWidth,e,r):D(n)}return D(n)},L="#808080",B=function(t){var e,r=t.x,o=void 0===r?0:r,i=t.y,c=void 0===i?0:i,s=t.lineHeight,f=void 0===s?"1em":s,p=t.capHeight,h=void 0===p?"0.71em":p,d=t.scaleToFit,y=void 0!==d&&d,v=t.textAnchor,m=t.verticalAnchor,b=t.fill,g=void 0===b?L:b,x=A(t,P),w=(0,n.useMemo)(function(){return I({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:y,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,y,x.style,x.width]),O=x.dx,j=x.dy,M=x.angle,_=x.className,T=x.breakAll,C=A(x,E);if(!(0,u.P2)(o)||!(0,u.P2)(c))return null;var N=o+((0,u.hj)(O)?O:0),D=c+((0,u.hj)(j)?j:0);switch(void 0===m?"end":m){case"start":e=S("calc(".concat(h,")"));break;case"middle":e=S("calc(".concat((w.length-1)/2," * -").concat(f," + (").concat(h," / 2))"));break;default:e=S("calc(".concat(w.length-1," * -").concat(f,")"))}var B=[];if(y){var R=w[0].width,z=x.width;B.push("scale(".concat(((0,u.hj)(z)?z/R:1)/R,")"))}return M&&B.push("rotate(".concat(M,", ").concat(N,", ").concat(D,")")),B.length&&(C.transform=B.join(" ")),n.createElement("text",k({},(0,l.L6)(C,!0),{x:N,y:D,className:(0,a.Z)("recharts-text",_),textAnchor:void 0===v?"start":v,fill:g.includes("url")?L:g}),w.map(function(t,r){var o=t.words.join(T?"":" ");return n.createElement("tspan",{x:N,dy:0===r?e:f,key:"".concat(o,"-").concat(r)},o)}))}},8147:function(t,e,r){"use strict";r.d(e,{u:function(){return $}});var n=r(2265),o=r(34935),i=r.n(o),a=r(77571),u=r.n(a),c=r(87602),l=r(16630);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){return(f=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rc[n]+s?Math.max(f,c[n]):Math.max(p,c[n])}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e1||Math.abs(t.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:t.width,height:t.height}})}else(-1!==this.state.lastBoundingBox.width||-1!==this.state.lastBoundingBox.height)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var t,e;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(t=this.props.coordinate)||void 0===t?void 0:t.x)!==this.state.dismissedAtCoordinate.x||(null===(e=this.props.coordinate)||void 0===e?void 0:e.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var t,e,r,o,i,a,u,s,f,p,h,d,y,v,m,O,j,P,E,k=this,A=this.props,M=A.active,_=A.allowEscapeViewBox,T=A.animationDuration,C=A.animationEasing,N=A.children,D=A.coordinate,I=A.hasPayload,L=A.isAnimationActive,B=A.offset,R=A.position,z=A.reverseDirection,U=A.useTranslate3d,F=A.viewBox,$=A.wrapperStyle,q=(d=(t={allowEscapeViewBox:_,coordinate:D,offsetTopLeft:B,position:R,reverseDirection:z,tooltipBox:this.state.lastBoundingBox,useTranslate3d:U,viewBox:F}).allowEscapeViewBox,y=t.coordinate,v=t.offsetTopLeft,m=t.position,O=t.reverseDirection,j=t.tooltipBox,P=t.useTranslate3d,E=t.viewBox,j.height>0&&j.width>0&&y?(r=(e={translateX:p=w({allowEscapeViewBox:d,coordinate:y,key:"x",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.width,viewBox:E,viewBoxDimension:E.width}),translateY:h=w({allowEscapeViewBox:d,coordinate:y,key:"y",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.height,viewBox:E,viewBoxDimension:E.height}),useTranslate3d:P}).translateX,o=e.translateY,f={transform:e.useTranslate3d?"translate3d(".concat(r,"px, ").concat(o,"px, 0)"):"translate(".concat(r,"px, ").concat(o,"px)")}):f=x,{cssProperties:f,cssClasses:(a=(i={translateX:p,translateY:h,coordinate:y}).coordinate,u=i.translateX,s=i.translateY,(0,c.Z)(g,b(b(b(b({},"".concat(g,"-right"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u>=a.x),"".concat(g,"-left"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u=a.y),"".concat(g,"-top"),(0,l.hj)(s)&&a&&(0,l.hj)(a.y)&&s0;return n.createElement(_,{allowEscapeViewBox:i,animationDuration:a,animationEasing:u,isAnimationActive:f,active:o,coordinate:l,hasPayload:O,offset:p,position:y,reverseDirection:m,useTranslate3d:b,viewBox:g,wrapperStyle:x},(t=I(I({},this.props),{},{payload:w}),n.isValidElement(c)?n.cloneElement(c,t):"function"==typeof c?n.createElement(c,t):n.createElement(v,t)))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),s=(0,o.Z)("recharts-layer",c);return n.createElement("g",u({className:s},(0,i.L6)(l,!0),{ref:e}),r)})},48777:function(t,e,r){"use strict";r.d(e,{T:function(){return c}});var n=r(2265),o=r(87602),i=r(82944),a=["children","width","height","viewBox","className","style","title","desc"];function u(){return(u=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),y=l||{width:r,height:c,x:0,y:0},v=(0,o.Z)("recharts-surface",s);return n.createElement("svg",u({},(0,i.L6)(d,!0,"svg"),{className:v,width:r,height:c,style:f,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height)}),n.createElement("title",null,p),n.createElement("desc",null,h),e)}},25739:function(t,e,r){"use strict";r.d(e,{br:function(){return g},CW:function(){return O},Mw:function(){return A},zn:function(){return k},sp:function(){return x},qD:function(){return E},d2:function(){return P},bH:function(){return w},Ud:function(){return S},Nf:function(){return j}});var n=r(2265),o=r(69398),i=r(84173),a=r.n(i),u=r(32242),c=r.n(u),l=r(50967),s=r.n(l)()(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),f=r(16630),p=(0,n.createContext)(void 0),h=(0,n.createContext)(void 0),d=(0,n.createContext)(void 0),y=(0,n.createContext)({}),v=(0,n.createContext)(void 0),m=(0,n.createContext)(0),b=(0,n.createContext)(0),g=function(t){var e=t.state,r=e.xAxisMap,o=e.yAxisMap,i=e.offset,a=t.clipPathId,u=t.children,c=t.width,l=t.height,f=s(i);return n.createElement(p.Provider,{value:r},n.createElement(h.Provider,{value:o},n.createElement(y.Provider,{value:i},n.createElement(d.Provider,{value:f},n.createElement(v.Provider,{value:a},n.createElement(m.Provider,{value:l},n.createElement(b.Provider,{value:c},u)))))))},x=function(){return(0,n.useContext)(v)},w=function(t){var e=(0,n.useContext)(p);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},O=function(){var t=(0,n.useContext)(p);return(0,f.Kt)(t)},j=function(){var t=(0,n.useContext)(h);return a()(t,function(t){return c()(t.domain,Number.isFinite)})||(0,f.Kt)(t)},S=function(t){var e=(0,n.useContext)(h);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},P=function(){return(0,n.useContext)(d)},E=function(){return(0,n.useContext)(y)},k=function(){return(0,n.useContext)(b)},A=function(){return(0,n.useContext)(m)}},57165:function(t,e,r){"use strict";r.d(e,{H:function(){return H}});var n=r(2265);function o(){}function i(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function a(t){this._context=t}function u(t){this._context=t}function c(t){this._context=t}a.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:i(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},u.prototype={areaStart:o,areaEnd:o,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},c.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class l{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function s(t){this._context=t}function f(t){this._context=t}function p(t){return new f(t)}function h(t,e,r){var n=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(n||o<0&&-0),a=(r-t._y1)/(o||n<0&&-0);return((i<0?-1:1)+(a<0?-1:1))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs((i*o+a*n)/(n+o)))||0}function d(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function y(t,e,r){var n=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-n)/3;t._context.bezierCurveTo(n+u,o+u*e,i-u,a-u*r,i,a)}function v(t){this._context=t}function m(t){this._context=new b(t)}function b(t){this._context=t}function g(t){this._context=t}function x(t){var e,r,n=t.length-1,o=Array(n),i=Array(n),a=Array(n);for(o[0]=0,i[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)o[e]=(a[e]-o[e+1])/i[e];for(e=0,i[n-1]=(t[n]+o[n-1])/2;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}};var O=r(22516),j=r(76115),S=r(67790);function P(t){return t[0]}function E(t){return t[1]}function k(t,e){var r=(0,j.Z)(!0),n=null,o=p,i=null,a=(0,S.d)(u);function u(u){var c,l,s,f=(u=(0,O.Z)(u)).length,p=!1;for(null==n&&(i=o(s=a())),c=0;c<=f;++c)!(c=f;--p)u.point(m[p],b[p]);u.lineEnd(),u.areaEnd()}}v&&(m[s]=+t(h,s,l),b[s]=+e(h,s,l),u.point(n?+n(h,s,l):m[s],r?+r(h,s,l):b[s]))}if(d)return u=null,d+""||null}function s(){return k().defined(o).curve(a).context(i)}return t="function"==typeof t?t:void 0===t?P:(0,j.Z)(+t),e="function"==typeof e?e:void 0===e?(0,j.Z)(0):(0,j.Z)(+e),r="function"==typeof r?r:void 0===r?E:(0,j.Z)(+r),l.x=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),n=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),l):t},l.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):n},l.y=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),r=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),l):e},l.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):r},l.lineX0=l.lineY0=function(){return s().x(t).y(e)},l.lineY1=function(){return s().x(t).y(r)},l.lineX1=function(){return s().x(n).y(e)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:(0,j.Z)(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=i&&(u=a(i)),l):a},l.context=function(t){return arguments.length?(null==t?i=u=null:u=a(i=t),l):i},l}var M=r(75551),_=r.n(M),T=r(86757),C=r.n(T),N=r(87602),D=r(41637),I=r(82944),L=r(16630);function B(t){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(){return(R=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1,c=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0;if(a>0&&o instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=o[f]>a?a:o[f];i="M".concat(t,",").concat(e+u*s[0]),s[0]>0&&(i+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(l,",").concat(t+c*s[0],",").concat(e)),i+="L ".concat(t+r-c*s[1],",").concat(e),s[1]>0&&(i+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(l,",\n ").concat(t+r,",").concat(e+u*s[1])),i+="L ".concat(t+r,",").concat(e+n-u*s[2]),s[2]>0&&(i+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(l,",\n ").concat(t+r-c*s[2],",").concat(e+n)),i+="L ".concat(t+c*s[3],",").concat(e+n),s[3]>0&&(i+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(l,",\n ").concat(t,",").concat(e+n-u*s[3])),i+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);i="M ".concat(t,",").concat(e+u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+c*p,",").concat(e,"\n L ").concat(t+r-c*p,",").concat(e,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r,",").concat(e+u*p,"\n L ").concat(t+r,",").concat(e+n-u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r-c*p,",").concat(e+n,"\n L ").concat(t+c*p,",").concat(e+n,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t,",").concat(e+n-u*p," Z")}else i="M ".concat(t,",").concat(e," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return i},h=function(t,e){if(!t||!e)return!1;var r=t.x,n=t.y,o=e.x,i=e.y,a=e.width,u=e.height;return!!(Math.abs(a)>0&&Math.abs(u)>0)&&r>=Math.min(o,o+a)&&r<=Math.max(o,o+a)&&n>=Math.min(i,i+u)&&n<=Math.max(i,i+u)},d={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y=function(t){var e,r=f(f({},d),t),u=(0,n.useRef)(),s=function(t){if(Array.isArray(t))return t}(e=(0,n.useState)(-1))||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,2)||function(t,e){if(t){if("string"==typeof t)return l(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,2)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),h=s[0],y=s[1];(0,n.useEffect)(function(){if(u.current&&u.current.getTotalLength)try{var t=u.current.getTotalLength();t&&y(t)}catch(t){}},[]);var v=r.x,m=r.y,b=r.width,g=r.height,x=r.radius,w=r.className,O=r.animationEasing,j=r.animationDuration,S=r.animationBegin,P=r.isAnimationActive,E=r.isUpdateAnimationActive;if(v!==+v||m!==+m||b!==+b||g!==+g||0===b||0===g)return null;var k=(0,o.Z)("recharts-rectangle",w);return E?n.createElement(i.ZP,{canBegin:h>0,from:{width:b,height:g,x:v,y:m},to:{width:b,height:g,x:v,y:m},duration:j,animationEasing:O,isActive:E},function(t){var e=t.width,o=t.height,l=t.x,s=t.y;return n.createElement(i.ZP,{canBegin:h>0,from:"0px ".concat(-1===h?1:h,"px"),to:"".concat(h,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,isActive:P,easing:O},n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(l,s,e,o,x),ref:u})))}):n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(v,m,b,g,x)}))}},60474:function(t,e,r){"use strict";r.d(e,{L:function(){return v}});var n=r(2265),o=r(87602),i=r(82944),a=r(39206),u=r(16630);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>s),",\n ").concat(p.x,",").concat(p.y,"\n ");if(o>0){var d=(0,a.op)(r,n,o,c),y=(0,a.op)(r,n,o,s);h+="L ".concat(y.x,",").concat(y.y,"\n A ").concat(o,",").concat(o,",0,\n ").concat(+(Math.abs(l)>180),",").concat(+(c<=s),",\n ").concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},d=function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,a=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,s=t.endAngle,f=(0,u.uY)(s-l),d=p({cx:e,cy:r,radius:o,angle:l,sign:f,cornerRadius:i,cornerIsExternal:c}),y=d.circleTangency,v=d.lineTangency,m=d.theta,b=p({cx:e,cy:r,radius:o,angle:s,sign:-f,cornerRadius:i,cornerIsExternal:c}),g=b.circleTangency,x=b.lineTangency,w=b.theta,O=c?Math.abs(l-s):Math.abs(l-s)-m-w;if(O<0)return a?"M ".concat(v.x,",").concat(v.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(-(2*i),",0\n "):h({cx:e,cy:r,innerRadius:n,outerRadius:o,startAngle:l,endAngle:s});var j="M ".concat(v.x,",").concat(v.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,"\n A").concat(o,",").concat(o,",0,").concat(+(O>180),",").concat(+(f<0),",").concat(g.x,",").concat(g.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,"\n ");if(n>0){var S=p({cx:e,cy:r,radius:n,angle:l,sign:f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),P=S.circleTangency,E=S.lineTangency,k=S.theta,A=p({cx:e,cy:r,radius:n,angle:s,sign:-f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),M=A.circleTangency,_=A.lineTangency,T=A.theta,C=c?Math.abs(l-s):Math.abs(l-s)-k-T;if(C<0&&0===i)return"".concat(j,"L").concat(e,",").concat(r,"Z");j+="L".concat(_.x,",").concat(_.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,"\n A").concat(n,",").concat(n,",0,").concat(+(C>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,"Z")}else j+="L".concat(e,",").concat(r,"Z");return j},y={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},v=function(t){var e,r=f(f({},y),t),a=r.cx,c=r.cy,s=r.innerRadius,p=r.outerRadius,v=r.cornerRadius,m=r.forceCornerRadius,b=r.cornerIsExternal,g=r.startAngle,x=r.endAngle,w=r.className;if(p0&&360>Math.abs(g-x)?d({cx:a,cy:c,innerRadius:s,outerRadius:p,cornerRadius:Math.min(S,j/2),forceCornerRadius:m,cornerIsExternal:b,startAngle:g,endAngle:x}):h({cx:a,cy:c,innerRadius:s,outerRadius:p,startAngle:g,endAngle:x}),n.createElement("path",l({},(0,i.L6)(r,!0),{className:O,d:e,role:"img"}))}},14870:function(t,e,r){"use strict";r.d(e,{v:function(){return N}});var n=r(2265),o=r(75551),i=r.n(o);let a=Math.cos,u=Math.sin,c=Math.sqrt,l=Math.PI,s=2*l;var f={draw(t,e){let r=c(e/l);t.moveTo(r,0),t.arc(0,0,r,0,s)}};let p=c(1/3),h=2*p,d=u(l/10)/u(7*l/10),y=u(s/10)*d,v=-a(s/10)*d,m=c(3),b=c(3)/2,g=1/c(12),x=(g/2+1)*3;var w=r(76115),O=r(67790);c(3),c(3);var j=r(87602),S=r(82944);function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var E=["type","size","sizeType"];function k(){return(k=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,E)),{},{type:o,size:u,sizeType:l}),p=s.className,h=s.cx,d=s.cy,y=(0,S.L6)(s,!0);return h===+h&&d===+d&&u===+u?n.createElement("path",k({},y,{className:(0,j.Z)("recharts-symbols",p),transform:"translate(".concat(h,", ").concat(d,")"),d:(e=_["symbol".concat(i()(o))]||f,(function(t,e){let r=null,n=(0,O.d)(o);function o(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return t="function"==typeof t?t:(0,w.Z)(t||f),e="function"==typeof e?e:(0,w.Z)(void 0===e?64:+e),o.type=function(e){return arguments.length?(t="function"==typeof e?e:(0,w.Z)(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:(0,w.Z)(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o})().type(e).size(C(u,l,o))())})):null};N.registerSymbol=function(t,e){_["symbol".concat(i()(t))]=e}},11638:function(t,e,r){"use strict";r.d(e,{bn:function(){return C},a3:function(){return z},lT:function(){return N},V$:function(){return D},w7:function(){return I}});var n=r(2265),o=r(86757),i=r.n(o),a=r(90231),u=r.n(a),c=r(24342),l=r.n(c),s=r(21652),f=r.n(s),p=r(73649),h=r(87602),d=r(84735),y=r(82944);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){return(m=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:l},to:{upperWidth:s,lowerWidth:f,height:p,x:c,y:l},duration:j,animationEasing:g,isActive:P},function(t){var e=t.upperWidth,i=t.lowerWidth,u=t.height,c=t.x,l=t.y;return n.createElement(d.ZP,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,easing:g},n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,e,i,u),ref:o})))}):n.createElement("g",null,n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,s,f,p)})))},S=r(60474),P=r(9841),E=r(14870),k=["option","shapeType","propTransformer","activeClassName","isActive"];function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,k);if((0,n.isValidElement)(r))e=(0,n.cloneElement)(r,_(_({},f),(0,n.isValidElement)(r)?r.props:r));else if(i()(r))e=r(f);else if(u()(r)&&!l()(r)){var p=(void 0===a?function(t,e){return _(_({},e),t)}:a)(r,f);e=n.createElement(T,{shapeType:o,elementProps:p})}else e=n.createElement(T,{shapeType:o,elementProps:f});return s?n.createElement(P.m,{className:void 0===c?"recharts-active-shape":c},e):e}function N(t,e){return null!=e&&"trapezoids"in t.props}function D(t,e){return null!=e&&"sectors"in t.props}function I(t,e){return null!=e&&"points"in t.props}function L(t,e){var r,n,o=t.x===(null==e||null===(r=e.labelViewBox)||void 0===r?void 0:r.x)||t.x===e.x,i=t.y===(null==e||null===(n=e.labelViewBox)||void 0===n?void 0:n.y)||t.y===e.y;return o&&i}function B(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function R(t,e){var r=t.x===e.x,n=t.y===e.y,o=t.z===e.z;return r&&n&&o}function z(t){var e,r,n,o=t.activeTooltipItem,i=t.graphicalItem,a=t.itemData,u=(N(i,o)?e="trapezoids":D(i,o)?e="sectors":I(i,o)&&(e="points"),e),c=N(i,o)?null===(r=o.tooltipPayload)||void 0===r||null===(r=r[0])||void 0===r||null===(r=r.payload)||void 0===r?void 0:r.payload:D(i,o)?null===(n=o.tooltipPayload)||void 0===n||null===(n=n[0])||void 0===n||null===(n=n.payload)||void 0===n?void 0:n.payload:I(i,o)?o.payload:{},l=a.filter(function(t,e){var r=f()(c,t),n=i.props[u].filter(function(t){var e;return(N(i,o)?e=L:D(i,o)?e=B:I(i,o)&&(e=R),e)(t,o)}),a=i.props[u].indexOf(n[n.length-1]);return r&&e===a});return a.indexOf(l[l.length-1])}},25311:function(t,e,r){"use strict";r.d(e,{Ky:function(){return w},O1:function(){return b},_b:function(){return g},t9:function(){return m},xE:function(){return O}});var n=r(41443),o=r.n(n),i=r(32242),a=r.n(i),u=r(85355),c=r(82944),l=r(16630),s=r(31699);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r0&&(A=Math.min((t||0)-(M[e-1]||0),A))}),Number.isFinite(A)){var _=A/k,T="vertical"===g.layout?r.height:r.width;if("gap"===g.padding&&(c=_*T/2),"no-gap"===g.padding){var C=(0,l.h1)(t.barCategoryGap,_*T),N=_*T/2;c=N-C-(N-C)/T*C}}}s="xAxis"===n?[r.left+(j.left||0)+(c||0),r.left+r.width-(j.right||0)-(c||0)]:"yAxis"===n?"horizontal"===f?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(c||0),r.top+r.height-(j.bottom||0)-(c||0)]:g.range,P&&(s=[s[1],s[0]]);var D=(0,u.Hq)(g,o,m),I=D.scale,L=D.realScaleType;I.domain(w).range(s),(0,u.zF)(I);var B=(0,u.g$)(I,d(d({},g),{},{realScaleType:L}));"xAxis"===n?(b="top"===x&&!S||"bottom"===x&&S,p=r.left,h=v[E]-b*g.height):"yAxis"===n&&(b="left"===x&&!S||"right"===x&&S,p=v[E]-b*g.width,h=r.top);var R=d(d(d({},g),B),{},{realScaleType:L,x:p,y:h,scale:I,width:"xAxis"===n?r.width:g.width,height:"yAxis"===n?r.height:g.height});return R.bandSize=(0,u.zT)(R,B),g.hide||"xAxis"!==n?g.hide||(v[E]+=(b?-1:1)*R.width):v[E]+=(b?-1:1)*R.height,d(d({},i),{},y({},a,R))},{})},b=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return{x:Math.min(r,o),y:Math.min(n,i),width:Math.abs(o-r),height:Math.abs(i-n)}},g=function(t){return b({x:t.x1,y:t.y1},{x:t.x2,y:t.y2})},x=function(){var t,e;function r(t){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,r),this.scale=t}return t=[{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(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.bandAware,n=e.position;if(void 0!==t){if(n)switch(n){case"start":default:return this.scale(t);case"middle":var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}},{key:"isInRange",value:function(t){var e=this.range(),r=e[0],n=e[e.length-1];return r<=n?t>=r&&t<=n:t>=n&&t<=r}}],e=[{key:"create",value:function(t){return new r(t)}}],t&&p(r.prototype,t),e&&p(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}();y(x,"EPS",1e-4);var w=function(t){var e=Object.keys(t).reduce(function(e,r){return d(d({},e),{},y({},r,x.create(t[r])))},{});return d(d({},e),{},{apply:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.bandAware,i=r.position;return o()(t,function(t,r){return e[r].apply(t,{bandAware:n,position:i})})},isInRange:function(t){return a()(t,function(t,r){return e[r].isInRange(t)})}})},O=function(t){var e=t.width,r=t.height,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(n%180+180)%180*Math.PI/180,i=Math.atan(r/e);return Math.abs(o>i&&otx(e,t()).base(e.base()),tj.o.apply(e,arguments),e}},scaleOrdinal:function(){return tX.Z},scalePoint:function(){return f.x},scalePow:function(){return tJ},scaleQuantile:function(){return function t(){var e,r=[],n=[],o=[];function i(){var t=0,e=Math.max(1,n.length);for(o=Array(e-1);++t=1)return+r(t[n-1],n-1,t);var n,o=(n-1)*e,i=Math.floor(o),a=+r(t[i],i,t);return a+(+r(t[i+1],i+1,t)-a)*(o-i)}}(r,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:n[P(o,t)]}return a.invertExtent=function(t){var e=n.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e=o?[i[o-1],n]:[i[e-1],i[e]]},u.unknown=function(t){return arguments.length&&(e=t),u},u.thresholds=function(){return i.slice()},u.copy=function(){return t().domain([r,n]).range(a).unknown(e)},tj.o.apply(tI(u),arguments)}},scaleRadial:function(){return function t(){var e,r=tO(),n=[0,1],o=!1;function i(t){var n,i=Math.sign(n=r(t))*Math.sqrt(Math.abs(n));return isNaN(i)?e:o?Math.round(i):i}return i.invert=function(t){return r.invert(t1(t))},i.domain=function(t){return arguments.length?(r.domain(t),i):r.domain()},i.range=function(t){return arguments.length?(r.range((n=Array.from(t,td)).map(t1)),i):n.slice()},i.rangeRound=function(t){return i.range(t).round(!0)},i.round=function(t){return arguments.length?(o=!!t,i):o},i.clamp=function(t){return arguments.length?(r.clamp(t),i):r.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(r.domain(),n).round(o).clamp(r.clamp()).unknown(e)},tj.o.apply(i,arguments),tI(i)}},scaleSequential:function(){return function t(){var e=tI(rX()(tv));return e.copy=function(){return rG(e,t())},tj.O.apply(e,arguments)}},scaleSequentialLog:function(){return function t(){var e=tZ(rX()).domain([1,10]);return e.copy=function(){return rG(e,t()).base(e.base())},tj.O.apply(e,arguments)}},scaleSequentialPow:function(){return rV},scaleSequentialQuantile:function(){return function t(){var e=[],r=tv;function n(t){if(null!=t&&!isNaN(t=+t))return r((P(e,t,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let r of(e=[],t))null==r||isNaN(r=+r)||e.push(r);return e.sort(g),n},n.interpolator=function(t){return arguments.length?(r=t,n):r},n.range=function(){return e.map((t,n)=>r(n/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(r,n)=>(function(t,e,r){if(!(!(n=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,void 0))).length)||isNaN(e=+e))){if(e<=0||n<2)return t5(t);if(e>=1)return t2(t);var n,o=(n-1)*e,i=Math.floor(o),a=t2((function t(e,r,n=0,o=1/0,i){if(r=Math.floor(r),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(e.length-1,o)),!(n<=r&&r<=o))return e;for(i=void 0===i?t6:function(t=g){if(t===g)return t6;if("function"!=typeof t)throw TypeError("compare is not a function");return(e,r)=>{let n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}(i);o>n;){if(o-n>600){let a=o-n+1,u=r-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),s=.5*Math.sqrt(c*l*(a-l)/a)*(u-a/2<0?-1:1),f=Math.max(n,Math.floor(r-u*l/a+s)),p=Math.min(o,Math.floor(r+(a-u)*l/a+s));t(e,r,f,p,i)}let a=e[r],u=n,c=o;for(t3(e,n,r),i(e[o],a)>0&&t3(e,n,o);ui(e[u],a);)++u;for(;i(e[c],a)>0;)--c}0===i(e[n],a)?t3(e,n,c):t3(e,++c,o),c<=r&&(n=c+1),r<=c&&(o=c-1)}return e})(t,i).subarray(0,i+1));return a+(t5(t.subarray(i+1))-a)*(o-i)}})(e,n/t))},n.copy=function(){return t(r).domain(e)},tj.O.apply(n,arguments)}},scaleSequentialSqrt:function(){return rK},scaleSequentialSymlog:function(){return function t(){var e=tH(rX());return e.copy=function(){return rG(e,t()).constant(e.constant())},tj.O.apply(e,arguments)}},scaleSqrt:function(){return t0},scaleSymlog:function(){return function t(){var e=tH(tw());return e.copy=function(){return tx(e,t()).constant(e.constant())},tj.o.apply(e,arguments)}},scaleThreshold:function(){return function t(){var e,r=[.5],n=[0,1],o=1;function i(t){return null!=t&&t<=t?n[P(r,t,0,o)]:e}return i.domain=function(t){return arguments.length?(o=Math.min((r=Array.from(t)).length,n.length-1),i):r.slice()},i.range=function(t){return arguments.length?(n=Array.from(t),o=Math.min(r.length,n.length-1),i):n.slice()},i.invertExtent=function(t){var e=n.indexOf(t);return[r[e-1],r[e]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t().domain(r).range(n).unknown(e)},tj.o.apply(i,arguments)}},scaleTime:function(){return rY},scaleUtc:function(){return rH},tickFormat:function(){return tD}});var f=r(55284);let p=Math.sqrt(50),h=Math.sqrt(10),d=Math.sqrt(2);function y(t,e,r){let n,o,i;let a=(e-t)/Math.max(0,r),u=Math.floor(Math.log10(a)),c=a/Math.pow(10,u),l=c>=p?10:c>=h?5:c>=d?2:1;return(u<0?(n=Math.round(t*(i=Math.pow(10,-u)/l)),o=Math.round(e*i),n/ie&&--o,i=-i):(n=Math.round(t/(i=Math.pow(10,u)*l)),o=Math.round(e/i),n*ie&&--o),o0))return[];if(t===e)return[t];let n=e=o))return[];let u=i-o+1,c=Array(u);if(n){if(a<0)for(let t=0;te?1:t>=e?0:NaN}function x(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function w(t){let e,r,n;function o(t,n,o=0,i=t.length){if(o>>1;0>r(t[e],n)?o=e+1:i=e}while(og(t(e),r),n=(e,r)=>t(e)-r):(e=t===g||t===x?t:O,r=t,n=t),{left:o,center:function(t,e,r=0,i=t.length){let a=o(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,o=0,i=t.length){if(o>>1;0>=r(t[e],n)?o=e+1:i=e}while(o>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Z(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Z(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=N.exec(t))?new Y(e[1],e[2],e[3],1):(e=D.exec(t))?new Y(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=I.exec(t))?Z(e[1],e[2],e[3],e[4]):(e=L.exec(t))?Z(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=B.exec(t))?Q(e[1],e[2]/100,e[3]/100,1):(e=R.exec(t))?Q(e[1],e[2]/100,e[3]/100,e[4]):z.hasOwnProperty(t)?q(z[t]):"transparent"===t?new Y(NaN,NaN,NaN,0):null}function q(t){return new Y(t>>16&255,t>>8&255,255&t,1)}function Z(t,e,r,n){return n<=0&&(t=e=r=NaN),new Y(t,e,r,n)}function W(t,e,r,n){var o;return 1==arguments.length?((o=t)instanceof A||(o=$(o)),o)?new Y((o=o.rgb()).r,o.g,o.b,o.opacity):new Y:new Y(t,e,r,null==n?1:n)}function Y(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function H(){return`#${K(this.r)}${K(this.g)}${K(this.b)}`}function X(){let t=G(this.opacity);return`${1===t?"rgb(":"rgba("}${V(this.r)}, ${V(this.g)}, ${V(this.b)}${1===t?")":`, ${t})`}`}function G(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function V(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function K(t){return((t=V(t))<16?"0":"")+t.toString(16)}function Q(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tt(t,e,r,n)}function J(t){if(t instanceof tt)return new tt(t.h,t.s,t.l,t.opacity);if(t instanceof A||(t=$(t)),!t)return new tt;if(t instanceof tt)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,u=i-o,c=(i+o)/2;return u?(a=e===i?(r-n)/u+(r0&&c<1?0:a,new tt(a,u,c,t.opacity)}function tt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function te(t){return(t=(t||0)%360)<0?t+360:t}function tr(t){return Math.max(0,Math.min(1,t||0))}function tn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function to(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}E(A,$,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:U,formatHex:U,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return J(this).formatHsl()},formatRgb:F,toString:F}),E(Y,W,k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Y(V(this.r),V(this.g),V(this.b),G(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:H,formatHex:H,formatHex8:function(){return`#${K(this.r)}${K(this.g)}${K(this.b)}${K((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:X,toString:X})),E(tt,function(t,e,r,n){return 1==arguments.length?J(t):new tt(t,e,r,null==n?1:n)},k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Y(tn(t>=240?t-240:t+120,o,n),tn(t,o,n),tn(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new tt(te(this.h),tr(this.s),tr(this.l),G(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=G(this.opacity);return`${1===t?"hsl(":"hsla("}${te(this.h)}, ${100*tr(this.s)}%, ${100*tr(this.l)}%${1===t?")":`, ${t})`}`}}));var ti=t=>()=>t;function ta(t,e){var r=e-t;return r?function(e){return t+e*r}:ti(isNaN(t)?e:t)}var tu=function t(e){var r,n=1==(r=+(r=e))?ta:function(t,e){var n,o,i;return e-t?(n=t,o=e,n=Math.pow(n,i=r),o=Math.pow(o,i)-n,i=1/i,function(t){return Math.pow(n+t*o,i)}):ti(isNaN(t)?e:t)};function o(t,e){var r=n((t=W(t)).r,(e=W(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=ta(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function tc(t){return function(e){var r,n,o=e.length,i=Array(o),a=Array(o),u=Array(o);for(r=0;r=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,u=nu&&(a=e.slice(u,a),l[c]?l[c]+=a:l[++c]=a),(o=o[0])===(i=i[0])?l[c]?l[c]+=i:l[++c]=i:(l[++c]=null,s.push({i:c,x:tl(o,i)})),u=tf.lastIndex;return ue&&(r=t,t=e,e=r),l=function(r){return Math.max(t,Math.min(e,r))}),n=c>2?tg:tb,o=i=null,f}function f(e){return null==e||isNaN(e=+e)?r:(o||(o=n(a.map(t),u,c)))(t(l(e)))}return f.invert=function(r){return l(e((i||(i=n(u,a.map(t),tl)))(r)))},f.domain=function(t){return arguments.length?(a=Array.from(t,td),s()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),c=th,s()},f.clamp=function(t){return arguments.length?(l=!!t||tv,s()):l!==tv},f.interpolate=function(t){return arguments.length?(c=t,s()):c},f.unknown=function(t){return arguments.length?(r=t,f):r},function(r,n){return t=r,e=n,s()}}function tO(){return tw()(tv,tv)}var tj=r(89999),tS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tP(t){var e;if(!(e=tS.exec(t)))throw Error("invalid format: "+t);return new tE({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function tE(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function tk(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function tA(t){return(t=tk(Math.abs(t)))?t[1]:NaN}function tM(t,e){var r=tk(t,e);if(!r)return t+"";var n=r[0],o=r[1];return o<0?"0."+Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+Array(o-n.length+2).join("0")}tP.prototype=tE.prototype,tE.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var t_={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>tM(100*t,e),r:tM,s:function(t,e){var r=tk(t,e);if(!r)return t+"";var o=r[0],i=r[1],a=i-(n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=o.length;return a===u?o:a>u?o+Array(a-u+1).join("0"):a>0?o.slice(0,a)+"."+o.slice(a):"0."+Array(1-a).join("0")+tk(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tT(t){return t}var tC=Array.prototype.map,tN=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function tD(t,e,r,n){var o,u,c=b(t,e,r);switch((n=tP(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(u=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tA(l)/3)))-tA(Math.abs(c))))||(n.precision=u),a(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(u=Math.max(0,tA(Math.abs(Math.max(Math.abs(t),Math.abs(e)))-(o=Math.abs(o=c)))-tA(o))+1)||(n.precision=u-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(u=Math.max(0,-tA(Math.abs(c))))||(n.precision=u-("%"===n.type)*2)}return i(n)}function tI(t){var e=t.domain;return t.ticks=function(t){var r=e();return v(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return tD(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,o,i=e(),a=0,u=i.length-1,c=i[a],l=i[u],s=10;for(l0;){if((o=m(c,l,r))===n)return i[a]=c,i[u]=l,e(i);if(o>0)c=Math.floor(c/o)*o,l=Math.ceil(l/o)*o;else if(o<0)c=Math.ceil(c*o)/o,l=Math.floor(l*o)/o;else break;n=o}return t},t}function tL(){var t=tO();return t.copy=function(){return tx(t,tL())},tj.o.apply(t,arguments),tI(t)}function tB(t,e){t=t.slice();var r,n=0,o=t.length-1,i=t[n],a=t[o];return a-t(-e,r)}function tZ(t){let e,r;let n=t(tR,tz),o=n.domain,a=10;function u(){var i,u;return e=(i=a)===Math.E?Math.log:10===i&&Math.log10||2===i&&Math.log2||(i=Math.log(i),t=>Math.log(t)/i),r=10===(u=a)?t$:u===Math.E?Math.exp:t=>Math.pow(u,t),o()[0]<0?(e=tq(e),r=tq(r),t(tU,tF)):t(tR,tz),n}return n.base=function(t){return arguments.length?(a=+t,u()):a},n.domain=function(t){return arguments.length?(o(t),u()):o()},n.ticks=t=>{let n,i;let u=o(),c=u[0],l=u[u.length-1],s=l0){for(;f<=p;++f)for(n=1;nl)break;d.push(i)}}else for(;f<=p;++f)for(n=a-1;n>=1;--n)if(!((i=f>0?n/r(-f):n*r(f))l)break;d.push(i)}2*d.length{if(null==t&&(t=10),null==o&&(o=10===a?"s":","),"function"!=typeof o&&(a%1||null!=(o=tP(o)).precision||(o.trim=!0),o=i(o)),t===1/0)return o;let u=Math.max(1,a*t/n.ticks().length);return t=>{let n=t/r(Math.round(e(t)));return n*ao(tB(o(),{floor:t=>r(Math.floor(e(t))),ceil:t=>r(Math.ceil(e(t)))})),n}function tW(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function tY(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function tH(t){var e=1,r=t(tW(1),tY(e));return r.constant=function(r){return arguments.length?t(tW(e=+r),tY(e)):e},tI(r)}i=(o=function(t){var e,r,o,i=void 0===t.grouping||void 0===t.thousands?tT:(e=tC.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var o=t.length,i=[],a=0,u=e[0],c=0;o>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),i.push(t.substring(o-=u,o+u)),!((c+=u+1)>n));)u=e[a=(a+1)%e.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",c=void 0===t.decimal?".":t.decimal+"",l=void 0===t.numerals?tT:(o=tC.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return o[+t]})}),s=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",p=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=tP(t)).fill,r=t.align,o=t.sign,h=t.symbol,d=t.zero,y=t.width,v=t.comma,m=t.precision,b=t.trim,g=t.type;"n"===g?(v=!0,g="g"):t_[g]||(void 0===m&&(m=12),b=!0,g="g"),(d||"0"===e&&"="===r)&&(d=!0,e="0",r="=");var x="$"===h?a:"#"===h&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===h?u:/[%p]/.test(g)?s:"",O=t_[g],j=/[defgprs%]/.test(g);function S(t){var a,u,s,h=x,S=w;if("c"===g)S=O(t)+S,t="";else{var P=(t=+t)<0||1/t<0;if(t=isNaN(t)?p:O(Math.abs(t),m),b&&(t=function(t){e:for(var e,r=t.length,n=1,o=-1;n0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),P&&0==+t&&"+"!==o&&(P=!1),h=(P?"("===o?o:f:"-"===o||"("===o?"":o)+h,S=("s"===g?tN[8+n/3]:"")+S+(P&&"("===o?")":""),j){for(a=-1,u=t.length;++a(s=t.charCodeAt(a))||s>57){S=(46===s?c+t.slice(a+1):t.slice(a))+S,t=t.slice(0,a);break}}}v&&!d&&(t=i(t,1/0));var E=h.length+t.length+S.length,k=E>1)+h+t+S+k.slice(E);break;default:t=k+h+t+S}return l(t)}return m=void 0===m?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),S.toString=function(){return t+""},S}return{format:h,formatPrefix:function(t,e){var r=h(((t=tP(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(tA(e)/3))),o=Math.pow(10,-n),i=tN[8+n/3];return function(t){return r(o*t)+i}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,a=o.formatPrefix;var tX=r(36967);function tG(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function tV(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function tK(t){return t<0?-t*t:t*t}function tQ(t){var e=t(tv,tv),r=1;return e.exponent=function(e){return arguments.length?1==(r=+e)?t(tv,tv):.5===r?t(tV,tK):t(tG(r),tG(1/r)):r},tI(e)}function tJ(){var t=tQ(tw());return t.copy=function(){return tx(t,tJ()).exponent(t.exponent())},tj.o.apply(t,arguments),t}function t0(){return tJ.apply(null,arguments).exponent(.5)}function t1(t){return Math.sign(t)*t*t}function t2(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r=o)&&(r=o)}return r}function t5(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function t6(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function t3(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}let t7=new Date,t8=new Date;function t4(t,e,r,n){function o(e){return t(e=0==arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),o.round=t=>{let e=o(t),r=o.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),o.range=(r,n,i)=>{let a;let u=[];if(r=o.ceil(r),i=null==i?1:Math.floor(i),!(r0))return u;do u.push(a=new Date(+r)),e(r,i),t(r);while(at4(e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)},(t,n)=>{if(t>=t){if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););}}),r&&(o.count=(e,n)=>(t7.setTime(+e),t8.setTime(+n),t(t7),t(t8),Math.floor(r(t7,t8))),o.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?o.filter(n?e=>n(e)%t==0:e=>o.count(0,e)%t==0):o:null),o}let t9=t4(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);t9.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?t4(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):t9:null,t9.range;let et=t4(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+1e3*e)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds());et.range;let ee=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getMinutes());ee.range;let er=t4(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes());er.range;let en=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getHours());en.range;let eo=t4(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours());eo.range;let ei=t4(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1);ei.range;let ea=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1);ea.range;let eu=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5));function ec(t){return t4(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}eu.range;let el=ec(0),es=ec(1),ef=ec(2),ep=ec(3),eh=ec(4),ed=ec(5),ey=ec(6);function ev(t){return t4(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/6048e5)}el.range,es.range,ef.range,ep.range,eh.range,ed.range,ey.range;let em=ev(0),eb=ev(1),eg=ev(2),ex=ev(3),ew=ev(4),eO=ev(5),ej=ev(6);em.range,eb.range,eg.range,ex.range,ew.range,eO.range,ej.range;let eS=t4(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());eS.range;let eP=t4(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());eP.range;let eE=t4(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());eE.every=t=>isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)}):null,eE.range;let ek=t4(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function eA(t,e,r,n,o,i){let a=[[et,1,1e3],[et,5,5e3],[et,15,15e3],[et,30,3e4],[i,1,6e4],[i,5,3e5],[i,15,9e5],[i,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[n,1,864e5],[n,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function u(e,r,n){let o=Math.abs(r-e)/n,i=w(([,,t])=>t).right(a,o);if(i===a.length)return t.every(b(e/31536e6,r/31536e6,n));if(0===i)return t9.every(Math.max(b(e,r,n),1));let[u,c]=a[o/a[i-1][2]isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)}):null,ek.range;let[eM,e_]=eA(ek,eP,em,eu,eo,er),[eT,eC]=eA(eE,eS,el,ei,en,ee);function eN(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function eD(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function eI(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}var eL={"-":"",_:" ",0:"0"},eB=/^\s*\d+/,eR=/^%/,ez=/[\\^$*+?|[\]().{}]/g;function eU(t,e,r){var n=t<0?"-":"",o=(n?-t:t)+"",i=o.length;return n+(i[t.toLowerCase(),e]))}function eZ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function eW(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function eY(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function eH(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function eX(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function eG(t,e,r){var n=eB.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function eV(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function eK(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function eQ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function eJ(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function e0(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function e1(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function e2(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function e5(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function e6(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function e3(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function e7(t,e,r){var n=eB.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function e8(t,e,r){var n=eR.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function e4(t,e,r){var n=eB.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function e9(t,e,r){var n=eB.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function rt(t,e){return eU(t.getDate(),e,2)}function re(t,e){return eU(t.getHours(),e,2)}function rr(t,e){return eU(t.getHours()%12||12,e,2)}function rn(t,e){return eU(1+ei.count(eE(t),t),e,3)}function ro(t,e){return eU(t.getMilliseconds(),e,3)}function ri(t,e){return ro(t,e)+"000"}function ra(t,e){return eU(t.getMonth()+1,e,2)}function ru(t,e){return eU(t.getMinutes(),e,2)}function rc(t,e){return eU(t.getSeconds(),e,2)}function rl(t){var e=t.getDay();return 0===e?7:e}function rs(t,e){return eU(el.count(eE(t)-1,t),e,2)}function rf(t){var e=t.getDay();return e>=4||0===e?eh(t):eh.ceil(t)}function rp(t,e){return t=rf(t),eU(eh.count(eE(t),t)+(4===eE(t).getDay()),e,2)}function rh(t){return t.getDay()}function rd(t,e){return eU(es.count(eE(t)-1,t),e,2)}function ry(t,e){return eU(t.getFullYear()%100,e,2)}function rv(t,e){return eU((t=rf(t)).getFullYear()%100,e,2)}function rm(t,e){return eU(t.getFullYear()%1e4,e,4)}function rb(t,e){var r=t.getDay();return eU((t=r>=4||0===r?eh(t):eh.ceil(t)).getFullYear()%1e4,e,4)}function rg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+eU(e/60|0,"0",2)+eU(e%60,"0",2)}function rx(t,e){return eU(t.getUTCDate(),e,2)}function rw(t,e){return eU(t.getUTCHours(),e,2)}function rO(t,e){return eU(t.getUTCHours()%12||12,e,2)}function rj(t,e){return eU(1+ea.count(ek(t),t),e,3)}function rS(t,e){return eU(t.getUTCMilliseconds(),e,3)}function rP(t,e){return rS(t,e)+"000"}function rE(t,e){return eU(t.getUTCMonth()+1,e,2)}function rk(t,e){return eU(t.getUTCMinutes(),e,2)}function rA(t,e){return eU(t.getUTCSeconds(),e,2)}function rM(t){var e=t.getUTCDay();return 0===e?7:e}function r_(t,e){return eU(em.count(ek(t)-1,t),e,2)}function rT(t){var e=t.getUTCDay();return e>=4||0===e?ew(t):ew.ceil(t)}function rC(t,e){return t=rT(t),eU(ew.count(ek(t),t)+(4===ek(t).getUTCDay()),e,2)}function rN(t){return t.getUTCDay()}function rD(t,e){return eU(eb.count(ek(t)-1,t),e,2)}function rI(t,e){return eU(t.getUTCFullYear()%100,e,2)}function rL(t,e){return eU((t=rT(t)).getUTCFullYear()%100,e,2)}function rB(t,e){return eU(t.getUTCFullYear()%1e4,e,4)}function rR(t,e){var r=t.getUTCDay();return eU((t=r>=4||0===r?ew(t):ew.ceil(t)).getUTCFullYear()%1e4,e,4)}function rz(){return"+0000"}function rU(){return"%"}function rF(t){return+t}function r$(t){return Math.floor(+t/1e3)}function rq(t){return new Date(t)}function rZ(t){return t instanceof Date?+t:+new Date(+t)}function rW(t,e,r,n,o,i,a,u,c,l){var s=tO(),f=s.invert,p=s.domain,h=l(".%L"),d=l(":%S"),y=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),b=l("%b %d"),g=l("%B"),x=l("%Y");function w(t){return(c(t)1)for(var r,n,o,i=1,a=t[e[0]],u=a.length;i=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rF,s:r$,S:rc,u:rl,U:rs,V:rp,w:rh,W:rd,x:null,X:null,y:ry,Y:rm,Z:rg,"%":rU},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:rx,e:rx,f:rP,g:rL,G:rR,H:rw,I:rO,j:rj,L:rS,m:rE,M:rk,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:rF,s:r$,S:rA,u:rM,U:r_,V:rC,w:rN,W:rD,x:null,X:null,y:rI,Y:rB,Z:rz,"%":rU},w={a:function(t,e,r){var n=h.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){var n=f.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){var n=m.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){var n=y.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,r,n){return S(t,e,r,n)},d:e0,e:e0,f:e7,g:eV,G:eG,H:e2,I:e2,j:e1,L:e3,m:eJ,M:e5,p:function(t,e,r){var n=l.exec(e.slice(r));return n?(t.p=s.get(n[0].toLowerCase()),r+n[0].length):-1},q:eQ,Q:e4,s:e9,S:e6,u:eW,U:eY,V:eH,w:eZ,W:eX,x:function(t,e,n){return S(t,r,e,n)},X:function(t,e,r){return S(t,n,e,r)},y:eV,Y:eG,Z:eK,"%":e8};function O(t,e){return function(r){var n,o,i,a=[],u=-1,c=0,l=t.length;for(r instanceof Date||(r=new Date(+r));++u53)return null;"w"in i||(i.w=1),"Z"in i?(n=(o=(n=eD(eI(i.y,0,1))).getUTCDay())>4||0===o?eb.ceil(n):eb(n),n=ea.offset(n,(i.V-1)*7),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=(o=(n=eN(eI(i.y,0,1))).getDay())>4||0===o?es.ceil(n):es(n),n=ei.offset(n,(i.V-1)*7),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?eD(eI(i.y,0,1)).getUTCDay():eN(eI(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,eD(i)):eN(i)}}function S(t,e,r,n){for(var o,i,a=0,u=e.length,c=r.length;a=c)return -1;if(37===(o=e.charCodeAt(a++))){if(!(i=w[(o=e.charAt(a++))in eL?e.charAt(a++):o])||(n=i(t,r,n))<0)return -1}else if(o!=r.charCodeAt(n++))return -1}return n}return g.x=O(r,g),g.X=O(n,g),g.c=O(e,g),x.x=O(r,x),x.X=O(n,x),x.c=O(e,x),{format:function(t){var e=O(t+="",g);return e.toString=function(){return t},e},parse:function(t){var e=j(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=O(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=j(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,u.parse,l=u.utcFormat,u.utcParse;var r2=r(22516),r5=r(76115);function r6(t){for(var e=t.length,r=Array(e);--e>=0;)r[e]=e;return r}function r3(t,e){return t[e]}function r7(t){let e=[];return e.key=t,e}var r8=r(95645),r4=r.n(r8),r9=r(99008),nt=r.n(r9),ne=r(77571),nr=r.n(ne),nn=r(86757),no=r.n(nn),ni=r(42715),na=r.n(ni),nu=r(13735),nc=r.n(nu),nl=r(11314),ns=r.n(nl),nf=r(82559),np=r.n(nf),nh=r(75551),nd=r.n(nh),ny=r(21652),nv=r.n(ny),nm=r(34935),nb=r.n(nm),ng=r(61134),nx=r.n(ng);function nw(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=e?r.apply(void 0,o):t(e-a,nP(function(){for(var t=arguments.length,e=Array(t),n=0;nt.length)&&(e=t.length);for(var r=0,n=Array(e);rn&&(o=n,i=r),[o,i]}function nR(t,e,r){if(t.lte(0))return new(nx())(0);var n=nC.getDigitCount(t.toNumber()),o=new(nx())(10).pow(n),i=t.div(o),a=1!==n?.05:.1,u=new(nx())(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return e?u:new(nx())(Math.ceil(u))}function nz(t,e,r){var n=1,o=new(nx())(t);if(!o.isint()&&r){var i=Math.abs(t);i<1?(n=new(nx())(10).pow(nC.getDigitCount(t)-1),o=new(nx())(Math.floor(o.div(n).toNumber())).mul(n)):i>1&&(o=new(nx())(Math.floor(t)))}else 0===t?o=new(nx())(Math.floor((e-1)/2)):r||(o=new(nx())(Math.floor(t)));var a=Math.floor((e-1)/2);return nM(nA(function(t){return o.add(new(nx())(t-a).mul(n)).toNumber()}),nk)(0,e)}var nU=nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0){var s=l===1/0?[c].concat(nN(nk(0,o-1).map(function(){return 1/0}))):[].concat(nN(nk(0,o-1).map(function(){return-1/0})),[l]);return r>n?n_(s):s}if(c===l)return nz(c,o,i);var f=function t(e,r,n,o){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((r-e)/(n-1)))return{step:new(nx())(0),tickMin:new(nx())(0),tickMax:new(nx())(0)};var u=nR(new(nx())(r).sub(e).div(n-1),o,a),c=Math.ceil((i=e<=0&&r>=0?new(nx())(0):(i=new(nx())(e).add(r).div(2)).sub(new(nx())(i).mod(u))).sub(e).div(u).toNumber()),l=Math.ceil(new(nx())(r).sub(i).div(u).toNumber()),s=c+l+1;return s>n?t(e,r,n,o,a+1):(s0?l+(n-s):l,c=r>0?c:c+(n-s)),{step:u,tickMin:i.sub(new(nx())(c).mul(u)),tickMax:i.add(new(nx())(l).mul(u))})}(c,l,a,i),p=f.step,h=f.tickMin,d=f.tickMax,y=nC.rangeStep(h,d.add(new(nx())(.1).mul(p)),p);return r>n?n_(y):y});nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0)return[r,n];if(c===l)return nz(c,o,i);var s=nR(new(nx())(l).sub(c).div(a-1),i,0),f=nM(nA(function(t){return new(nx())(c).add(new(nx())(t).mul(s)).toNumber()}),nk)(0,a).filter(function(t){return t>=c&&t<=l});return r>n?n_(f):f});var nF=nT(function(t,e){var r=nD(t,2),n=r[0],o=r[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=nD(nB([n,o]),2),u=a[0],c=a[1];if(u===-1/0||c===1/0)return[n,o];if(u===c)return[u];var l=nR(new(nx())(c).sub(u).div(Math.max(e,2)-1),i,0),s=[].concat(nN(nC.rangeStep(new(nx())(u),new(nx())(c).sub(new(nx())(.99).mul(l)),l)),[c]);return n>o?n_(s):s}),n$=r(13137),nq=r(16630),nZ=r(82944),nW=r(38569);function nY(t){return(nY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nH(t){return function(t){if(Array.isArray(t))return nX(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return nX(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nX(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nX(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,a=null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0;if(a<=1)return 0;if(o&&"angleAxis"===o.axisType&&1e-6>=Math.abs(Math.abs(o.range[1]-o.range[0])-360))for(var u=o.range,c=0;c0?n[c-1].coordinate:n[a-1].coordinate,s=n[c].coordinate,f=c>=a-1?n[0].coordinate:n[c+1].coordinate,p=void 0;if((0,nq.uY)(s-l)!==(0,nq.uY)(f-s)){var h=[];if((0,nq.uY)(f-s)===(0,nq.uY)(u[1]-u[0])){p=f;var d=s+u[1]-u[0];h[0]=Math.min(d,(d+l)/2),h[1]=Math.max(d,(d+l)/2)}else{p=l;var y=f+u[1]-u[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(p+s)/2),Math.max(s,(p+s)/2)];if(t>v[0]&&t<=v[1]||t>=h[0]&&t<=h[1]){i=n[c].index;break}}else{var m=Math.min(l,f),b=Math.max(l,f);if(t>(m+s)/2&&t<=(b+s)/2){i=n[c].index;break}}}else for(var g=0;g0&&g(r[g].coordinate+r[g-1].coordinate)/2&&t<=(r[g].coordinate+r[g+1].coordinate)/2||g===a-1&&t>(r[g].coordinate+r[g-1].coordinate)/2){i=r[g].index;break}return i},n1=function(t){var e,r,n=t.type.displayName,o=null!==(e=t.type)&&void 0!==e&&e.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props,i=o.stroke,a=o.fill;switch(n){case"Line":r=i;break;case"Area":case"Radar":r=i&&"none"!==i?i:a;break;default:r=a}return r},n2=function(t){var e=t.barSize,r=t.totalSize,n=t.stackGroups,o=void 0===n?{}:n;if(!o)return{};for(var i={},a=Object.keys(o),u=0,c=a.length;u=0});if(v&&v.length){var m=v[0].type.defaultProps,b=void 0!==m?nV(nV({},m),v[0].props):v[0].props,g=b.barSize,x=b[y];i[x]||(i[x]=[]);var w=nr()(g)?e:g;i[x].push({item:v[0],stackList:v.slice(1),barSize:nr()(w)?void 0:(0,nq.h1)(w,r,0)})}}return i},n5=function(t){var e,r=t.barGap,n=t.barCategoryGap,o=t.bandSize,i=t.sizeList,a=void 0===i?[]:i,u=t.maxBarSize,c=a.length;if(c<1)return null;var l=(0,nq.h1)(r,o,0,!0),s=[];if(a[0].barSize===+a[0].barSize){var f=!1,p=o/c,h=a.reduce(function(t,e){return t+e.barSize||0},0);(h+=(c-1)*l)>=o&&(h-=(c-1)*l,l=0),h>=o&&p>0&&(f=!0,p*=.9,h=c*p);var d={offset:((o-h)/2>>0)-l,size:0};e=a.reduce(function(t,e){var r={item:e.item,position:{offset:d.offset+d.size+l,size:f?p:e.barSize}},n=[].concat(nH(t),[r]);return d=n[n.length-1].position,e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:d})}),n},s)}else{var y=(0,nq.h1)(n,o,0,!0);o-2*y-(c-1)*l<=0&&(l=0);var v=(o-2*y-(c-1)*l)/c;v>1&&(v>>=0);var m=u===+u?Math.min(v,u):v;e=a.reduce(function(t,e,r){var n=[].concat(nH(t),[{item:e.item,position:{offset:y+(v+l)*r+(v-m)/2,size:m}}]);return e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:n[n.length-1].position})}),n},s)}return e},n6=function(t,e,r,n){var o=r.children,i=r.width,a=r.margin,u=i-(a.left||0)-(a.right||0),c=(0,nW.z)({children:o,legendWidth:u});if(c){var l=n||{},s=l.width,f=l.height,p=c.align,h=c.verticalAlign,d=c.layout;if(("vertical"===d||"horizontal"===d&&"middle"===h)&&"center"!==p&&(0,nq.hj)(t[p]))return nV(nV({},t),{},nK({},p,t[p]+(s||0)));if(("horizontal"===d||"vertical"===d&&"center"===p)&&"middle"!==h&&(0,nq.hj)(t[h]))return nV(nV({},t),{},nK({},h,t[h]+(f||0)))}return t},n3=function(t,e,r,n,o){var i=e.props.children,a=(0,nZ.NN)(i,n$.W).filter(function(t){var e;return e=t.props.direction,!!nr()(o)||("horizontal"===n?"yAxis"===o:"vertical"===n||"x"===e?"xAxis"===o:"y"!==e||"yAxis"===o)});if(a&&a.length){var u=a.map(function(t){return t.props.dataKey});return t.reduce(function(t,e){var n=nQ(e,r);if(nr()(n))return t;var o=Array.isArray(n)?[nt()(n),r4()(n)]:[n,n],i=u.reduce(function(t,r){var n=nQ(e,r,0),i=o[0]-Math.abs(Array.isArray(n)?n[0]:n),a=o[1]+Math.abs(Array.isArray(n)?n[1]:n);return[Math.min(i,t[0]),Math.max(a,t[1])]},[1/0,-1/0]);return[Math.min(i[0],t[0]),Math.max(i[1],t[1])]},[1/0,-1/0])}return null},n7=function(t,e,r,n,o){var i=e.map(function(e){return n3(t,e,r,o,n)}).filter(function(t){return!nr()(t)});return i&&i.length?i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]):null},n8=function(t,e,r,n,o){var i=e.map(function(e){var i=e.props.dataKey;return"number"===r&&i&&n3(t,e,i,n)||nJ(t,i,r,o)});if("number"===r)return i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]);var a={};return i.reduce(function(t,e){for(var r=0,n=e.length;r=2?2*(0,nq.uY)(a[0]-a[1])*c:c,e&&(t.ticks||t.niceTicks))?(t.ticks||t.niceTicks).map(function(t){return{coordinate:n(o?o.indexOf(t):t)+c,value:t,offset:c}}).filter(function(t){return!np()(t.coordinate)}):t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(t,e){return{coordinate:n(t)+c,value:t,index:e,offset:c}}):n.ticks&&!r?n.ticks(t.tickCount).map(function(t){return{coordinate:n(t)+c,value:t,offset:c}}):n.domain().map(function(t,e){return{coordinate:n(t)+c,value:o?o[t]:t,index:e,offset:c}})},oe=new WeakMap,or=function(t,e){if("function"!=typeof e)return t;oe.has(t)||oe.set(t,new WeakMap);var r=oe.get(t);if(r.has(e))return r.get(e);var n=function(){t.apply(void 0,arguments),e.apply(void 0,arguments)};return r.set(e,n),n},on=function(t,e,r){var n=t.scale,o=t.type,i=t.layout,a=t.axisType;if("auto"===n)return"radial"===i&&"radiusAxis"===a?{scale:f.Z(),realScaleType:"band"}:"radial"===i&&"angleAxis"===a?{scale:tL(),realScaleType:"linear"}:"category"===o&&e&&(e.indexOf("LineChart")>=0||e.indexOf("AreaChart")>=0||e.indexOf("ComposedChart")>=0&&!r)?{scale:f.x(),realScaleType:"point"}:"category"===o?{scale:f.Z(),realScaleType:"band"}:{scale:tL(),realScaleType:"linear"};if(na()(n)){var u="scale".concat(nd()(n));return{scale:(s[u]||f.x)(),realScaleType:s[u]?u:"point"}}return no()(n)?{scale:n}:{scale:f.x(),realScaleType:"point"}},oo=function(t){var e=t.domain();if(e&&!(e.length<=2)){var r=e.length,n=t.range(),o=Math.min(n[0],n[1])-1e-4,i=Math.max(n[0],n[1])+1e-4,a=t(e[0]),u=t(e[r-1]);(ai||ui)&&t.domain([e[0],e[r-1]])}},oi=function(t,e){if(!t)return null;for(var r=0,n=t.length;rn)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]=0?(t[a][r][0]=o,t[a][r][1]=o+u,o=t[a][r][1]):(t[a][r][0]=i,t[a][r][1]=i+u,i=t[a][r][1])}},expand:function(t,e){if((n=t.length)>0){for(var r,n,o,i=0,a=t[0].length;i0){for(var r,n=0,o=t[e[0]],i=o.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,o,i=0,a=1;a=0?(t[i][r][0]=o,t[i][r][1]=o+a,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}}},oc=function(t,e,r){var n=e.map(function(t){return t.props.dataKey}),o=ou[r];return(function(){var t=(0,r5.Z)([]),e=r6,r=r1,n=r3;function o(o){var i,a,u=Array.from(t.apply(this,arguments),r7),c=u.length,l=-1;for(let t of o)for(i=0,++l;i=0?0:o<0?o:n}return r[0]},od=function(t,e){var r,n=(null!==(r=t.type)&&void 0!==r&&r.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props).stackId;if((0,nq.P2)(n)){var o=e[n];if(o){var i=o.items.indexOf(t);return i>=0?o.stackedData[i]:null}}return null},oy=function(t,e,r){return Object.keys(t).reduce(function(n,o){var i=t[o].stackedData.reduce(function(t,n){var o=n.slice(e,r+1).reduce(function(t,e){return[nt()(e.concat([t[0]]).filter(nq.hj)),r4()(e.concat([t[1]]).filter(nq.hj))]},[1/0,-1/0]);return[Math.min(t[0],o[0]),Math.max(t[1],o[1])]},[1/0,-1/0]);return[Math.min(i[0],n[0]),Math.max(i[1],n[1])]},[1/0,-1/0]).map(function(t){return t===1/0||t===-1/0?0:t})},ov=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,om=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ob=function(t,e,r){if(no()(t))return t(e,r);if(!Array.isArray(t))return e;var n=[];if((0,nq.hj)(t[0]))n[0]=r?t[0]:Math.min(t[0],e[0]);else if(ov.test(t[0])){var o=+ov.exec(t[0])[1];n[0]=e[0]-o}else no()(t[0])?n[0]=t[0](e[0]):n[0]=e[0];if((0,nq.hj)(t[1]))n[1]=r?t[1]:Math.max(t[1],e[1]);else if(om.test(t[1])){var i=+om.exec(t[1])[1];n[1]=e[1]+i}else no()(t[1])?n[1]=t[1](e[1]):n[1]=e[1];return n},og=function(t,e,r){if(t&&t.scale&&t.scale.bandwidth){var n=t.scale.bandwidth();if(!r||n>0)return n}if(t&&e&&e.length>=2){for(var o=nb()(e,function(t){return t.coordinate}),i=1/0,a=1,u=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||n.x.isSsr)return{width:0,height:0};var o=(Object.keys(e=a({},r)).forEach(function(t){e[t]||delete e[t]}),e),i=JSON.stringify({text:t,copyStyle:o});if(u.widthCache[i])return u.widthCache[i];try{var s=document.getElementById(l);s||((s=document.createElement("span")).setAttribute("id",l),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var f=a(a({},c),o);Object.assign(s.style,f),s.textContent="".concat(t);var p=s.getBoundingClientRect(),h={width:p.width,height:p.height};return u.widthCache[i]=h,++u.cacheCount>2e3&&(u.cacheCount=0,u.widthCache={}),h}catch(t){return{width:0,height:0}}},f=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}}},16630:function(t,e,r){"use strict";r.d(e,{Ap:function(){return S},EL:function(){return g},Kt:function(){return w},P2:function(){return m},Rw:function(){return v},bv:function(){return O},fC:function(){return P},h1:function(){return x},hU:function(){return d},hj:function(){return y},k4:function(){return j},uY:function(){return h}});var n=r(42715),o=r.n(n),i=r(82559),a=r.n(i),u=r(13735),c=r.n(u),l=r(22345),s=r.n(l),f=r(77571),p=r.n(f),h=function(t){return 0===t?0:t>0?1:-1},d=function(t){return o()(t)&&t.indexOf("%")===t.length-1},y=function(t){return s()(t)&&!a()(t)},v=function(t){return p()(t)},m=function(t){return y(t)||o()(t)},b=0,g=function(t){var e=++b;return"".concat(t||"").concat(e)},x=function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!y(t)&&!o()(t))return n;if(d(t)){var u=t.indexOf("%");r=e*parseFloat(t.slice(0,u))/100}else r=+t;return a()(r)&&(r=n),i&&r>e&&(r=e),r},w=function(t){if(!t)return null;var e=Object.keys(t);return e&&e.length?t[e[0]]:null},O=function(t){if(!Array.isArray(t))return!1;for(var e=t.length,r={},n=0;n2?r-2:0),o=2;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(e-(r.top||0)-(r.bottom||0)))/2},b=function(t,e,r,n,i){var a=t.width,u=t.height,s=t.startAngle,f=t.endAngle,y=(0,c.h1)(t.cx,a,a/2),v=(0,c.h1)(t.cy,u,u/2),b=m(a,u,r),g=(0,c.h1)(t.innerRadius,b,0),x=(0,c.h1)(t.outerRadius,b,.8*b);return Object.keys(e).reduce(function(t,r){var a,u=e[r],c=u.domain,m=u.reversed;if(o()(u.range))"angleAxis"===n?a=[s,f]:"radiusAxis"===n&&(a=[g,x]),m&&(a=[a[1],a[0]]);else{var b,w=function(t){if(Array.isArray(t))return t}(b=a=u.range)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(b,2)||function(t,e){if(t){if("string"==typeof t)return d(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,2)}}(b,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();s=w[0],f=w[1]}var O=(0,l.Hq)(u,i),j=O.realScaleType,S=O.scale;S.domain(c).range(a),(0,l.zF)(S);var P=(0,l.g$)(S,p(p({},u),{},{realScaleType:j})),E=p(p(p({},u),P),{},{range:a,radius:x,realScaleType:j,scale:S,cx:y,cy:v,innerRadius:g,outerRadius:x,startAngle:s,endAngle:f});return p(p({},t),{},h({},r,E))},{})},g=function(t,e){var r=t.x,n=t.y;return Math.sqrt(Math.pow(r-e.x,2)+Math.pow(n-e.y,2))},x=function(t,e){var r=t.x,n=t.y,o=e.cx,i=e.cy,a=g({x:r,y:n},{x:o,y:i});if(a<=0)return{radius:a};var u=Math.acos((r-o)/a);return n>i&&(u=2*Math.PI-u),{radius:a,angle:180*u/Math.PI,angleInRadian:u}},w=function(t){var e=t.startAngle,r=t.endAngle,n=Math.min(Math.floor(e/360),Math.floor(r/360));return{startAngle:e-360*n,endAngle:r-360*n}},O=function(t,e){var r,n=x({x:t.x,y:t.y},e),o=n.radius,i=n.angle,a=e.innerRadius,u=e.outerRadius;if(ou)return!1;if(0===o)return!0;var c=w(e),l=c.startAngle,s=c.endAngle,f=i;if(l<=s){for(;f>s;)f-=360;for(;f=l&&f<=s}else{for(;f>l;)f-=360;for(;f=s&&f<=l}return r?p(p({},e),{},{radius:o,angle:f+360*Math.min(Math.floor(e.startAngle/360),Math.floor(e.endAngle/360))}):null},j=function(t){return(0,i.isValidElement)(t)||u()(t)||"boolean"==typeof t?"":t.className}},82944:function(t,e,r){"use strict";r.d(e,{$R:function(){return R},Bh:function(){return B},Gf:function(){return j},L6:function(){return N},NN:function(){return k},TT:function(){return M},eu:function(){return L},jf:function(){return T},rL:function(){return D},sP:function(){return A}});var n=r(13735),o=r.n(n),i=r(77571),a=r.n(i),u=r(42715),c=r.n(u),l=r(86757),s=r.n(l),f=r(28302),p=r.n(f),h=r(2265),d=r(14326),y=r(16630),v=r(46485),m=r(41637),b=["children"],g=["children"];function x(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var O={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},j=function(t){return"string"==typeof t?t:t?t.displayName||t.name||"Component":""},S=null,P=null,E=function t(e){if(e===S&&Array.isArray(P))return P;var r=[];return h.Children.forEach(e,function(e){a()(e)||((0,d.isFragment)(e)?r=r.concat(t(e.props.children)):r.push(e))}),P=r,S=e,r};function k(t,e){var r=[],n=[];return n=Array.isArray(e)?e.map(function(t){return j(t)}):[j(e)],E(t).forEach(function(t){var e=o()(t,"type.displayName")||o()(t,"type.name");-1!==n.indexOf(e)&&r.push(t)}),r}function A(t,e){var r=k(t,e);return r&&r[0]}var M=function(t){if(!t||!t.props)return!1;var e=t.props,r=e.width,n=e.height;return!!(0,y.hj)(r)&&!(r<=0)&&!!(0,y.hj)(n)&&!(n<=0)},_=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],T=function(t){return t&&"object"===w(t)&&"clipDot"in t},C=function(t,e,r,n){var o,i=null!==(o=null===m.ry||void 0===m.ry?void 0:m.ry[n])&&void 0!==o?o:[];return e.startsWith("data-")||!s()(t)&&(n&&i.includes(e)||m.Yh.includes(e))||r&&m.nv.includes(e)},N=function(t,e,r){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var n=t;if((0,h.isValidElement)(t)&&(n=t.props),!p()(n))return null;var o={};return Object.keys(n).forEach(function(t){var i;C(null===(i=n)||void 0===i?void 0:i[t],t,e,r)&&(o[t]=n[t])}),o},D=function t(e,r){if(e===r)return!0;var n=h.Children.count(e);if(n!==h.Children.count(r))return!1;if(0===n)return!0;if(1===n)return I(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var o=0;o=0)r.push(t);else if(t){var i=j(t.type),a=e[i]||{},u=a.handler,l=a.once;if(u&&(!l||!n[i])){var s=u(t,i,o);r.push(s),n[i]=!0}}}),r},B=function(t){var e=t&&t.type;return e&&O[e]?O[e]:null},R=function(t,e){return E(e).indexOf(t)}},46485:function(t,e,r){"use strict";function n(t,e){for(var r in t)if(({}).hasOwnProperty.call(t,r)&&(!({}).hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if(({}).hasOwnProperty.call(e,n)&&!({}).hasOwnProperty.call(t,n))return!1;return!0}r.d(e,{w:function(){return n}})},38569:function(t,e,r){"use strict";r.d(e,{z:function(){return l}});var n=r(22190),o=r(85355),i=r(82944);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e=0))throw Error(`invalid digits: ${t}`);if(e>15)return a;let r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e1e-6){if(Math.abs(f*c-l*s)>1e-6&&i){let h=r-a,d=o-u,y=c*c+l*l,v=Math.sqrt(y),m=Math.sqrt(p),b=i*Math.tan((n-Math.acos((y+p-(h*h+d*d))/(2*v*m)))/2),g=b/m,x=b/v;Math.abs(g-1)>1e-6&&this._append`L${t+g*s},${e+g*f}`,this._append`A${i},${i},0,0,${+(f*h>s*d)},${this._x1=t+x*c},${this._y1=e+x*l}`}else this._append`L${this._x1=t},${this._y1=e}`}}arc(t,e,r,a,u,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw Error(`negative radius: ${r}`);let l=r*Math.cos(a),s=r*Math.sin(a),f=t+l,p=e+s,h=1^c,d=c?a-u:u-a;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-p)>1e-6)&&this._append`L${f},${p}`,r&&(d<0&&(d=d%o+o),d>i?this._append`A${r},${r},0,1,${h},${t-l},${e-s}A${r},${r},0,1,${h},${this._x1=f},${this._y1=p}`:d>1e-6&&this._append`A${r},${r},0,${+(d>=n)},${h},${this._x1=t+r*Math.cos(u)},${this._y1=e+r*Math.sin(u)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{let t=Math.floor(r);if(!(t>=0))throw RangeError(`invalid digits: ${r}`);e=t}return t},()=>new u(e)}u.prototype},59121:function(t,e,r){"use strict";r.d(e,{E:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);return isNaN(e)?(0,o.L)(t,NaN):(e&&r.setDate(r.getDate()+e),r)}},31091:function(t,e,r){"use strict";r.d(e,{z:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);if(isNaN(e))return(0,o.L)(t,NaN);if(!e)return r;let i=r.getDate(),a=(0,o.L)(t,r.getTime());return(a.setMonth(r.getMonth()+e+1,0),i>=a.getDate())?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}},63497:function(t,e,r){"use strict";function n(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}r.d(e,{L:function(){return n}})},99649:function(t,e,r){"use strict";function n(t){let e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new t.constructor(+t):new Date("number"==typeof t||"[object Number]"===e||"string"==typeof t||"[object String]"===e?t:NaN)}r.d(e,{Q:function(){return n}})},69398:function(t,e,r){"use strict";function n(t,e){if(!t)throw Error("Invariant failed")}r.d(e,{Z:function(){return n}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1108-efc69a201349f095.js b/litellm/proxy/_experimental/out/_next/static/chunks/1108-efc69a201349f095.js deleted file mode 100644 index f01d7d1b9c..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1108-efc69a201349f095.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1108],{40278:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var n=r(5853),o=r(7084),i=r(26898),a=r(13241),u=r(1153),c=r(2265),l=r(47625),s=r(93765),f=r(31699),p=r(97059),h=r(62994),d=r(25311),y=(0,s.z)({chartName:"BarChart",GraphicalChild:f.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:p.K},{axisType:"yAxis",AxisComp:h.B}],formatAxisMap:d.t9}),v=r(56940),m=r(26680),b=r(8147),g=r(22190),x=r(65278),w=r(98593),O=r(92666),j=r(32644);let S=c.forwardRef((t,e)=>{let{data:r=[],categories:s=[],index:d,colors:S=i.s,valueFormatter:P=u.Cj,layout:E="horizontal",stack:k=!1,relative:A=!1,startEndOnly:M=!1,animationDuration:_=900,showAnimation:T=!1,showXAxis:C=!0,showYAxis:N=!0,yAxisWidth:D=56,intervalType:I="equidistantPreserveStart",showTooltip:L=!0,showLegend:B=!0,showGridLines:R=!0,autoMinValue:z=!1,minValue:U,maxValue:F,allowDecimals:$=!0,noDataText:q,onValueChange:Z,enableLegendSlider:W=!1,customTooltip:Y,rotateLabelX:H,barCategoryGap:X,tickGap:G=5,xAxisLabel:V,yAxisLabel:K,className:Q,padding:J=C||N?{left:20,right:20}:{left:0,right:0}}=t,tt=(0,n._T)(t,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),[te,tr]=(0,c.useState)(60),tn=(0,j.me)(s,S),[to,ti]=c.useState(void 0),[ta,tu]=(0,c.useState)(void 0),tc=!!Z;function tl(t,e,r){var n,o,i,a;r.stopPropagation(),Z&&((0,j.vZ)(to,Object.assign(Object.assign({},t.payload),{value:t.value}))?(tu(void 0),ti(void 0),null==Z||Z(null)):(tu(null===(o=null===(n=t.tooltipPayload)||void 0===n?void 0:n[0])||void 0===o?void 0:o.dataKey),ti(Object.assign(Object.assign({},t.payload),{value:t.value})),null==Z||Z(Object.assign({eventType:"bar",categoryClicked:null===(a=null===(i=t.tooltipPayload)||void 0===i?void 0:i[0])||void 0===a?void 0:a.dataKey},t.payload))))}let ts=(0,j.i4)(z,U,F);return c.createElement("div",Object.assign({ref:e,className:(0,a.q)("w-full h-80",Q)},tt),c.createElement(l.h,{className:"h-full w-full"},(null==r?void 0:r.length)?c.createElement(y,{barCategoryGap:X,data:r,stackOffset:k?"sign":A?"expand":"none",layout:"vertical"===E?"vertical":"horizontal",onClick:tc&&(ta||to)?()=>{ti(void 0),tu(void 0),null==Z||Z(null)}:void 0,margin:{bottom:V?30:void 0,left:K?20:void 0,right:K?5:void 0,top:5}},R?c.createElement(v.q,{className:(0,a.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:"vertical"!==E,vertical:"vertical"===E}):null,"vertical"!==E?c.createElement(p.K,{padding:J,hide:!C,dataKey:d,interval:M?"preserveStartEnd":I,tick:{transform:"translate(0, 6)"},ticks:M?[r[0][d],r[r.length-1][d]]:void 0,fill:"",stroke:"",className:(0,a.q)("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight,minTickGap:G},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)):c.createElement(p.K,{hide:!C,type:"number",tick:{transform:"translate(-3, 0)"},domain:ts,fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:P,minTickGap:G,allowDecimals:$,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),"vertical"!==E?c.createElement(h.B,{width:D,hide:!N,axisLine:!1,tickLine:!1,type:"number",domain:ts,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:A?t=>"".concat((100*t).toString()," %"):P,allowDecimals:$},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)):c.createElement(h.B,{width:D,hide:!N,dataKey:d,axisLine:!1,tickLine:!1,ticks:M?[r[0][d],r[r.length-1][d]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),c.createElement(b.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:L?t=>{let{active:e,payload:r,label:n}=t;return Y?c.createElement(Y,{payload:null==r?void 0:r.map(t=>{var e;return Object.assign(Object.assign({},t),{color:null!==(e=tn.get(t.dataKey))&&void 0!==e?e:o.fr.Gray})}),active:e,label:n}):c.createElement(w.ZP,{active:e,payload:r,label:n,valueFormatter:P,categoryColors:tn})}:c.createElement(c.Fragment,null),position:{y:0}}),B?c.createElement(g.D,{verticalAlign:"top",height:te,content:t=>{let{payload:e}=t;return(0,x.Z)({payload:e},tn,tr,ta,tc?t=>{tc&&(t!==ta||to?(tu(t),null==Z||Z({eventType:"category",categoryClicked:t})):(tu(void 0),null==Z||Z(null)),ti(void 0))}:void 0,W)}}):null,s.map(t=>{var e;return c.createElement(f.$,{className:(0,a.q)((0,u.bM)(null!==(e=tn.get(t))&&void 0!==e?e:o.fr.Gray,i.K.background).fillColor,Z?"cursor-pointer":""),key:t,name:t,type:"linear",stackId:k||A?"a":void 0,dataKey:t,fill:"",isAnimationActive:T,animationDuration:_,shape:t=>((t,e,r,n)=>{let{fillOpacity:o,name:i,payload:a,value:u}=t,{x:l,width:s,y:f,height:p}=t;return"horizontal"===n&&p<0?(f+=p,p=Math.abs(p)):"vertical"===n&&s<0&&(l+=s,s=Math.abs(s)),c.createElement("rect",{x:l,y:f,width:s,height:p,opacity:e||r&&r!==i?(0,j.vZ)(e,Object.assign(Object.assign({},a),{value:u}))?o:.3:o})})(t,to,ta,E),onClick:tl})})):c.createElement(O.Z,{noDataText:q})))});S.displayName="BarChart"},65278:function(t,e,r){"use strict";r.d(e,{Z:function(){return y}});var n=r(2265);let o=t=>{n.useEffect(()=>{let e=()=>{t()};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t])};var i=r(5853),a=r(26898),u=r(13241),c=r(1153);let l=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},s=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},f=(0,c.fn)("Legend"),p=t=>{let{name:e,color:r,onClick:o,activeLegend:i}=t,l=!!o;return n.createElement("li",{className:(0,u.q)(f("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",l?"cursor-pointer":"cursor-default","text-tremor-content",l?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",l?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:t=>{t.stopPropagation(),null==o||o(e,r)}},n.createElement("svg",{className:(0,u.q)("flex-none h-2 w-2 mr-1.5",(0,c.bM)(r,a.K.text).textColor,i&&i!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},n.createElement("circle",{cx:4,cy:4,r:4})),n.createElement("p",{className:(0,u.q)("whitespace-nowrap truncate text-tremor-default","text-tremor-content",l?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",i&&i!==e?"opacity-40":"opacity-100",l?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},h=t=>{let{icon:e,onClick:r,disabled:o}=t,[i,a]=n.useState(!1),c=n.useRef(null);return n.useEffect(()=>(i?c.current=setInterval(()=>{null==r||r()},300):clearInterval(c.current),()=>clearInterval(c.current)),[i,r]),(0,n.useEffect)(()=>{o&&(clearInterval(c.current),a(!1))},[o]),n.createElement("button",{type:"button",className:(0,u.q)(f("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",o?"cursor-not-allowed":"cursor-pointer",o?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",o?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:o,onClick:t=>{t.stopPropagation(),null==r||r()},onMouseDown:t=>{t.stopPropagation(),a(!0)},onMouseUp:t=>{t.stopPropagation(),a(!1)}},n.createElement(e,{className:"w-full"}))},d=n.forwardRef((t,e)=>{let{categories:r,colors:o=a.s,className:c,onClickLegendItem:d,activeLegend:y,enableLegendSlider:v=!1}=t,m=(0,i._T)(t,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),b=n.useRef(null),g=n.useRef(null),[x,w]=n.useState(null),[O,j]=n.useState(null),S=n.useRef(null),P=(0,n.useCallback)(()=>{let t=null==b?void 0:b.current;t&&w({left:t.scrollLeft>0,right:t.scrollWidth-t.clientWidth>t.scrollLeft})},[w]),E=(0,n.useCallback)(t=>{var e,r;let n=null==b?void 0:b.current,o=null==g?void 0:g.current,i=null!==(e=null==n?void 0:n.clientWidth)&&void 0!==e?e:0,a=null!==(r=null==o?void 0:o.clientWidth)&&void 0!==r?r:0;n&&v&&(n.scrollTo({left:"left"===t?n.scrollLeft-i+a:n.scrollLeft+i-a,behavior:"smooth"}),setTimeout(()=>{P()},400))},[v,P]);n.useEffect(()=>{let t=t=>{"ArrowLeft"===t?E("left"):"ArrowRight"===t&&E("right")};return O?(t(O),S.current=setInterval(()=>{t(O)},300)):clearInterval(S.current),()=>clearInterval(S.current)},[O,E]);let k=t=>{t.stopPropagation(),"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),j(t.key))},A=t=>{t.stopPropagation(),j(null)};return n.useEffect(()=>{let t=null==b?void 0:b.current;return v&&(P(),null==t||t.addEventListener("keydown",k),null==t||t.addEventListener("keyup",A)),()=>{null==t||t.removeEventListener("keydown",k),null==t||t.removeEventListener("keyup",A)}},[P,v]),n.createElement("ol",Object.assign({ref:e,className:(0,u.q)(f("root"),"relative overflow-hidden",c)},m),n.createElement("div",{ref:b,tabIndex:0,className:(0,u.q)("h-full flex",v?(null==x?void 0:x.right)||(null==x?void 0:x.left)?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((t,e)=>n.createElement(p,{key:"item-".concat(e),name:t,color:o[e%o.length],onClick:d,activeLegend:y}))),v&&((null==x?void 0:x.right)||(null==x?void 0:x.left))?n.createElement(n.Fragment,null,n.createElement("div",{className:(0,u.q)("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:g},n.createElement(h,{icon:l,onClick:()=>{j(null),E("left")},disabled:!(null==x?void 0:x.left)}),n.createElement(h,{icon:s,onClick:()=>{j(null),E("right")},disabled:!(null==x?void 0:x.right)}))):null)});d.displayName="Legend";let y=(t,e,r,i,a,u)=>{let{payload:c}=t,l=(0,n.useRef)(null);o(()=>{var t,e;r((e=null===(t=l.current)||void 0===t?void 0:t.clientHeight)?Number(e)+20:60)});let s=c.filter(t=>"none"!==t.type);return n.createElement("div",{ref:l,className:"flex items-center justify-end"},n.createElement(d,{categories:s.map(t=>t.value),colors:s.map(t=>e.get(t.value)),onClickLegendItem:a,activeLegend:i,enableLegendSlider:u}))}},98593:function(t,e,r){"use strict";r.d(e,{$B:function(){return c},ZP:function(){return s},zX:function(){return l}});var n=r(2265),o=r(7084),i=r(26898),a=r(13241),u=r(1153);let c=t=>{let{children:e}=t;return n.createElement("div",{className:(0,a.q)("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e)},l=t=>{let{value:e,name:r,color:o}=t;return n.createElement("div",{className:"flex items-center justify-between space-x-8"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("span",{className:(0,a.q)("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",(0,u.bM)(o,i.K.background).bgColor)}),n.createElement("p",{className:(0,a.q)("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},r)),n.createElement("p",{className:(0,a.q)("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e))},s=t=>{let{active:e,payload:r,label:i,categoryColors:u,valueFormatter:s}=t;if(e&&r){let t=r.filter(t=>"none"!==t.type);return n.createElement(c,null,n.createElement("div",{className:(0,a.q)("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},n.createElement("p",{className:(0,a.q)("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},i)),n.createElement("div",{className:(0,a.q)("px-4 py-2 space-y-1")},t.map((t,e)=>{var r;let{value:i,name:a}=t;return n.createElement(l,{key:"id-".concat(e),value:s(i),name:a,color:null!==(r=u.get(a))&&void 0!==r?r:o.fr.Blue})})))}return null}},92666:function(t,e,r){"use strict";r.d(e,{Z:function(){return i}});var n=r(13241),o=r(2265);let i=t=>{let{className:e,noDataText:r="No data"}=t;return o.createElement("div",{className:(0,n.q)("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},o.createElement("p",{className:(0,n.q)("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},r))}},32644:function(t,e,r){"use strict";r.d(e,{FB:function(){return i},i4:function(){return o},me:function(){return n},vZ:function(){return function t(e,r){if(e===r)return!0;if("object"!=typeof e||"object"!=typeof r||null===e||null===r)return!1;let n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(let i of n)if(!o.includes(i)||!t(e[i],r[i]))return!1;return!0}}});let n=(t,e)=>{let r=new Map;return t.forEach((t,n)=>{r.set(t,e[n%e.length])}),r},o=(t,e,r)=>[t?"auto":null!=e?e:0,null!=r?r:"auto"];function i(t,e){let r=[];for(let n of t)if(Object.prototype.hasOwnProperty.call(n,e)&&(r.push(n[e]),r.length>1))return!1;return!0}},49804:function(t,e,r){"use strict";r.d(e,{Z:function(){return l}});var n=r(5853),o=r(13241),i=r(1153),a=r(2265),u=r(9496);let c=(0,i.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:s,children:f,className:p}=t,h=(0,n._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),d=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,o.q)(c("root"),(()=>{let t=d(r,u.PT),e=d(i,u.SP),n=d(l,u.VS),a=d(s,u._w);return(0,o.q)(t,e,n,a)})(),p)},h),f)});l.displayName="Col"},97765:function(t,e,r){"use strict";r.d(e,{Z:function(){return c}});var n=r(5853),o=r(26898),i=r(13241),a=r(1153),u=r(2265);let c=u.forwardRef((t,e)=>{let{color:r,children:c,className:l}=t,s=(0,n._T)(t,["color","children","className"]);return u.createElement("p",Object.assign({ref:e,className:(0,i.q)(r?(0,a.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",l)},s),c)});c.displayName="Subtitle"},61134:function(t,e,r){var n;!function(o){"use strict";var i,a={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},u=!0,c="[DecimalError] ",l=c+"Invalid argument: ",s=c+"Exponent out of range: ",f=Math.floor,p=Math.pow,h=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=f(1286742750677284.5),y={};function v(t,e){var r,n,o,i,a,c,l,s,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s||(e=new f(t)),u?E(e,p):e;if(l=t.d,s=e.d,a=t.e,o=e.e,l=l.slice(),i=a-o){for(i<0?(n=l,i=-i,c=s.length):(n=s,o=a,c=l.length),i>(c=(a=Math.ceil(p/7))>c?a+1:c+1)&&(i=c,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((c=l.length)-(i=s.length)<0&&(i=c,n=s,s=l,l=n),r=0;i;)r=(l[--i]=l[i]+s[i]+r)/1e7|0,l[i]%=1e7;for(r&&(l.unshift(r),++o),c=l.length;0==l[--c];)l.pop();return e.d=l,e.e=o,u?E(e,p):e}function m(t,e,r){if(t!==~~t||tr)throw Error(l+t)}function b(t){var e,r,n,o=t.length-1,i="",a=t[0];if(o>0){for(i+=a,e=1;et.e^this.s<0?1:-1;for(e=0,r=(n=this.d.length)<(o=t.d.length)?n:o;et.d[e]^this.s<0?1:-1;return n===o?0:n>o^this.s<0?1:-1},y.decimalPlaces=y.dp=function(){var t=this.d.length-1,e=(t-this.e)*7;if(t=this.d[t])for(;t%10==0;t/=10)e--;return e<0?0:e},y.dividedBy=y.div=function(t){return g(this,new this.constructor(t))},y.dividedToIntegerBy=y.idiv=function(t){var e=this.constructor;return E(g(this,new e(t),0,1),e.precision)},y.equals=y.eq=function(t){return!this.cmp(t)},y.exponent=function(){return w(this)},y.greaterThan=y.gt=function(t){return this.cmp(t)>0},y.greaterThanOrEqualTo=y.gte=function(t){return this.cmp(t)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return 0===this.s},y.lessThan=y.lt=function(t){return 0>this.cmp(t)},y.lessThanOrEqualTo=y.lte=function(t){return 1>this.cmp(t)},y.logarithm=y.log=function(t){var e,r=this.constructor,n=r.precision,o=n+5;if(void 0===t)t=new r(10);else if((t=new r(t)).s<1||t.eq(i))throw Error(c+"NaN");if(this.s<1)throw Error(c+(this.s?"NaN":"-Infinity"));return this.eq(i)?new r(0):(u=!1,e=g(S(this,o),S(t,o),o),u=!0,E(e,n))},y.minus=y.sub=function(t){return t=new this.constructor(t),this.s==t.s?k(this,t):v(this,(t.s=-t.s,t))},y.modulo=y.mod=function(t){var e,r=this.constructor,n=r.precision;if(!(t=new r(t)).s)throw Error(c+"NaN");return this.s?(u=!1,e=g(this,t,0,1).times(t),u=!0,this.minus(e)):E(new r(this),n)},y.naturalExponential=y.exp=function(){return x(this)},y.naturalLogarithm=y.ln=function(){return S(this)},y.negated=y.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},y.plus=y.add=function(t){return t=new this.constructor(t),this.s==t.s?v(this,t):k(this,(t.s=-t.s,t))},y.precision=y.sd=function(t){var e,r,n;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(l+t);if(e=w(this)+1,r=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)r--;for(n=this.d[0];n>=10;n/=10)r++}return t&&e>r?e:r},y.squareRoot=y.sqrt=function(){var t,e,r,n,o,i,a,l=this.constructor;if(this.s<1){if(!this.s)return new l(0);throw Error(c+"NaN")}for(t=w(this),u=!1,0==(o=Math.sqrt(+this))||o==1/0?(((e=b(this.d)).length+t)%2==0&&(e+="0"),o=Math.sqrt(e),t=f((t+1)/2)-(t<0||t%2),n=new l(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)):n=new l(o.toString()),o=a=(r=l.precision)+3;;)if(n=(i=n).plus(g(this,i,a+2)).times(.5),b(i.d).slice(0,a)===(e=b(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),o==a&&"4999"==e){if(E(i,r+1,0),i.times(i).eq(this)){n=i;break}}else if("9999"!=e)break;a+=4}return u=!0,E(n,r)},y.times=y.mul=function(t){var e,r,n,o,i,a,c,l,s,f=this.constructor,p=this.d,h=(t=new f(t)).d;if(!this.s||!t.s)return new f(0);for(t.s*=this.s,r=this.e+t.e,(l=p.length)<(s=h.length)&&(i=p,p=h,h=i,a=l,l=s,s=a),i=[],n=a=l+s;n--;)i.push(0);for(n=s;--n>=0;){for(e=0,o=l+n;o>n;)c=i[o]+h[n]*p[o-n-1]+e,i[o--]=c%1e7|0,e=c/1e7|0;i[o]=(i[o]+e)%1e7|0}for(;!i[--a];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,u?E(t,f.precision):t},y.toDecimalPlaces=y.todp=function(t,e){var r=this,n=r.constructor;return(r=new n(r),void 0===t)?r:(m(t,0,1e9),void 0===e?e=n.rounding:m(e,0,8),E(r,t+w(r)+1,e))},y.toExponential=function(t,e){var r,n=this,o=n.constructor;return void 0===t?r=A(n,!0):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A(n=E(new o(n),t+1,e),!0,t+1)),r},y.toFixed=function(t,e){var r,n,o=this.constructor;return void 0===t?A(this):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A((n=E(new o(this),t+w(this)+1,e)).abs(),!1,t+w(n)+1),this.isneg()&&!this.isZero()?"-"+r:r)},y.toInteger=y.toint=function(){var t=this.constructor;return E(new t(this),w(this)+1,t.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(t){var e,r,n,o,a,l,s=this,p=s.constructor,h=+(t=new p(t));if(!t.s)return new p(i);if(!(s=new p(s)).s){if(t.s<1)throw Error(c+"Infinity");return s}if(s.eq(i))return s;if(n=p.precision,t.eq(i))return E(s,n);if(l=(e=t.e)>=(r=t.d.length-1),a=s.s,l){if((r=h<0?-h:h)<=9007199254740991){for(o=new p(i),e=Math.ceil(n/7+4),u=!1;r%2&&M((o=o.times(s)).d,e),0!==(r=f(r/2));)M((s=s.times(s)).d,e);return u=!0,t.s<0?new p(i).div(o):E(o,n)}}else if(a<0)throw Error(c+"NaN");return a=a<0&&1&t.d[Math.max(e,r)]?-1:1,s.s=1,u=!1,o=t.times(S(s,n+12)),u=!0,(o=x(o)).s=a,o},y.toPrecision=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?(r=w(o),n=A(o,r<=i.toExpNeg||r>=i.toExpPos)):(m(t,1,1e9),void 0===e?e=i.rounding:m(e,0,8),r=w(o=E(new i(o),t,e)),n=A(o,t<=r||r<=i.toExpNeg,t)),n},y.toSignificantDigits=y.tosd=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(m(t,1,1e9),void 0===e?e=r.rounding:m(e,0,8)),E(new r(this),t,e)},y.toString=y.valueOf=y.val=y.toJSON=function(){var t=w(this),e=this.constructor;return A(this,t<=e.toExpNeg||t>=e.toExpPos)};var g=function(){function t(t,e){var r,n=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+n,t[o]=r%1e7|0,n=r/1e7|0;return n&&t.unshift(n),t}function e(t,e,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function r(t,e,r){for(var n=0;r--;)t[r]-=n,n=t[r]1;)t.shift()}return function(n,o,i,a){var u,l,s,f,p,h,d,y,v,m,b,g,x,O,j,S,P,k,A=n.constructor,M=n.s==o.s?1:-1,_=n.d,T=o.d;if(!n.s)return new A(n);if(!o.s)throw Error(c+"Division by zero");for(s=0,l=n.e-o.e,P=T.length,j=_.length,y=(d=new A(M)).d=[];T[s]==(_[s]||0);)++s;if(T[s]>(_[s]||0)&&--l,(g=null==i?i=A.precision:a?i+(w(n)-w(o))+1:i)<0)return new A(0);if(g=g/7+2|0,s=0,1==P)for(f=0,T=T[0],g++;(s1&&(T=t(T,f),_=t(_,f),P=T.length,j=_.length),O=P,m=(v=_.slice(0,P)).length;m=1e7/2&&++S;do f=0,(u=e(T,v,P,m))<0?(b=v[0],P!=m&&(b=1e7*b+(v[1]||0)),(f=b/S|0)>1?(f>=1e7&&(f=1e7-1),h=(p=t(T,f)).length,m=v.length,1==(u=e(p,v,h,m))&&(f--,r(p,P16)throw Error(s+w(t));if(!t.s)return new h(i);for(null==e?(u=!1,c=d):c=e,a=new h(.03125);t.abs().gte(.1);)t=t.times(a),f+=5;for(c+=Math.log(p(2,f))/Math.LN10*2+5|0,r=n=o=new h(i),h.precision=c;;){if(n=E(n.times(t),c),r=r.times(++l),b((a=o.plus(g(n,r,c))).d).slice(0,c)===b(o.d).slice(0,c)){for(;f--;)o=E(o.times(o),c);return h.precision=d,null==e?(u=!0,E(o,d)):o}o=a}}function w(t){for(var e=7*t.e,r=t.d[0];r>=10;r/=10)e++;return e}function O(t,e,r){if(e>t.LN10.sd())throw u=!0,r&&(t.precision=r),Error(c+"LN10 precision limit exceeded");return E(new t(t.LN10),e)}function j(t){for(var e="";t--;)e+="0";return e}function S(t,e){var r,n,o,a,l,s,f,p,h,d=1,y=t,v=y.d,m=y.constructor,x=m.precision;if(y.s<1)throw Error(c+(y.s?"NaN":"-Infinity"));if(y.eq(i))return new m(0);if(null==e?(u=!1,p=x):p=e,y.eq(10))return null==e&&(u=!0),O(m,p);if(p+=10,m.precision=p,n=(r=b(v)).charAt(0),!(15e14>Math.abs(a=w(y))))return f=O(m,p+2,x).times(a+""),y=S(new m(n+"."+r.slice(1)),p-10).plus(f),m.precision=x,null==e?(u=!0,E(y,x)):y;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=b((y=y.times(t)).d)).charAt(0),d++;for(a=w(y),n>1?(y=new m("0."+r),a++):y=new m(n+"."+r.slice(1)),s=l=y=g(y.minus(i),y.plus(i),p),h=E(y.times(y),p),o=3;;){if(l=E(l.times(h),p),b((f=s.plus(g(l,new m(o),p))).d).slice(0,p)===b(s.d).slice(0,p))return s=s.times(2),0!==a&&(s=s.plus(O(m,p+2,x).times(a+""))),s=g(s,new m(d),p),m.precision=x,null==e?(u=!0,E(s,x)):s;s=f,o+=2}}function P(t,e){var r,n,o;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);)++n;for(o=e.length;48===e.charCodeAt(o-1);)--o;if(e=e.slice(n,o)){if(o-=n,r=r-n-1,t.e=f(r/7),t.d=[],n=(r+1)%7,r<0&&(n+=7),nd||t.e<-d))throw Error(s+r)}else t.s=0,t.e=0,t.d=[0];return t}function E(t,e,r){var n,o,i,a,c,l,h,y,v=t.d;for(a=1,i=v[0];i>=10;i/=10)a++;if((n=e-a)<0)n+=7,o=e,h=v[y=0];else{if((y=Math.ceil((n+1)/7))>=(i=v.length))return t;for(a=1,h=i=v[y];i>=10;i/=10)a++;n%=7,o=n-7+a}if(void 0!==r&&(c=h/(i=p(10,a-o-1))%10|0,l=e<0||void 0!==v[y+1]||h%i,l=r<4?(c||l)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||l||6==r&&(n>0?o>0?h/p(10,a-o):0:v[y-1])%10&1||r==(t.s<0?8:7))),e<1||!v[0])return l?(i=w(t),v.length=1,e=e-i-1,v[0]=p(10,(7-e%7)%7),t.e=f(-e/7)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(0==n?(v.length=y,i=1,y--):(v.length=y+1,i=p(10,7-n),v[y]=o>0?(h/p(10,a-o)%p(10,o)|0)*i:0),l)for(;;){if(0==y){1e7==(v[0]+=i)&&(v[0]=1,++t.e);break}if(v[y]+=i,1e7!=v[y])break;v[y--]=0,i=1}for(n=v.length;0===v[--n];)v.pop();if(u&&(t.e>d||t.e<-d))throw Error(s+w(t));return t}function k(t,e){var r,n,o,i,a,c,l,s,f,p,h=t.constructor,d=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),u?E(e,d):e;if(l=t.d,p=e.d,n=e.e,s=t.e,l=l.slice(),a=s-n){for((f=a<0)?(r=l,a=-a,c=p.length):(r=p,n=s,c=l.length),a>(o=Math.max(Math.ceil(d/7),c)+2)&&(a=o,r.length=1),r.reverse(),o=a;o--;)r.push(0);r.reverse()}else{for((f=(o=l.length)<(c=p.length))&&(c=o),o=0;o0;--o)l[c++]=0;for(o=p.length;o>a;){if(l[--o]0?i=i.charAt(0)+"."+i.slice(1)+j(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o<0?"e":"e+")+o):o<0?(i="0."+j(-o-1)+i,r&&(n=r-a)>0&&(i+=j(n))):o>=a?(i+=j(o+1-a),r&&(n=r-o-1)>0&&(i=i+"."+j(n))):((n=o+1)0&&(o+1===a&&(i+="."),i+=j(n))),t.s<0?"-"+i:i}function M(t,e){if(t.length>e)return t.length=e,!0}function _(t){if(!t||"object"!=typeof t)throw Error(c+"Object expected");var e,r,n,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e=o[e+1]&&n<=o[e+2])this[r]=n;else throw Error(l+r+": "+n)}if(void 0!==(n=t[r="LN10"])){if(n==Math.LN10)this[r]=new this(n);else throw Error(l+r+": "+n)}return this}(a=function t(e){var r,n,o;function i(t){if(!(this instanceof i))return new i(t);if(this.constructor=i,t instanceof i){this.s=t.s,this.e=t.e,this.d=(t=t.d)?t.slice():t;return}if("number"==typeof t){if(0*t!=0)throw Error(l+t);if(t>0)this.s=1;else if(t<0)t=-t,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(t===~~t&&t<1e7){this.e=0,this.d=[t];return}return P(this,t.toString())}if("string"!=typeof t)throw Error(l+t);if(45===t.charCodeAt(0)?(t=t.slice(1),this.s=-1):this.s=1,h.test(t))P(this,t);else throw Error(l+t)}if(i.prototype=y,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=t,i.config=i.set=_,void 0===e&&(e={}),e)for(r=0,o=["precision","rounding","toExpNeg","toExpPos","LN10"];r-1}},56883:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n0&&i(s)?r>1?t(s,r-1,i,a,u):n(u,s):a||(u[u.length]=s)}return u}},63321:function(t,e,r){var n=r(33023)();t.exports=n},98060:function(t,e,r){var n=r(63321),o=r(43228);t.exports=function(t,e){return t&&n(t,e,o)}},92167:function(t,e,r){var n=r(67906),o=r(70235);t.exports=function(t,e){e=n(e,t);for(var r=0,i=e.length;null!=t&&re}},93012:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},47909:function(t,e,r){var n=r(8235),o=r(31953),i=r(35281);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},90370:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},56318:function(t,e,r){var n=r(6791),o=r(10303);t.exports=function t(e,r,i,a,u){return e===r||(null!=e&&null!=r&&(o(e)||o(r))?n(e,r,i,a,t,u):e!=e&&r!=r)}},6791:function(t,e,r){var n=r(85885),o=r(97638),i=r(88030),a=r(64974),u=r(81690),c=r(25614),l=r(98051),s=r(9792),f="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,y,v,m){var b=c(t),g=c(e),x=b?p:u(t),w=g?p:u(e);x=x==f?h:x,w=w==f?h:w;var O=x==h,j=w==h,S=x==w;if(S&&l(t)){if(!l(e))return!1;b=!0,O=!1}if(S&&!O)return m||(m=new n),b||s(t)?o(t,e,r,y,v,m):i(t,e,x,r,y,v,m);if(!(1&r)){var P=O&&d.call(t,"__wrapped__"),E=j&&d.call(e,"__wrapped__");if(P||E){var k=P?t.value():t,A=E?e.value():e;return m||(m=new n),v(k,A,r,y,m)}}return!!S&&(m||(m=new n),a(t,e,r,y,v,m))}},62538:function(t,e,r){var n=r(85885),o=r(56318);t.exports=function(t,e,r,i){var a=r.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=r[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++ao?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n=200){var y=e?null:u(t);if(y)return c(y);p=!1,s=a,d=new n}else d=e?[]:h;t:for(;++l=o?t:n(t,e,r)}},1536:function(t,e,r){var n=r(78371);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,a=n(t),u=void 0!==e,c=null===e,l=e==e,s=n(e);if(!c&&!s&&!a&&t>e||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&t=c)return l;return l*("desc"==r[o]?-1:1)}}return t.index-e.index}},92077:function(t,e,r){var n=r(74288)["__core-js_shared__"];t.exports=n},97930:function(t,e,r){var n=r(5629);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,a=e?i:-1,u=Object(r);(e?a--:++a-1?u[c?e[l]:l]:void 0}}},35464:function(t,e,r){var n=r(19608),o=r(49639),i=r(175);t.exports=function(t){return function(e,r,a){return a&&"number"!=typeof a&&o(e,r,a)&&(r=a=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),a=void 0===a?es))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++d-1&&t%1==0&&t-1}},13368:function(t,e,r){var n=r(24457);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},38764:function(t,e,r){var n=r(9855),o=r(99078),i=r(88675);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},78615:function(t,e,r){var n=r(1507);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},83391:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).get(t)}},53483:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).has(t)}},74724:function(t,e,r){var n=r(1507);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},22523:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}},47073:function(t){t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},23787:function(t,e,r){var n=r(50967);t.exports=function(t){var e=n(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}},20453:function(t,e,r){var n=r(39866)(Object,"create");t.exports=n},77184:function(t,e,r){var n=r(45070)(Object.keys,Object);t.exports=n},39931:function(t,e,r){t=r.nmd(t);var n=r(17071),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,u=function(){try{var t=i&&i.require&&i.require("util").types;if(t)return t;return a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u},45070:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},49478:function(t,e,r){var n=r(60493),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,u=o(i.length-e,0),c=Array(u);++a0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},84092:function(t,e,r){var n=r(99078);t.exports=function(){this.__data__=new n,this.size=0}},31663:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},69135:function(t){t.exports=function(t){return this.__data__.get(t)}},39552:function(t){t.exports=function(t){return this.__data__.has(t)}},8381:function(t,e,r){var n=r(99078),o=r(88675),i=r(76219);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},35281:function(t){t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n-1&&t%1==0&&t<=9007199254740991}},82559:function(t,e,r){var n=r(22345);t.exports=function(t){return n(t)&&t!=+t}},77571:function(t){t.exports=function(t){return null==t}},22345:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==n(t)}},90231:function(t,e,r){var n=r(54506),o=r(62602),i=r(10303),a=Object.prototype,u=Function.prototype.toString,c=a.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},42715:function(t,e,r){var n=r(54506),o=r(25614),i=r(10303);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},9792:function(t,e,r){var n=r(59332),o=r(23305),i=r(39931),a=i&&i.isTypedArray,u=a?o(a):n;t.exports=u},43228:function(t,e,r){var n=r(28579),o=r(4578),i=r(5629);t.exports=function(t){return i(t)?n(t):o(t)}},86185:function(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},89238:function(t,e,r){var n=r(73819),o=r(88157),i=r(24240),a=r(25614);t.exports=function(t,e){return(a(t)?n:i)(t,o(e,3))}},41443:function(t,e,r){var n=r(83023),o=r(98060),i=r(88157);t.exports=function(t,e){var r={};return e=i(e,3),o(t,function(t,o,i){n(r,o,e(t,o,i))}),r}},95645:function(t,e,r){var n=r(67646),o=r(58905),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},50967:function(t,e,r){var n=r(76219);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},99008:function(t,e,r){var n=r(67646),o=r(20121),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},93810:function(t){t.exports=function(){}},22350:function(t,e,r){var n=r(18155),o=r(73584),i=r(67352),a=r(70235);t.exports=function(t){return i(t)?n(a(t)):o(t)}},99676:function(t,e,r){var n=r(35464)();t.exports=n},33645:function(t,e,r){var n=r(25253),o=r(88157),i=r(12327),a=r(25614),u=r(49639);t.exports=function(t,e,r){var c=a(t)?n:i;return r&&u(t,e,r)&&(e=void 0),c(t,o(e,3))}},34935:function(t,e,r){var n=r(72569),o=r(84046),i=r(44843),a=r(49639),u=i(function(t,e){if(null==t)return[];var r=e.length;return r>1&&a(t,e[0],e[1])?e=[]:r>2&&a(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])});t.exports=u},55716:function(t){t.exports=function(){return[]}},7406:function(t){t.exports=function(){return!1}},37065:function(t,e,r){var n=r(7310),o=r(28302);t.exports=function(t,e,r){var i=!0,a=!0;if("function"!=typeof t)throw TypeError("Expected a function");return o(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),n(t,e,{leading:i,maxWait:e,trailing:a})}},175:function(t,e,r){var n=r(6660),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-o?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0}},85759:function(t,e,r){var n=r(175);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},3641:function(t,e,r){var n=r(65020);t.exports=function(t){return null==t?"":n(t)}},47230:function(t,e,r){var n=r(88157),o=r(13826);t.exports=function(t,e){return t&&t.length?o(t,n(e,2)):[]}},75551:function(t,e,r){var n=r(80675)("toUpperCase");t.exports=n},48049:function(t,e,r){"use strict";var n=r(14397);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,r,o,i,a){if(a!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},40718:function(t,e,r){t.exports=r(48049)()},14397:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},84735:function(t,e,r){"use strict";r.d(e,{ZP:function(){return tS}});var n=r(2265),o=r(40718),i=r.n(o),a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty;function l(t,e){return function(r,n,o){return t(r,n,o)&&e(r,n,o)}}function s(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);var o=n.cache,i=o.get(e),a=o.get(r);if(i&&a)return i===r&&a===e;o.set(e,r),o.set(r,e);var u=t(e,r,n);return o.delete(e),o.delete(r),u}}function f(t){return a(t).concat(u(t))}var p=Object.hasOwn||function(t,e){return c.call(t,e)};function h(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var d=Object.getOwnPropertyDescriptor,y=Object.keys;function v(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return h(t.getTime(),e.getTime())}function b(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function g(t,e){return t===e}function x(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.entries(),c=0;(n=u.next())&&!n.done;){for(var l=e.entries(),s=!1,f=0;(o=l.next())&&!o.done;){if(a[f]){f++;continue}var p=n.value,h=o.value;if(r.equals(p[0],h[0],c,f,t,e,r)&&r.equals(p[1],h[1],p[0],h[0],t,e,r)){s=a[f]=!0;break}f++}if(!s)return!1;c++}return!0}function w(t,e,r){var n=y(t),o=n.length;if(y(e).length!==o)return!1;for(;o-- >0;)if(!A(t,e,r,n[o]))return!1;return!0}function O(t,e,r){var n,o,i,a=f(t),u=a.length;if(f(e).length!==u)return!1;for(;u-- >0;)if(!A(t,e,r,n=a[u])||(o=d(t,n),i=d(e,n),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable)))return!1;return!0}function j(t,e){return h(t.valueOf(),e.valueOf())}function S(t,e){return t.source===e.source&&t.flags===e.flags}function P(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.values();(n=u.next())&&!n.done;){for(var c=e.values(),l=!1,s=0;(o=c.next())&&!o.done;){if(!a[s]&&r.equals(n.value,o.value,n.value,o.value,t,e,r)){l=a[s]=!0;break}s++}if(!l)return!1}return!0}function E(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function k(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function A(t,e,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!t.$$typeof||!!e.$$typeof)||p(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var M=Array.isArray,_="undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView:null,T=Object.assign,C=Object.prototype.toString.call.bind(Object.prototype.toString),N=D();function D(t){void 0===t&&(t={});var e,r,n,o,i,a,u,c,f,p,d,y,A,N,D=t.circular,I=t.createInternalComparator,L=t.createState,B=t.strict,R=(r=(e=function(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?O:v,areDatesEqual:m,areErrorsEqual:b,areFunctionsEqual:g,areMapsEqual:n?l(x,O):x,areNumbersEqual:h,areObjectsEqual:n?O:w,arePrimitiveWrappersEqual:j,areRegExpsEqual:S,areSetsEqual:n?l(P,O):P,areTypedArraysEqual:n?O:E,areUrlsEqual:k,unknownTagComparators:void 0};if(r&&(o=T({},o,r(o))),e){var i=s(o.areArraysEqual),a=s(o.areMapsEqual),u=s(o.areObjectsEqual),c=s(o.areSetsEqual);o=T({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return o}(t)).areArraysEqual,n=e.areDatesEqual,o=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,u=e.areNumbersEqual,c=e.areObjectsEqual,f=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,d=e.areSetsEqual,y=e.areTypedArraysEqual,A=e.areUrlsEqual,N=e.unknownTagComparators,function(t,e,l){if(t===e)return!0;if(null==t||null==e)return!1;var s=typeof t;if(s!==typeof e)return!1;if("object"!==s)return"number"===s?u(t,e,l):"function"===s&&i(t,e,l);var h=t.constructor;if(h!==e.constructor)return!1;if(h===Object)return c(t,e,l);if(M(t))return r(t,e,l);if(null!=_&&_(t))return y(t,e,l);if(h===Date)return n(t,e,l);if(h===RegExp)return p(t,e,l);if(h===Map)return a(t,e,l);if(h===Set)return d(t,e,l);var v=C(t);if("[object Date]"===v)return n(t,e,l);if("[object RegExp]"===v)return p(t,e,l);if("[object Map]"===v)return a(t,e,l);if("[object Set]"===v)return d(t,e,l);if("[object Object]"===v)return"function"!=typeof t.then&&"function"!=typeof e.then&&c(t,e,l);if("[object URL]"===v)return A(t,e,l);if("[object Error]"===v)return o(t,e,l);if("[object Arguments]"===v)return c(t,e,l);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return f(t,e,l);if(N){var m=N[v];if(!m){var b=null!=t?t[Symbol.toStringTag]:void 0;b&&(m=N[b])}if(m)return m(t,e,l)}return!1}),z=I?I(R):function(t,e,r,n,o,i,a){return R(t,e,a)};return function(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,i=t.strict;if(n)return function(t,a){var u=n(),c=u.cache;return r(t,a,{cache:void 0===c?e?new WeakMap:void 0:c,equals:o,meta:u.meta,strict:i})};if(e)return function(t,e){return r(t,e,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(t,e){return r(t,e,a)}}({circular:void 0!==D&&D,comparator:R,createState:L,equals:z,strict:void 0!==B&&B})}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1;requestAnimationFrame(function n(o){if(r<0&&(r=o),o-r>e)t(o),r=-1;else{var i;i=n,"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(i)}})}function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0&&t<=1}),"[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s",n);var p=V(i,u),h=V(a,c),d=(t=i,e=u,function(r){var n;return G([].concat(function(t){if(Array.isArray(t))return H(t)}(n=X(t,e).map(function(t,e){return t*e}).slice(1))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Y(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[0]),r)}),y=function(t){for(var e=t>1?1:t,r=e,n=0;n<8;++n){var o,i=p(r)-e,a=d(r);if(1e-4>Math.abs(i-e)||a<1e-4)break;r=(o=r-i/a)>1?1:o<0?0:o}return h(r)};return y.isStepper=!1,y},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.stiff,r=void 0===e?100:e,n=t.damping,o=void 0===n?8:n,i=t.dt,a=void 0===i?17:i,u=function(t,e,n){var i=n+(-(t-e)*r-n*o)*a/1e3,u=n*a/1e3+t;return 1e-4>Math.abs(u-e)&&1e-4>Math.abs(i)?[e,0]:[u,i]};return u.isStepper=!0,u.dt=a,u},J=function(){for(var t=arguments.length,e=Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r0?r[o-1]:n,p=l||Object.keys(c);if("function"==typeof u||"spring"===u)return[].concat(th(t),[e.runJSAnimation.bind(e,{from:f.style,to:c,duration:i,easing:u}),i]);var h=Z(p,i,u),d=tv(tv(tv({},f.style),c),{},{transition:h});return[].concat(th(t),[d,i,s]).filter($)},[a,Math.max(void 0===u?0:u,n)])),[t.onAnimationEnd]))}},{key:"runAnimation",value:function(t){if(!this.manager){var e,r,n;this.manager=(e=function(){return null},r=!1,n=function t(n){if(!r){if(Array.isArray(n)){if(!n.length)return;var o=function(t){if(Array.isArray(t))return t}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return B(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,void 0)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],a=o.slice(1);if("number"==typeof i){I(t.bind(null,a),i);return}t(i),I(t.bind(null,a));return}"object"===L(n)&&e(n),"function"==typeof n&&n()}},{stop:function(){r=!0},start:function(t){r=!1,n(t)},subscribe:function(t){return e=t,function(){e=function(){return null}}}})}var o=t.begin,i=t.duration,a=t.attributeName,u=t.to,c=t.easing,l=t.onAnimationStart,s=t.onAnimationEnd,f=t.steps,p=t.children,h=this.manager;if(this.unSubscribe=h.subscribe(this.handleStyleChange),"function"==typeof c||"function"==typeof p||"spring"===c){this.runJSAnimation(t);return}if(f.length>1){this.runStepAnimation(t);return}var d=a?tm({},a,u):u,y=Z(Object.keys(d),i,c);h.start([l,o,tv(tv({},d),{},{transition:y}),i,s])}},{key:"render",value:function(){var t=this.props,e=t.children,r=(t.begin,t.duration),o=(t.attributeName,t.easing,t.isActive),i=(t.steps,t.from,t.to,t.canBegin,t.onAnimationEnd,t.shouldReAnimate,t.onAnimationReStart,function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,tp)),a=n.Children.count(e),u=this.state.style;if("function"==typeof e)return e(u);if(!o||0===a||r<=0)return e;var c=function(t){var e=t.props,r=e.style,o=e.className;return(0,n.cloneElement)(t,tv(tv({},i),{},{style:tv(tv({},void 0===r?{}:r),u),className:o}))};return 1===a?c(n.Children.only(e)):n.createElement("div",null,n.Children.map(e,function(t){return c(t)}))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,w),i=parseInt("".concat(r),10),a=parseInt("".concat(n),10),u=parseInt("".concat(e.height||o.height),10),c=parseInt("".concat(e.width||o.width),10);return P(P(P(P(P({},e),o),i?{x:i}:{}),a?{y:a}:{}),{},{height:u,width:c,name:e.name,radius:e.radius})}function k(t){return n.createElement(x.bn,j({shapeType:"rectangle",propTransformer:E,activeClassName:"recharts-active-bar"},t))}var A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(r,n){if("number"==typeof t)return t;var o=(0,d.hj)(r)||(0,d.Rw)(r);return o?t(r,n):(o||(0,g.Z)(!1),e)}},M=["value","background"];function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){return(T=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,M);if(!u)return null;var l=N(N(N(N(N({},c),{},{fill:"#eee"},u),a),(0,b.bw)(t.props,e,r)),{},{onAnimationStart:t.handleAnimationStart,onAnimationEnd:t.handleAnimationEnd,dataKey:o,index:r,className:"recharts-bar-background-rectangle"});return n.createElement(k,T({key:"background-bar-".concat(r),option:t.props.background,isActive:r===i},l))})}},{key:"renderErrorBar",value:function(t,e){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.data,i=r.xAxis,a=r.yAxis,u=r.layout,c=r.children,l=(0,y.NN)(c,f.W);if(!l)return null;var p="vertical"===u?o[0].height/2:o[0].width/2,h=function(t,e){var r=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:r,errorVal:(0,m.F$)(t,e)}};return n.createElement(s.m,{clipPath:t?"url(#clipPath-".concat(e,")"):null},l.map(function(t){return n.cloneElement(t,{key:"error-bar-".concat(e,"-").concat(t.props.dataKey),data:o,xAxis:i,yAxis:a,layout:u,offset:p,dataPointFormatter:h})}))}},{key:"render",value:function(){var t=this.props,e=t.hide,r=t.data,i=t.className,a=t.xAxis,u=t.yAxis,c=t.left,f=t.top,p=t.width,d=t.height,y=t.isAnimationActive,v=t.background,m=t.id;if(e||!r||!r.length)return null;var b=this.state.isAnimationFinished,g=(0,o.Z)("recharts-bar",i),x=a&&a.allowDataOverflow,w=u&&u.allowDataOverflow,O=x||w,j=l()(m)?this.id:m;return n.createElement(s.m,{className:g},x||w?n.createElement("defs",null,n.createElement("clipPath",{id:"clipPath-".concat(j)},n.createElement("rect",{x:x?c:c-p/2,y:w?f:f-d/2,width:x?p:2*p,height:w?d:2*d}))):null,n.createElement(s.m,{className:"recharts-bar-rectangles",clipPath:O?"url(#clipPath-".concat(j,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(O,j),(!y||b)&&h.e.renderCallByParent(this.props,r))}}],r=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curData:t.data,prevData:e.curData}:t.data!==e.curData?{curData:t.data}:null}}],e&&D(a.prototype,e),r&&D(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}(n.PureComponent);R(U,"displayName","Bar"),R(U,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!v.x.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"}),R(U,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,o=t.bandSize,i=t.xAxis,a=t.yAxis,u=t.xAxisTicks,c=t.yAxisTicks,l=t.stackedData,s=t.dataStartIndex,f=t.displayedData,h=t.offset,v=(0,m.Bu)(n,r);if(!v)return null;var b=e.layout,g=r.type.defaultProps,x=void 0!==g?N(N({},g),r.props):r.props,w=x.dataKey,O=x.children,j=x.minPointSize,S="horizontal"===b?a:i,P=l?S.scale.domain():null,E=(0,m.Yj)({numericAxis:S}),k=(0,y.NN)(O,p.b),M=f.map(function(t,e){l?f=(0,m.Vv)(l[s+e],P):Array.isArray(f=(0,m.F$)(t,w))||(f=[E,f]);var n=A(j,U.defaultProps.minPointSize)(f[1],e);if("horizontal"===b){var f,p,h,y,g,x,O,S=[a.scale(f[0]),a.scale(f[1])],M=S[0],_=S[1];p=(0,m.Fy)({axis:i,ticks:u,bandSize:o,offset:v.offset,entry:t,index:e}),h=null!==(O=null!=_?_:M)&&void 0!==O?O:void 0,y=v.size;var T=M-_;if(g=Number.isNaN(T)?0:T,x={x:p,y:a.y,width:y,height:a.height},Math.abs(n)>0&&Math.abs(g)0&&Math.abs(y)=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function P(t,e){for(var r=0;r0?this.props:d)),o<=0||a<=0||!y||!y.length)?null:n.createElement(s.m,{className:(0,c.Z)("recharts-cartesian-axis",l),ref:function(e){t.layerReference=e}},r&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),p._.renderCallByParent(this.props))}}],r=[{key:"renderTickItem",value:function(t,e,r){var o=(0,c.Z)(e.className,"recharts-cartesian-axis-tick-value");return n.isValidElement(t)?n.cloneElement(t,j(j({},e),{},{className:o})):i()(t)?t(j(j({},e),{},{className:o})):n.createElement(f.x,w({},e,{className:"recharts-cartesian-axis-tick-value"}),r)}}],e&&P(o.prototype,e),r&&P(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.Component);M(T,"displayName","CartesianAxis"),M(T,"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"})},56940:function(t,e,r){"use strict";r.d(e,{q:function(){return M}});var n=r(2265),o=r(86757),i=r.n(o),a=r(1175),u=r(16630),c=r(82944),l=r(85355),s=r(78242),f=r(80285),p=r(25739),h=["x1","y1","x2","y2","key"],d=["offset"];function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var x=function(t){var e=t.fill;if(!e||"none"===e)return null;var r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.ry;return n.createElement("rect",{x:o,y:i,ry:c,width:a,height:u,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function w(t,e){var r;if(n.isValidElement(t))r=n.cloneElement(t,e);else if(i()(t))r=t(e);else{var o=e.x1,a=e.y1,u=e.x2,l=e.y2,s=e.key,f=g(e,h),p=(0,c.L6)(f,!1),y=(p.offset,g(p,d));r=n.createElement("line",b({},y,{x1:o,y1:a,x2:u,y2:l,fill:"none",key:s}))}return r}function O(t){var e=t.x,r=t.width,o=t.horizontal,i=void 0===o||o,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:e,y1:n,x2:e+r,y2:n,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function j(t){var e=t.y,r=t.height,o=t.vertical,i=void 0===o||o,a=t.verticalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:n,y1:e,x2:n,y2:e+r,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function S(t){var e=t.horizontalFill,r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.horizontalPoints,l=t.horizontal;if(!(void 0===l||l)||!e||!e.length)return null;var s=c.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,c){var l=s[c+1]?s[c+1]-t:i+u-t;if(l<=0)return null;var f=c%e.length;return n.createElement("rect",{key:"react-".concat(c),y:t,x:o,height:l,width:a,stroke:"none",fill:e[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function P(t){var e=t.vertical,r=t.verticalFill,o=t.fillOpacity,i=t.x,a=t.y,u=t.width,c=t.height,l=t.verticalPoints;if(!(void 0===e||e)||!r||!r.length)return null;var s=l.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,e){var l=s[e+1]?s[e+1]-t:i+u-t;if(l<=0)return null;var f=e%r.length;return n.createElement("rect",{key:"react-".concat(e),x:t,y:a,width:l,height:c,stroke:"none",fill:r[f],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var E=function(t,e){var r=t.xAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.left,i.left+i.width,e)},k=function(t,e){var r=t.yAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.top,i.top+i.height,e)},A={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function M(t){var e,r,o,c,l,s,f=(0,p.zn)(),h=(0,p.Mw)(),d=(0,p.qD)(),v=m(m({},t),{},{stroke:null!==(e=t.stroke)&&void 0!==e?e:A.stroke,fill:null!==(r=t.fill)&&void 0!==r?r:A.fill,horizontal:null!==(o=t.horizontal)&&void 0!==o?o:A.horizontal,horizontalFill:null!==(c=t.horizontalFill)&&void 0!==c?c:A.horizontalFill,vertical:null!==(l=t.vertical)&&void 0!==l?l:A.vertical,verticalFill:null!==(s=t.verticalFill)&&void 0!==s?s:A.verticalFill,x:(0,u.hj)(t.x)?t.x:d.left,y:(0,u.hj)(t.y)?t.y:d.top,width:(0,u.hj)(t.width)?t.width:d.width,height:(0,u.hj)(t.height)?t.height:d.height}),g=v.x,w=v.y,M=v.width,_=v.height,T=v.syncWithTicks,C=v.horizontalValues,N=v.verticalValues,D=(0,p.CW)(),I=(0,p.Nf)();if(!(0,u.hj)(M)||M<=0||!(0,u.hj)(_)||_<=0||!(0,u.hj)(g)||g!==+g||!(0,u.hj)(w)||w!==+w)return null;var L=v.verticalCoordinatesGenerator||E,B=v.horizontalCoordinatesGenerator||k,R=v.horizontalPoints,z=v.verticalPoints;if((!R||!R.length)&&i()(B)){var U=C&&C.length,F=B({yAxis:I?m(m({},I),{},{ticks:U?C:I.ticks}):void 0,width:f,height:h,offset:d},!!U||T);(0,a.Z)(Array.isArray(F),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(y(F),"]")),Array.isArray(F)&&(R=F)}if((!z||!z.length)&&i()(L)){var $=N&&N.length,q=L({xAxis:D?m(m({},D),{},{ticks:$?N:D.ticks}):void 0,width:f,height:h,offset:d},!!$||T);(0,a.Z)(Array.isArray(q),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(y(q),"]")),Array.isArray(q)&&(z=q)}return n.createElement("g",{className:"recharts-cartesian-grid"},n.createElement(x,{fill:v.fill,fillOpacity:v.fillOpacity,x:v.x,y:v.y,width:v.width,height:v.height,ry:v.ry}),n.createElement(O,b({},v,{offset:d,horizontalPoints:R,xAxis:D,yAxis:I})),n.createElement(j,b({},v,{offset:d,verticalPoints:z,xAxis:D,yAxis:I})),n.createElement(S,b({},v,{horizontalPoints:R})),n.createElement(P,b({},v,{verticalPoints:z})))}M.displayName="CartesianGrid"},13137:function(t,e,r){"use strict";r.d(e,{W:function(){return v}});var n=r(2265),o=r(69398),i=r(9841),a=r(82944),u=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,u),m=(0,a.L6)(v,!1);"x"===this.props.direction&&"number"!==d.type&&(0,o.Z)(!1);var b=p.map(function(t){var o,a,u=h(t,f),p=u.x,v=u.y,b=u.value,g=u.errorVal;if(!g)return null;var x=[];if(Array.isArray(g)){var w=function(t){if(Array.isArray(t))return t}(g)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(g,2)||function(t,e){if(t){if("string"==typeof t)return s(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,2)}}(g,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();o=w[0],a=w[1]}else o=a=g;if("vertical"===r){var O=d.scale,j=v+e,S=j+c,P=j-c,E=O(b-o),k=O(b+a);x.push({x1:k,y1:S,x2:k,y2:P}),x.push({x1:E,y1:j,x2:k,y2:j}),x.push({x1:E,y1:S,x2:E,y2:P})}else if("horizontal"===r){var A=y.scale,M=p+e,_=M-c,T=M+c,C=A(b-o),N=A(b+a);x.push({x1:_,y1:N,x2:T,y2:N}),x.push({x1:M,y1:C,x2:M,y2:N}),x.push({x1:_,y1:C,x2:T,y2:C})}return n.createElement(i.m,l({className:"recharts-errorBar",key:"bar-".concat(x.map(function(t){return"".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))},m),x.map(function(t){return n.createElement("line",l({},t,{key:"line-".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))}))});return n.createElement(i.m,{className:"recharts-errorBars"},b)}}],function(t,e){for(var r=0;rt*o)return!1;var i=r();return t*(e-t*i/2-n)>=0&&t*(e+t*i/2-o)<=0}function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t){for(var e=1;e=2?(0,i.uY)(m[1].coordinate-m[0].coordinate):1,M=(n="width"===P,f=b.x,p=b.y,d=b.width,y=b.height,1===A?{start:n?f:p,end:n?f+d:p+y}:{start:n?f+d:p+y,end:n?f:p});return"equidistantPreserveStart"===w?function(t,e,r,n,o){for(var i,a=(n||[]).slice(),u=e.start,c=e.end,f=0,p=1,h=u;p<=a.length;)if(i=function(){var e,i=null==n?void 0:n[f];if(void 0===i)return{v:l(n,p)};var a=f,d=function(){return void 0===e&&(e=r(i,a)),e},y=i.coordinate,v=0===f||s(t,y,d,h,c);v||(f=0,h=u,p+=1),v&&(h=y+t*(d()/2+o),f+=p)}())return i.v;return[]}(A,M,k,m,g):("preserveStart"===w||"preserveStartEnd"===w?function(t,e,r,n,o,i){var a=(n||[]).slice(),u=a.length,c=e.start,l=e.end;if(i){var f=n[u-1],p=r(f,u-1),d=t*(f.coordinate+t*p/2-l);a[u-1]=f=h(h({},f),{},{tickCoord:d>0?f.coordinate-d*t:f.coordinate}),s(t,f.tickCoord,function(){return p},c,l)&&(l=f.tickCoord-t*(p/2+o),a[u-1]=h(h({},f),{},{isShow:!0}))}for(var y=i?u-1:u,v=function(e){var n,i=a[e],u=function(){return void 0===n&&(n=r(i,e)),n};if(0===e){var f=t*(i.coordinate-t*u()/2-c);a[e]=i=h(h({},i),{},{tickCoord:f<0?i.coordinate-f*t:i.coordinate})}else a[e]=i=h(h({},i),{},{tickCoord:i.coordinate});s(t,i.tickCoord,u,c,l)&&(c=i.tickCoord+t*(u()/2+o),a[e]=h(h({},i),{},{isShow:!0}))},m=0;m0?l.coordinate-p*t:l.coordinate})}else i[e]=l=h(h({},l),{},{tickCoord:l.coordinate});s(t,l.tickCoord,f,u,c)&&(c=l.tickCoord-t*(f()/2+o),i[e]=h(h({},l),{},{isShow:!0}))},f=a-1;f>=0;f--)l(f);return i}(A,M,k,m,g)).filter(function(t){return t.isShow})}},93765:function(t,e,r){"use strict";r.d(e,{z:function(){return eD}});var n,o,i=r(2265),a=r(77571),u=r.n(a),c=r(86757),l=r.n(c),s=r(99676),f=r.n(s),p=r(13735),h=r.n(p),d=r(34935),y=r.n(d),v=r(37065),m=r.n(v),b=r(87602),g=r(69398),x=r(48777),w=r(9841),O=r(8147),j=r(22190),S=r(81889),P=r(73649),E=r(82944),k=r(55284),A=r(58811),M=r(85355),_=r(16630);function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e0&&e.handleDrag(t.changedTouches[0])}),W(e,"handleDragEnd",function(){e.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var t=e.props,r=t.endIndex,n=t.onDragEnd,o=t.startIndex;null==n||n({endIndex:r,startIndex:o})}),e.detachDragEndListener()}),W(e,"handleLeaveWrapper",function(){(e.state.isTravellerMoving||e.state.isSlideMoving)&&(e.leaveTimer=window.setTimeout(e.handleDragEnd,e.props.leaveTimeOut))}),W(e,"handleEnterSlideOrTraveller",function(){e.setState({isTextActive:!0})}),W(e,"handleLeaveSlideOrTraveller",function(){e.setState({isTextActive:!1})}),W(e,"handleSlideDragStart",function(t){var r=X(t)?t.changedTouches[0]:t;e.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:r.pageX}),e.attachDragEndListener()}),e.travellerDragStartHandlers={startX:e.handleTravellerDragStart.bind(e,"startX"),endX:e.handleTravellerDragStart.bind(e,"endX")},e.state={},e}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(n,t),e=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var e=t.startX,r=t.endX,o=this.state.scaleValues,i=this.props,a=i.gap,u=i.data.length-1,c=n.getIndexInRange(o,Math.min(e,r)),l=n.getIndexInRange(o,Math.max(e,r));return{startIndex:c-c%a,endIndex:l===u?u:l-l%a}}},{key:"getTextOfTick",value:function(t){var e=this.props,r=e.data,n=e.tickFormatter,o=e.dataKey,i=(0,M.F$)(r[t],o,t);return l()(n)?n(i,t):i}},{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(t){var e=this.state,r=e.slideMoveStartX,n=e.startX,o=e.endX,i=this.props,a=i.x,u=i.width,c=i.travellerWidth,l=i.startIndex,s=i.endIndex,f=i.onChange,p=t.pageX-r;p>0?p=Math.min(p,a+u-c-o,a+u-c-n):p<0&&(p=Math.max(p,a-n,a-o));var h=this.getIndex({startX:n+p,endX:o+p});(h.startIndex!==l||h.endIndex!==s)&&f&&f(h),this.setState({startX:n+p,endX:o+p,slideMoveStartX:t.pageX})}},{key:"handleTravellerDragStart",value:function(t,e){var r=X(e)?e.changedTouches[0]:e;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:r.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(t){var e=this.state,r=e.brushMoveStartX,n=e.movingTravellerId,o=e.endX,i=e.startX,a=this.state[n],u=this.props,c=u.x,l=u.width,s=u.travellerWidth,f=u.onChange,p=u.gap,h=u.data,d={startX:this.state.startX,endX:this.state.endX},y=t.pageX-r;y>0?y=Math.min(y,c+l-s-a):y<0&&(y=Math.max(y,c-a)),d[n]=a+y;var v=this.getIndex(d),m=v.startIndex,b=v.endIndex,g=function(){var t=h.length-1;return"startX"===n&&(o>i?m%p==0:b%p==0)||oi?b%p==0:m%p==0)||o>i&&b===t};this.setState(W(W({},n,a+y),"brushMoveStartX",t.pageX),function(){f&&g()&&f(v)})}},{key:"handleTravellerMoveKeyboard",value:function(t,e){var r=this,n=this.state,o=n.scaleValues,i=n.startX,a=n.endX,u=this.state[e],c=o.indexOf(u);if(-1!==c){var l=c+t;if(-1!==l&&!(l>=o.length)){var s=o[l];"startX"===e&&s>=a||"endX"===e&&s<=i||this.setState(W({},e,s),function(){r.props.onChange(r.getIndex({startX:r.state.startX,endX:r.state.endX}))})}}}},{key:"renderBackground",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.fill,u=t.stroke;return i.createElement("rect",{stroke:u,fill:a,x:e,y:r,width:n,height:o})}},{key:"renderPanorama",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.data,u=t.children,c=t.padding,l=i.Children.only(u);return l?i.cloneElement(l,{x:e,y:r,width:n,height:o,margin:c,compact:!0,data:a}):null}},{key:"renderTravellerLayer",value:function(t,e){var r,o,a=this,u=this.props,c=u.y,l=u.travellerWidth,s=u.height,f=u.traveller,p=u.ariaLabel,h=u.data,d=u.startIndex,y=u.endIndex,v=Math.max(t,this.props.x),m=U(U({},(0,E.L6)(this.props,!1)),{},{x:v,y:c,width:l,height:s}),b=p||"Min value: ".concat(null===(r=h[d])||void 0===r?void 0:r.name,", Max value: ").concat(null===(o=h[y])||void 0===o?void 0:o.name);return i.createElement(w.m,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[e],onTouchStart:this.travellerDragStartHandlers[e],onKeyDown:function(t){["ArrowLeft","ArrowRight"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),a.handleTravellerMoveKeyboard("ArrowRight"===t.key?1:-1,e))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},n.renderTraveller(f,m))}},{key:"renderSlide",value:function(t,e){var r=this.props,n=r.y,o=r.height,a=r.stroke,u=r.travellerWidth;return i.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:a,fillOpacity:.2,x:Math.min(t,e)+u,y:n,width:Math.max(Math.abs(e-t)-u,0),height:o})}},{key:"renderText",value:function(){var t=this.props,e=t.startIndex,r=t.endIndex,n=t.y,o=t.height,a=t.travellerWidth,u=t.stroke,c=this.state,l=c.startX,s=c.endX,f={pointerEvents:"none",fill:u};return i.createElement(w.m,{className:"recharts-brush-texts"},i.createElement(A.x,R({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,s)-5,y:n+o/2},f),this.getTextOfTick(e)),i.createElement(A.x,R({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,s)+a+5,y:n+o/2},f),this.getTextOfTick(r)))}},{key:"render",value:function(){var t=this.props,e=t.data,r=t.className,n=t.children,o=t.x,a=t.y,u=t.width,c=t.height,l=t.alwaysShowText,s=this.state,f=s.startX,p=s.endX,h=s.isTextActive,d=s.isSlideMoving,y=s.isTravellerMoving,v=s.isTravellerFocused;if(!e||!e.length||!(0,_.hj)(o)||!(0,_.hj)(a)||!(0,_.hj)(u)||!(0,_.hj)(c)||u<=0||c<=0)return null;var m=(0,b.Z)("recharts-brush",r),g=1===i.Children.count(n),x=L("userSelect","none");return i.createElement(w.m,{className:m,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:x},this.renderBackground(),g&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(h||d||y||v||l)&&this.renderText())}}],r=[{key:"renderDefaultTraveller",value:function(t){var e=t.x,r=t.y,n=t.width,o=t.height,a=t.stroke,u=Math.floor(r+o/2)-1;return i.createElement(i.Fragment,null,i.createElement("rect",{x:e,y:r,width:n,height:o,fill:a,stroke:"none"}),i.createElement("line",{x1:e+1,y1:u,x2:e+n-1,y2:u,fill:"none",stroke:"#fff"}),i.createElement("line",{x1:e+1,y1:u+2,x2:e+n-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,e){return i.isValidElement(t)?i.cloneElement(t,e):l()(t)?t(e):n.renderDefaultTraveller(e)}},{key:"getDerivedStateFromProps",value:function(t,e){var r=t.data,n=t.width,o=t.x,i=t.travellerWidth,a=t.updateId,u=t.startIndex,c=t.endIndex;if(r!==e.prevData||a!==e.prevUpdateId)return U({prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n},r&&r.length?H({data:r,width:n,x:o,travellerWidth:i,startIndex:u,endIndex:c}):{scale:null,scaleValues:null});if(e.scale&&(n!==e.prevWidth||o!==e.prevX||i!==e.prevTravellerWidth)){e.scale.range([o,o+n-i]);var l=e.scale.domain().map(function(t){return e.scale(t)});return{prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n,startX:e.scale(t.startIndex),endX:e.scale(t.endIndex),scaleValues:l}}return null}},{key:"getIndexInRange",value:function(t,e){for(var r=t.length,n=0,o=r-1;o-n>1;){var i=Math.floor((n+o)/2);t[i]>e?o=i:n=i}return e>=t[o]?o:n}}],e&&F(n.prototype,e),r&&F(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}(i.PureComponent);W(G,"displayName","Brush"),W(G,"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 V=r(4094),K=r(38569),Q=r(26680),J=function(t,e){var r=t.alwaysShow,n=t.ifOverflow;return r&&(n="extendDomain"),n===e},tt=r(25311),te=r(1175);function tr(){return(tr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,t2));return(0,_.hj)(r)&&(0,_.hj)(o)&&(0,_.hj)(f)&&(0,_.hj)(h)&&(0,_.hj)(u)&&(0,_.hj)(l)?i.createElement("path",t5({},(0,E.L6)(y,!0),{className:(0,b.Z)("recharts-cross",d),d:"M".concat(r,",").concat(u,"v").concat(h,"M").concat(l,",").concat(o,"h").concat(f)})):null};function t7(t){var e=t.cx,r=t.cy,n=t.radius,o=t.startAngle,i=t.endAngle;return{points:[(0,tq.op)(e,r,n,o),(0,tq.op)(e,r,n,i)],cx:e,cy:r,radius:n,startAngle:o,endAngle:i}}var t8=r(60474);function t4(t){return(t4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ec=function(){return!!t})()}function el(t){return(el=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function es(t,e){return(es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ef(t){return function(t){if(Array.isArray(t))return eh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ep(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ep(t,e){if(t){if("string"==typeof t)return eh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eh(t,e)}}function eh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0?i:t&&t.length&&(0,_.hj)(n)&&(0,_.hj)(o)?t.slice(n,o+1):[]};function eS(t){return"number"===t?[0,"auto"]:void 0}var eP=function(t,e,r,n){var o=t.graphicalItems,i=t.tooltipAxis,a=ej(e,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(o,u){var c,l,s=null!==(c=u.props.data)&&void 0!==c?c:e;if(s&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(s=s.slice(t.dataStartIndex,t.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory){var f=void 0===s?a:s;l=(0,_.Ap)(f,i.dataKey,n)}else l=s&&s[r]||a[r];return l?[].concat(ef(o),[(0,M.Qo)(u,l)]):o},[])},eE=function(t,e,r,n){var o=n||{x:t.chartX,y:t.chartY},i="horizontal"===r?o.x:"vertical"===r?o.y:"centric"===r?o.angle:o.radius,a=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,l=(0,M.VO)(i,a,c,u);if(l>=0&&c){var s=c[l]&&c[l].value,f=eP(t,e,l,s),p=eO(r,a,l,o);return{activeTooltipIndex:l,activeLabel:s,activePayload:f,activeCoordinate:p}}return null},ek=function(t,e){var r=e.axes,n=e.graphicalItems,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,l=e.dataEndIndex,s=t.layout,p=t.children,h=t.stackOffset,d=(0,M.NA)(s,o);return r.reduce(function(e,r){var y=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,v=y.type,m=y.dataKey,b=y.allowDataOverflow,g=y.allowDuplicatedCategory,x=y.scale,w=y.ticks,O=y.includeHidden,j=y[i];if(e[j])return e;var S=ej(t.data,{graphicalItems:n.filter(function(t){var e;return(i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i])===j}),dataStartIndex:c,dataEndIndex:l}),P=S.length;(function(t,e,r){if("number"===r&&!0===e&&Array.isArray(t)){var n=null==t?void 0:t[0],o=null==t?void 0:t[1];if(n&&o&&(0,_.hj)(n)&&(0,_.hj)(o))return!0}return!1})(y.domain,b,v)&&(A=(0,M.LG)(y.domain,null,b),d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category")));var E=eS(v);if(!A||0===A.length){var k,A,T,C,N,D=null!==(N=y.domain)&&void 0!==N?N:E;if(m){if(A=(0,M.gF)(S,m,v),"category"===v&&d){var I=(0,_.bv)(A);g&&I?(T=A,A=f()(0,P)):g||(A=(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0?t:[].concat(ef(t),[e])},[]))}else if("category"===v)A=g?A.filter(function(t){return""!==t&&!u()(t)}):(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0||""===e||u()(e)?t:[].concat(ef(t),[e])},[]);else if("number"===v){var L=(0,M.ZI)(S,n.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===j&&(O||!o)}),m,o,s);L&&(A=L)}d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category"))}else A=d?f()(0,P):a&&a[j]&&a[j].hasStack&&"number"===v?"expand"===h?[0,1]:(0,M.EB)(a[j].stackGroups,c,l):(0,M.s6)(S,n.filter(function(t){var e=i in t.props?t.props[i]:t.type.defaultProps[i],r="hide"in t.props?t.props.hide:t.type.defaultProps.hide;return e===j&&(O||!r)}),v,s,!0);"number"===v?(A=t$(p,A,j,o,w),D&&(A=(0,M.LG)(D,A,b))):"category"===v&&D&&A.every(function(t){return D.indexOf(t)>=0})&&(A=D)}return ey(ey({},e),{},ev({},j,ey(ey({},y),{},{axisType:o,domain:A,categoricalDomain:C,duplicateDomain:T,originalDomain:null!==(k=y.domain)&&void 0!==k?k:E,isCategorical:d,layout:s})))},{})},eA=function(t,e){var r=e.graphicalItems,n=e.Axis,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.layout,s=t.children,p=ej(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:c}),d=p.length,y=(0,M.NA)(l,o),v=-1;return r.reduce(function(t,e){var m,b=(void 0!==e.type.defaultProps?ey(ey({},e.type.defaultProps),e.props):e.props)[i],g=eS("number");return t[b]?t:(v++,m=y?f()(0,d):a&&a[b]&&a[b].hasStack?t$(s,m=(0,M.EB)(a[b].stackGroups,u,c),b,o):t$(s,m=(0,M.LG)(g,(0,M.s6)(p,r.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===b&&!o}),"number",l),n.defaultProps.allowDataOverflow),b,o),ey(ey({},t),{},ev({},b,ey(ey({axisType:o},n.defaultProps),{},{hide:!0,orientation:h()(eb,"".concat(o,".").concat(v%2),null),domain:m,originalDomain:g,isCategorical:y,layout:l}))))},{})},eM=function(t,e){var r=e.axisType,n=void 0===r?"xAxis":r,o=e.AxisComp,i=e.graphicalItems,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.children,s="".concat(n,"Id"),f=(0,E.NN)(l,o),p={};return f&&f.length?p=ek(t,{axes:f,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c}):i&&i.length&&(p=eA(t,{Axis:o,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c})),p},e_=function(t){var e=(0,_.Kt)(t),r=(0,M.uY)(e,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:y()(r,function(t){return t.coordinate}),tooltipAxis:e,tooltipAxisBandSize:(0,M.zT)(e,r)}},eT=function(t){var e=t.children,r=t.defaultShowTooltip,n=(0,E.sP)(e,G),o=0,i=0;return t.data&&0!==t.data.length&&(i=t.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(i=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},eC=function(t){return"horizontal"===t?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===t?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===t?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},eN=function(t,e){var r=t.props,n=t.graphicalItems,o=t.xAxisMap,i=void 0===o?{}:o,a=t.yAxisMap,u=void 0===a?{}:a,c=r.width,l=r.height,s=r.children,f=r.margin||{},p=(0,E.sP)(s,G),d=(0,E.sP)(s,j.D),y=Object.keys(u).reduce(function(t,e){var r=u[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,t[n]+r.width))},{left:f.left||0,right:f.right||0}),v=Object.keys(i).reduce(function(t,e){var r=i[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,h()(t,"".concat(n))+r.height))},{top:f.top||0,bottom:f.bottom||0}),m=ey(ey({},v),y),b=m.bottom;p&&(m.bottom+=p.props.height||G.defaultProps.height),d&&e&&(m=(0,M.By)(m,n,r,e));var g=c-m.left-m.right,x=l-m.top-m.bottom;return ey(ey({brushBottom:b},m),{},{width:Math.max(g,0),height:Math.max(x,0)})},eD=function(t){var e=t.chartName,r=t.GraphicalChild,n=t.defaultTooltipEventType,o=void 0===n?"axis":n,a=t.validateTooltipEventTypes,c=void 0===a?["axis"]:a,s=t.axisComponents,f=t.legendContent,p=t.formatAxisMap,d=t.defaultProps,y=function(t,e){var r=e.graphicalItems,n=e.stackGroups,o=e.offset,i=e.updateId,a=e.dataStartIndex,c=e.dataEndIndex,l=t.barSize,f=t.layout,p=t.barGap,h=t.barCategoryGap,d=t.maxBarSize,y=eC(f),v=y.numericAxisName,m=y.cateAxisName,b=!!r&&!!r.length&&r.some(function(t){var e=(0,E.Gf)(t&&t.type);return e&&e.indexOf("Bar")>=0}),x=[];return r.forEach(function(r,y){var w=ej(t.data,{graphicalItems:[r],dataStartIndex:a,dataEndIndex:c}),O=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,j=O.dataKey,S=O.maxBarSize,P=O["".concat(v,"Id")],k=O["".concat(m,"Id")],A=s.reduce(function(t,r){var n=e["".concat(r.axisType,"Map")],o=O["".concat(r.axisType,"Id")];n&&n[o]||"zAxis"===r.axisType||(0,g.Z)(!1);var i=n[o];return ey(ey({},t),{},ev(ev({},r.axisType,i),"".concat(r.axisType,"Ticks"),(0,M.uY)(i)))},{}),_=A[m],T=A["".concat(m,"Ticks")],C=n&&n[P]&&n[P].hasStack&&(0,M.O3)(r,n[P].stackGroups),N=(0,E.Gf)(r.type).indexOf("Bar")>=0,D=(0,M.zT)(_,T),I=[],L=b&&(0,M.pt)({barSize:l,stackGroups:n,totalSize:"xAxis"===m?A[m].width:"yAxis"===m?A[m].height:void 0});if(N){var B,R,z=u()(S)?d:S,U=null!==(B=null!==(R=(0,M.zT)(_,T,!0))&&void 0!==R?R:z)&&void 0!==B?B:0;I=(0,M.qz)({barGap:p,barCategoryGap:h,bandSize:U!==D?U:D,sizeList:L[k],maxBarSize:z}),U!==D&&(I=I.map(function(t){return ey(ey({},t),{},{position:ey(ey({},t.position),{},{offset:t.position.offset-U/2})})}))}var F=r&&r.type&&r.type.getComposedData;F&&x.push({props:ey(ey({},F(ey(ey({},A),{},{displayedData:w,props:t,dataKey:j,item:r,bandSize:D,barPosition:I,offset:o,stackedData:C,layout:f,dataStartIndex:a,dataEndIndex:c}))),{},ev(ev(ev({key:r.key||"item-".concat(y)},v,A[v]),m,A[m]),"animationId",i)),childIndex:(0,E.$R)(r,t.children),item:r})}),x},v=function(t,n){var o=t.props,i=t.dataStartIndex,a=t.dataEndIndex,u=t.updateId;if(!(0,E.TT)({props:o}))return null;var c=o.children,l=o.layout,f=o.stackOffset,h=o.data,d=o.reverseStackOrder,v=eC(l),m=v.numericAxisName,b=v.cateAxisName,g=(0,E.NN)(c,r),x=(0,M.wh)(h,g,"".concat(m,"Id"),"".concat(b,"Id"),f,d),w=s.reduce(function(t,e){var r="".concat(e.axisType,"Map");return ey(ey({},t),{},ev({},r,eM(o,ey(ey({},e),{},{graphicalItems:g,stackGroups:e.axisType===m&&x,dataStartIndex:i,dataEndIndex:a}))))},{}),O=eN(ey(ey({},w),{},{props:o,graphicalItems:g}),null==n?void 0:n.legendBBox);Object.keys(w).forEach(function(t){w[t]=p(o,w[t],O,t.replace("Map",""),e)});var j=e_(w["".concat(b,"Map")]),S=y(o,ey(ey({},w),{},{dataStartIndex:i,dataEndIndex:a,updateId:u,graphicalItems:g,stackGroups:x,offset:O}));return ey(ey({formattedGraphicalItems:S,graphicalItems:g,offset:O,stackGroups:x},j),w)},j=function(t){var r;function n(t){var r,o,a,c,s;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,n),c=n,s=[t],c=el(c),ev(a=function(t,e){if(e&&("object"===eo(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,ec()?Reflect.construct(c,s||[],el(this).constructor):c.apply(this,s)),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ev(a,"accessibilityManager",new tQ),ev(a,"handleLegendBBoxUpdate",function(t){if(t){var e=a.state,r=e.dataStartIndex,n=e.dataEndIndex,o=e.updateId;a.setState(ey({legendBBox:t},v({props:a.props,dataStartIndex:r,dataEndIndex:n,updateId:o},ey(ey({},a.state),{},{legendBBox:t}))))}}),ev(a,"handleReceiveSyncEvent",function(t,e,r){a.props.syncId===t&&(r!==a.eventEmitterSymbol||"function"==typeof a.props.syncMethod)&&a.applySyncEvent(e)}),ev(a,"handleBrushChange",function(t){var e=t.startIndex,r=t.endIndex;if(e!==a.state.dataStartIndex||r!==a.state.dataEndIndex){var n=a.state.updateId;a.setState(function(){return ey({dataStartIndex:e,dataEndIndex:r},v({props:a.props,dataStartIndex:e,dataEndIndex:r,updateId:n},a.state))}),a.triggerSyncEvent({dataStartIndex:e,dataEndIndex:r})}}),ev(a,"handleMouseEnter",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseEnter;l()(n)&&n(r,t)}}),ev(a,"triggeredAfterMouseMove",function(t){var e=a.getMouseInfo(t),r=e?ey(ey({},e),{},{isTooltipActive:!0}):{isTooltipActive:!1};a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseMove;l()(n)&&n(r,t)}),ev(a,"handleItemMouseEnter",function(t){a.setState(function(){return{isTooltipActive:!0,activeItem:t,activePayload:t.tooltipPayload,activeCoordinate:t.tooltipPosition||{x:t.cx,y:t.cy}}})}),ev(a,"handleItemMouseLeave",function(){a.setState(function(){return{isTooltipActive:!1}})}),ev(a,"handleMouseMove",function(t){t.persist(),a.throttleTriggeredAfterMouseMove(t)}),ev(a,"handleMouseLeave",function(t){a.throttleTriggeredAfterMouseMove.cancel();var e={isTooltipActive:!1};a.setState(e),a.triggerSyncEvent(e);var r=a.props.onMouseLeave;l()(r)&&r(e,t)}),ev(a,"handleOuterEvent",function(t){var e,r=(0,E.Bh)(t),n=h()(a.props,"".concat(r));r&&l()(n)&&n(null!==(e=/.*touch.*/i.test(r)?a.getMouseInfo(t.changedTouches[0]):a.getMouseInfo(t))&&void 0!==e?e:{},t)}),ev(a,"handleClick",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onClick;l()(n)&&n(r,t)}}),ev(a,"handleMouseDown",function(t){var e=a.props.onMouseDown;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleMouseUp",function(t){var e=a.props.onMouseUp;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleTouchMove",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.throttleTriggeredAfterMouseMove(t.changedTouches[0])}),ev(a,"handleTouchStart",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseDown(t.changedTouches[0])}),ev(a,"handleTouchEnd",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseUp(t.changedTouches[0])}),ev(a,"handleDoubleClick",function(t){var e=a.props.onDoubleClick;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleContextMenu",function(t){var e=a.props.onContextMenu;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"triggerSyncEvent",function(t){void 0!==a.props.syncId&&tY.emit(tH,a.props.syncId,t,a.eventEmitterSymbol)}),ev(a,"applySyncEvent",function(t){var e=a.props,r=e.layout,n=e.syncMethod,o=a.state.updateId,i=t.dataStartIndex,u=t.dataEndIndex;if(void 0!==t.dataStartIndex||void 0!==t.dataEndIndex)a.setState(ey({dataStartIndex:i,dataEndIndex:u},v({props:a.props,dataStartIndex:i,dataEndIndex:u,updateId:o},a.state)));else if(void 0!==t.activeTooltipIndex){var c=t.chartX,l=t.chartY,s=t.activeTooltipIndex,f=a.state,p=f.offset,h=f.tooltipTicks;if(!p)return;if("function"==typeof n)s=n(h,t);else if("value"===n){s=-1;for(var d=0;d=0){if(s.dataKey&&!s.allowDuplicatedCategory){var A="function"==typeof s.dataKey?function(t){return"function"==typeof s.dataKey?s.dataKey(t.payload):null}:"payload.".concat(s.dataKey.toString());C=(0,_.Ap)(v,A,p),N=m&&b&&(0,_.Ap)(b,A,p)}else C=null==v?void 0:v[f],N=m&&b&&b[f];if(S||j){var T=void 0!==t.props.activeIndex?t.props.activeIndex:f;return[(0,i.cloneElement)(t,ey(ey(ey({},n.props),P),{},{activeIndex:T})),null,null]}if(!u()(C))return[k].concat(ef(a.renderActivePoints({item:n,activePoint:C,basePoint:N,childIndex:f,isRange:m})))}else{var C,N,D,I=(null!==(D=a.getItemByXY(a.state.activeCoordinate))&&void 0!==D?D:{graphicalItem:k}).graphicalItem,L=I.item,B=void 0===L?t:L,R=I.childIndex,z=ey(ey(ey({},n.props),P),{},{activeIndex:R});return[(0,i.cloneElement)(B,z),null,null]}}return m?[k,null,null]:[k,null]}),ev(a,"renderCustomized",function(t,e,r){return(0,i.cloneElement)(t,ey(ey({key:"recharts-customized-".concat(r)},a.props),a.state))}),ev(a,"renderMap",{CartesianGrid:{handler:ew,once:!0},ReferenceArea:{handler:a.renderReferenceElement},ReferenceLine:{handler:ew},ReferenceDot:{handler:a.renderReferenceElement},XAxis:{handler:ew},YAxis:{handler:ew},Brush:{handler:a.renderBrush,once:!0},Bar:{handler:a.renderGraphicChild},Line:{handler:a.renderGraphicChild},Area:{handler:a.renderGraphicChild},Radar:{handler:a.renderGraphicChild},RadialBar:{handler:a.renderGraphicChild},Scatter:{handler:a.renderGraphicChild},Pie:{handler:a.renderGraphicChild},Funnel:{handler:a.renderGraphicChild},Tooltip:{handler:a.renderCursor,once:!0},PolarGrid:{handler:a.renderPolarGrid,once:!0},PolarAngleAxis:{handler:a.renderPolarAxis},PolarRadiusAxis:{handler:a.renderPolarAxis},Customized:{handler:a.renderCustomized}}),a.clipPathId="".concat(null!==(r=t.id)&&void 0!==r?r:(0,_.EL)("recharts"),"-clip"),a.throttleTriggeredAfterMouseMove=m()(a.triggeredAfterMouseMove,null!==(o=t.throttleDelay)&&void 0!==o?o:1e3/60),a.state={},a}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&es(t,e)}(n,t),r=[{key:"componentDidMount",value:function(){var t,e;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(t=this.props.margin.left)&&void 0!==t?t:0,top:null!==(e=this.props.margin.top)&&void 0!==e?e:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var t=this.props,e=t.children,r=t.data,n=t.height,o=t.layout,i=(0,E.sP)(e,O.u);if(i){var a=i.props.defaultIndex;if("number"==typeof a&&!(a<0)&&!(a>this.state.tooltipTicks.length-1)){var u=this.state.tooltipTicks[a]&&this.state.tooltipTicks[a].value,c=eP(this.state,r,a,u),l=this.state.tooltipTicks[a].coordinate,s=(this.state.offset.top+n)/2,f="horizontal"===o?{x:l,y:s}:{y:l,x:s},p=this.state.formattedGraphicalItems.find(function(t){return"Scatter"===t.item.type.name});p&&(f=ey(ey({},f),p.props.points[a].tooltipPosition),c=p.props.points[a].tooltipPayload);var h={activeTooltipIndex:a,isTooltipActive:!0,activeLabel:u,activePayload:c,activeCoordinate:f};this.setState(h),this.renderCursor(i),this.accessibilityManager.setIndex(a)}}}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==e.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==t.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==t.margin){var r,n;this.accessibilityManager.setDetails({offset:{left:null!==(r=this.props.margin.left)&&void 0!==r?r:0,top:null!==(n=this.props.margin.top)&&void 0!==n?n:0}})}return null}},{key:"componentDidUpdate",value:function(t){(0,E.rL)([(0,E.sP)(t.children,O.u)],[(0,E.sP)(this.props.children,O.u)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var t=(0,E.sP)(this.props.children,O.u);if(t&&"boolean"==typeof t.props.shared){var e=t.props.shared?"axis":"item";return c.indexOf(e)>=0?e:o}return o}},{key:"getMouseInfo",value:function(t){if(!this.container)return null;var e=this.container,r=e.getBoundingClientRect(),n=(0,V.os)(r),o={chartX:Math.round(t.pageX-n.left),chartY:Math.round(t.pageY-n.top)},i=r.width/e.offsetWidth||1,a=this.inRange(o.chartX,o.chartY,i);if(!a)return null;var u=this.state,c=u.xAxisMap,l=u.yAxisMap,s=this.getTooltipEventType(),f=eE(this.state,this.props.data,this.props.layout,a);if("axis"!==s&&c&&l){var p=(0,_.Kt)(c).scale,h=(0,_.Kt)(l).scale,d=p&&p.invert?p.invert(o.chartX):null,y=h&&h.invert?h.invert(o.chartY):null;return ey(ey({},o),{},{xValue:d,yValue:y},f)}return f?ey(ey({},o),f):null}},{key:"inRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.props.layout,o=t/r,i=e/r;if("horizontal"===n||"vertical"===n){var a=this.state.offset;return o>=a.left&&o<=a.left+a.width&&i>=a.top&&i<=a.top+a.height?{x:o,y:i}:null}var u=this.state,c=u.angleAxisMap,l=u.radiusAxisMap;if(c&&l){var s=(0,_.Kt)(c);return(0,tq.z3)({x:o,y:i},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var t=this.props.children,e=this.getTooltipEventType(),r=(0,E.sP)(t,O.u),n={};return r&&"axis"===e&&(n="click"===r.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),ey(ey({},(0,tX.Ym)(this.props,this.handleOuterEvent)),n)}},{key:"addListener",value:function(){tY.on(tH,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){tY.removeListener(tH,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(t,e,r){for(var n=this.state.formattedGraphicalItems,o=0,i=n.length;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1;"insideStart"===u?(o=b+S*l,a=w):"insideEnd"===u?(o=g-S*l,a=!w):"end"===u&&(o=g+S*l,a=w),a=j<=0?a:!a;var P=(0,d.op)(p,y,O,o),E=(0,d.op)(p,y,O,o+(a?1:-1)*359),k="M".concat(P.x,",").concat(P.y,"\n A").concat(O,",").concat(O,",0,1,").concat(a?0:1,",\n ").concat(E.x,",").concat(E.y),A=i()(t.id)?(0,h.EL)("recharts-radial-line-"):t.id;return n.createElement("text",x({},r,{dominantBaseline:"central",className:(0,s.Z)("recharts-radial-bar-label",f)}),n.createElement("defs",null,n.createElement("path",{id:A,d:k})),n.createElement("textPath",{xlinkHref:"#".concat(A)},e))},j=function(t){var e=t.viewBox,r=t.offset,n=t.position,o=e.cx,i=e.cy,a=e.innerRadius,u=e.outerRadius,c=(e.startAngle+e.endAngle)/2;if("outside"===n){var l=(0,d.op)(o,i,u+r,c),s=l.x;return{x:s,y:l.y,textAnchor:s>=o?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"end"};var f=(0,d.op)(o,i,(a+u)/2,c);return{x:f.x,y:f.y,textAnchor:"middle",verticalAnchor:"middle"}},S=function(t){var e=t.viewBox,r=t.parentViewBox,n=t.offset,o=t.position,i=e.x,a=e.y,u=e.width,c=e.height,s=c>=0?1:-1,f=s*n,p=s>0?"end":"start",d=s>0?"start":"end",y=u>=0?1:-1,v=y*n,m=y>0?"end":"start",b=y>0?"start":"end";if("top"===o)return g(g({},{x:i+u/2,y:a-s*n,textAnchor:"middle",verticalAnchor:p}),r?{height:Math.max(a-r.y,0),width:u}:{});if("bottom"===o)return g(g({},{x:i+u/2,y:a+c+f,textAnchor:"middle",verticalAnchor:d}),r?{height:Math.max(r.y+r.height-(a+c),0),width:u}:{});if("left"===o){var x={x:i-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"};return g(g({},x),r?{width:Math.max(x.x-r.x,0),height:c}:{})}if("right"===o){var w={x:i+u+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"};return g(g({},w),r?{width:Math.max(r.x+r.width-w.x,0),height:c}:{})}var O=r?{width:u,height:c}:{};return"insideLeft"===o?g({x:i+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"},O):"insideRight"===o?g({x:i+u-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"},O):"insideTop"===o?g({x:i+u/2,y:a+f,textAnchor:"middle",verticalAnchor:d},O):"insideBottom"===o?g({x:i+u/2,y:a+c-f,textAnchor:"middle",verticalAnchor:p},O):"insideTopLeft"===o?g({x:i+v,y:a+f,textAnchor:b,verticalAnchor:d},O):"insideTopRight"===o?g({x:i+u-v,y:a+f,textAnchor:m,verticalAnchor:d},O):"insideBottomLeft"===o?g({x:i+v,y:a+c-f,textAnchor:b,verticalAnchor:p},O):"insideBottomRight"===o?g({x:i+u-v,y:a+c-f,textAnchor:m,verticalAnchor:p},O):l()(o)&&((0,h.hj)(o.x)||(0,h.hU)(o.x))&&((0,h.hj)(o.y)||(0,h.hU)(o.y))?g({x:i+(0,h.h1)(o.x,u),y:a+(0,h.h1)(o.y,c),textAnchor:"end",verticalAnchor:"end"},O):g({x:i+u/2,y:a+c/2,textAnchor:"middle",verticalAnchor:"middle"},O)};function P(t){var e,r=t.offset,o=g({offset:void 0===r?5:r},function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,v)),a=o.viewBox,c=o.position,l=o.value,d=o.children,y=o.content,m=o.className,b=o.textBreakAll;if(!a||i()(l)&&i()(d)&&!(0,n.isValidElement)(y)&&!u()(y))return null;if((0,n.isValidElement)(y))return(0,n.cloneElement)(y,o);if(u()(y)){if(e=(0,n.createElement)(y,o),(0,n.isValidElement)(e))return e}else e=w(o);var P="cx"in a&&(0,h.hj)(a.cx),E=(0,p.L6)(o,!0);if(P&&("insideStart"===c||"insideEnd"===c||"end"===c))return O(o,e,E);var k=P?j(o):S(o);return n.createElement(f.x,x({className:(0,s.Z)("recharts-label",void 0===m?"":m)},E,k,{breakAll:b}),e)}P.displayName="Label";var E=function(t){var e=t.cx,r=t.cy,n=t.angle,o=t.startAngle,i=t.endAngle,a=t.r,u=t.radius,c=t.innerRadius,l=t.outerRadius,s=t.x,f=t.y,p=t.top,d=t.left,y=t.width,v=t.height,m=t.clockWise,b=t.labelViewBox;if(b)return b;if((0,h.hj)(y)&&(0,h.hj)(v)){if((0,h.hj)(s)&&(0,h.hj)(f))return{x:s,y:f,width:y,height:v};if((0,h.hj)(p)&&(0,h.hj)(d))return{x:p,y:d,width:y,height:v}}return(0,h.hj)(s)&&(0,h.hj)(f)?{x:s,y:f,width:0,height:0}:(0,h.hj)(e)&&(0,h.hj)(r)?{cx:e,cy:r,startAngle:o||n||0,endAngle:i||n||0,innerRadius:c||0,outerRadius:l||u||a||0,clockWise:m}:t.viewBox?t.viewBox:{}};P.parseViewBox=E,P.renderCallByParent=function(t,e){var r,o,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&i&&!t.label)return null;var a=t.children,c=E(t),s=(0,p.NN)(a,P).map(function(t,r){return(0,n.cloneElement)(t,{viewBox:e||c,key:"label-".concat(r)})});return i?[(r=t.label,o=e||c,r?!0===r?n.createElement(P,{key:"label-implicit",viewBox:o}):(0,h.P2)(r)?n.createElement(P,{key:"label-implicit",viewBox:o,value:r}):(0,n.isValidElement)(r)?r.type===P?(0,n.cloneElement)(r,{key:"label-implicit",viewBox:o}):n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):u()(r)?n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):l()(r)?n.createElement(P,x({viewBox:o},r,{key:"label-implicit"})):null:null)].concat(function(t){if(Array.isArray(t))return m(t)}(s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return m(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s}},58772:function(t,e,r){"use strict";r.d(e,{e:function(){return P}});var n=r(2265),o=r(77571),i=r.n(o),a=r(28302),u=r.n(a),c=r(86757),l=r.n(c),s=r(86185),f=r.n(s),p=r(26680),h=r(9841),d=r(82944),y=r(85355);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var m=["valueAccessor"],b=["data","dataKey","clockWise","id","textBreakAll"];function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var S=function(t){return Array.isArray(t.value)?f()(t.value):t.value};function P(t){var e=t.valueAccessor,r=void 0===e?S:e,o=j(t,m),a=o.data,u=o.dataKey,c=o.clockWise,l=o.id,s=o.textBreakAll,f=j(o,b);return a&&a.length?n.createElement(h.m,{className:"recharts-label-list"},a.map(function(t,e){var o=i()(u)?r(t,e):(0,y.F$)(t&&t.payload,u),a=i()(l)?{}:{id:"".concat(l,"-").concat(e)};return n.createElement(p._,x({},(0,d.L6)(t,!0),f,a,{parentViewBox:t.parentViewBox,value:o,textBreakAll:s,viewBox:p._.parseViewBox(i()(c)?t:O(O({},t),{},{clockWise:c})),key:"label-".concat(e),index:e}))})):null}P.displayName="LabelList",P.renderCallByParent=function(t,e){var r,o=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&o&&!t.label)return null;var i=t.children,a=(0,d.NN)(i,P).map(function(t,r){return(0,n.cloneElement)(t,{data:e,key:"labelList-".concat(r)})});return o?[(r=t.label)?!0===r?n.createElement(P,{key:"labelList-implicit",data:e}):n.isValidElement(r)||l()(r)?n.createElement(P,{key:"labelList-implicit",data:e,content:r}):u()(r)?n.createElement(P,x({data:e},r,{key:"labelList-implicit"})):null:null].concat(function(t){if(Array.isArray(t))return g(t)}(a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,void 0)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):a}},22190:function(t,e,r){"use strict";r.d(e,{D:function(){return N}});var n=r(2265),o=r(86757),i=r.n(o),a=r(87602),u=r(1175),c=r(48777),l=r(14870),s=r(41637);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(){return(p=Object.assign?Object.assign.bind():function(t){for(var e=1;e');var x=e.inactive?h:e.color;return n.createElement("li",p({className:b,style:y,key:"legend-item-".concat(r)},(0,s.bw)(t.props,e,r)),n.createElement(c.T,{width:o,height:o,viewBox:d,style:v},t.renderIcon(e)),n.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},l?l(g,e,r):g))})}},{key:"render",value:function(){var t=this.props,e=t.payload,r=t.layout,o=t.align;return e&&e.length?n.createElement("ul",{className:"recharts-default-legend",style:{padding:0,margin:0,textAlign:"horizontal"===r?o:"left"}},this.renderItems()):null}}],function(t,e){for(var r=0;r1||Math.abs(e.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=e.width,this.lastBoundingBox.height=e.height,t&&t(e)):(-1!==this.lastBoundingBox.width||-1!==this.lastBoundingBox.height)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,t&&t(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?P({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(t){var e,r,n=this.props,o=n.layout,i=n.align,a=n.verticalAlign,u=n.margin,c=n.chartWidth,l=n.chartHeight;return t&&(void 0!==t.left&&null!==t.left||void 0!==t.right&&null!==t.right)||(e="center"===i&&"vertical"===o?{left:((c||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:u&&u.right||0}:{left:u&&u.left||0}),t&&(void 0!==t.top&&null!==t.top||void 0!==t.bottom&&null!==t.bottom)||(r="middle"===a?{top:((l||0)-this.getBBoxSnapshot().height)/2}:"bottom"===a?{bottom:u&&u.bottom||0}:{top:u&&u.top||0}),P(P({},e),r)}},{key:"render",value:function(){var t=this,e=this.props,r=e.content,o=e.width,i=e.height,a=e.wrapperStyle,u=e.payloadUniqBy,c=e.payload,l=P(P({position:"absolute",width:o||"auto",height:i||"auto"},this.getDefaultPosition(a)),a);return n.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(e){t.wrapperNode=e}},function(t,e){if(n.isValidElement(t))return n.cloneElement(t,e);if("function"==typeof t)return n.createElement(t,e);e.ref;var r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,j);return n.createElement(g,r)}(r,P(P({},this.props),{},{payload:(0,w.z)(c,u,C)})))}}],r=[{key:"getWithHeight",value:function(t,e){var r=P(P({},this.defaultProps),t.props).layout;return"vertical"===r&&(0,x.hj)(t.props.height)?{height:t.props.height}:"horizontal"===r?{width:t.props.width||e}:null}}],e&&E(o.prototype,e),r&&E(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.PureComponent);_(N,"displayName","Legend"),_(N,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"})},47625:function(t,e,r){"use strict";r.d(e,{h:function(){return d}});var n=r(87602),o=r(2265),i=r(37065),a=r.n(i),u=r(16630),c=r(1175),l=r(82944);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&(t=a()(t,S,{trailing:!0,leading:!1}));var e=new ResizeObserver(t),r=M.current.getBoundingClientRect();return D(r.width,r.height),e.observe(M.current),function(){e.disconnect()}},[D,S]);var I=(0,o.useMemo)(function(){var t=C.containerWidth,e=C.containerHeight;if(t<0||e<0)return null;(0,c.Z)((0,u.hU)(y)||(0,u.hU)(m),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",y,m),(0,c.Z)(!i||i>0,"The aspect(%s) must be greater than zero.",i);var r=(0,u.hU)(y)?t:y,n=(0,u.hU)(m)?e:m;i&&i>0&&(r?n=r/i:n&&(r=n*i),w&&n>w&&(n=w)),(0,c.Z)(r>0||n>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,n,y,m,g,x,i);var a=!Array.isArray(O)&&(0,l.Gf)(O.type).endsWith("Chart");return o.Children.map(O,function(t){return o.isValidElement(t)?(0,o.cloneElement)(t,p({width:r,height:n},a?{style:p({height:"100%",width:"100%",maxHeight:n,maxWidth:r},t.props.style)}:{})):t})},[i,O,m,w,x,g,C,y]);return o.createElement("div",{id:P?"".concat(P):void 0,className:(0,n.Z)("recharts-responsive-container",E),style:p(p({},void 0===A?{}:A),{},{width:y,height:m,minWidth:g,minHeight:x,maxHeight:w}),ref:M},I)})},58811:function(t,e,r){"use strict";r.d(e,{x:function(){return B}});var n=r(2265),o=r(77571),i=r.n(o),a=r(87602),u=r(16630),c=r(34067),l=r(82944),s=r(4094);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(function(t,e){var i=e.word,a=e.width,u=t[t.length-1];return u&&(null==n||o||u.width+a+ra||e.reduce(function(t,e){return t.width>e.width?t:e}).width>Number(n),e]},y=0,v=c.length-1,m=0;y<=v&&m<=c.length-1;){var b=Math.floor((y+v)/2),g=M(d(b-1),2),x=g[0],w=g[1],O=M(d(b),1)[0];if(x||O||(y=b+1),x&&O&&(v=b-1),!x&&O){i=w;break}m++}return i||h},D=function(t){return[{words:i()(t)?[]:t.toString().split(T)}]},I=function(t){var e=t.width,r=t.scaleToFit,n=t.children,o=t.style,i=t.breakAll,a=t.maxLines;if((e||r)&&!c.x.isSsr){var u=C({breakAll:i,children:n,style:o});return u?N({breakAll:i,children:n,maxLines:a,style:o},u.wordsWithComputedWidth,u.spaceWidth,e,r):D(n)}return D(n)},L="#808080",B=function(t){var e,r=t.x,o=void 0===r?0:r,i=t.y,c=void 0===i?0:i,s=t.lineHeight,f=void 0===s?"1em":s,p=t.capHeight,h=void 0===p?"0.71em":p,d=t.scaleToFit,y=void 0!==d&&d,v=t.textAnchor,m=t.verticalAnchor,b=t.fill,g=void 0===b?L:b,x=A(t,P),w=(0,n.useMemo)(function(){return I({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:y,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,y,x.style,x.width]),O=x.dx,j=x.dy,M=x.angle,_=x.className,T=x.breakAll,C=A(x,E);if(!(0,u.P2)(o)||!(0,u.P2)(c))return null;var N=o+((0,u.hj)(O)?O:0),D=c+((0,u.hj)(j)?j:0);switch(void 0===m?"end":m){case"start":e=S("calc(".concat(h,")"));break;case"middle":e=S("calc(".concat((w.length-1)/2," * -").concat(f," + (").concat(h," / 2))"));break;default:e=S("calc(".concat(w.length-1," * -").concat(f,")"))}var B=[];if(y){var R=w[0].width,z=x.width;B.push("scale(".concat(((0,u.hj)(z)?z/R:1)/R,")"))}return M&&B.push("rotate(".concat(M,", ").concat(N,", ").concat(D,")")),B.length&&(C.transform=B.join(" ")),n.createElement("text",k({},(0,l.L6)(C,!0),{x:N,y:D,className:(0,a.Z)("recharts-text",_),textAnchor:void 0===v?"start":v,fill:g.includes("url")?L:g}),w.map(function(t,r){var o=t.words.join(T?"":" ");return n.createElement("tspan",{x:N,dy:0===r?e:f,key:"".concat(o,"-").concat(r)},o)}))}},8147:function(t,e,r){"use strict";r.d(e,{u:function(){return $}});var n=r(2265),o=r(34935),i=r.n(o),a=r(77571),u=r.n(a),c=r(87602),l=r(16630);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){return(f=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rc[n]+s?Math.max(f,c[n]):Math.max(p,c[n])}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e1||Math.abs(t.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:t.width,height:t.height}})}else(-1!==this.state.lastBoundingBox.width||-1!==this.state.lastBoundingBox.height)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var t,e;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(t=this.props.coordinate)||void 0===t?void 0:t.x)!==this.state.dismissedAtCoordinate.x||(null===(e=this.props.coordinate)||void 0===e?void 0:e.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var t,e,r,o,i,a,u,s,f,p,h,d,y,v,m,O,j,P,E,k=this,A=this.props,M=A.active,_=A.allowEscapeViewBox,T=A.animationDuration,C=A.animationEasing,N=A.children,D=A.coordinate,I=A.hasPayload,L=A.isAnimationActive,B=A.offset,R=A.position,z=A.reverseDirection,U=A.useTranslate3d,F=A.viewBox,$=A.wrapperStyle,q=(d=(t={allowEscapeViewBox:_,coordinate:D,offsetTopLeft:B,position:R,reverseDirection:z,tooltipBox:this.state.lastBoundingBox,useTranslate3d:U,viewBox:F}).allowEscapeViewBox,y=t.coordinate,v=t.offsetTopLeft,m=t.position,O=t.reverseDirection,j=t.tooltipBox,P=t.useTranslate3d,E=t.viewBox,j.height>0&&j.width>0&&y?(r=(e={translateX:p=w({allowEscapeViewBox:d,coordinate:y,key:"x",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.width,viewBox:E,viewBoxDimension:E.width}),translateY:h=w({allowEscapeViewBox:d,coordinate:y,key:"y",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.height,viewBox:E,viewBoxDimension:E.height}),useTranslate3d:P}).translateX,o=e.translateY,f={transform:e.useTranslate3d?"translate3d(".concat(r,"px, ").concat(o,"px, 0)"):"translate(".concat(r,"px, ").concat(o,"px)")}):f=x,{cssProperties:f,cssClasses:(a=(i={translateX:p,translateY:h,coordinate:y}).coordinate,u=i.translateX,s=i.translateY,(0,c.Z)(g,b(b(b(b({},"".concat(g,"-right"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u>=a.x),"".concat(g,"-left"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u=a.y),"".concat(g,"-top"),(0,l.hj)(s)&&a&&(0,l.hj)(a.y)&&s0;return n.createElement(_,{allowEscapeViewBox:i,animationDuration:a,animationEasing:u,isAnimationActive:f,active:o,coordinate:l,hasPayload:O,offset:p,position:y,reverseDirection:m,useTranslate3d:b,viewBox:g,wrapperStyle:x},(t=I(I({},this.props),{},{payload:w}),n.isValidElement(c)?n.cloneElement(c,t):"function"==typeof c?n.createElement(c,t):n.createElement(v,t)))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),s=(0,o.Z)("recharts-layer",c);return n.createElement("g",u({className:s},(0,i.L6)(l,!0),{ref:e}),r)})},48777:function(t,e,r){"use strict";r.d(e,{T:function(){return c}});var n=r(2265),o=r(87602),i=r(82944),a=["children","width","height","viewBox","className","style","title","desc"];function u(){return(u=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),y=l||{width:r,height:c,x:0,y:0},v=(0,o.Z)("recharts-surface",s);return n.createElement("svg",u({},(0,i.L6)(d,!0,"svg"),{className:v,width:r,height:c,style:f,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height)}),n.createElement("title",null,p),n.createElement("desc",null,h),e)}},25739:function(t,e,r){"use strict";r.d(e,{br:function(){return g},CW:function(){return O},Mw:function(){return A},zn:function(){return k},sp:function(){return x},qD:function(){return E},d2:function(){return P},bH:function(){return w},Ud:function(){return S},Nf:function(){return j}});var n=r(2265),o=r(69398),i=r(84173),a=r.n(i),u=r(32242),c=r.n(u),l=r(50967),s=r.n(l)()(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),f=r(16630),p=(0,n.createContext)(void 0),h=(0,n.createContext)(void 0),d=(0,n.createContext)(void 0),y=(0,n.createContext)({}),v=(0,n.createContext)(void 0),m=(0,n.createContext)(0),b=(0,n.createContext)(0),g=function(t){var e=t.state,r=e.xAxisMap,o=e.yAxisMap,i=e.offset,a=t.clipPathId,u=t.children,c=t.width,l=t.height,f=s(i);return n.createElement(p.Provider,{value:r},n.createElement(h.Provider,{value:o},n.createElement(y.Provider,{value:i},n.createElement(d.Provider,{value:f},n.createElement(v.Provider,{value:a},n.createElement(m.Provider,{value:l},n.createElement(b.Provider,{value:c},u)))))))},x=function(){return(0,n.useContext)(v)},w=function(t){var e=(0,n.useContext)(p);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},O=function(){var t=(0,n.useContext)(p);return(0,f.Kt)(t)},j=function(){var t=(0,n.useContext)(h);return a()(t,function(t){return c()(t.domain,Number.isFinite)})||(0,f.Kt)(t)},S=function(t){var e=(0,n.useContext)(h);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},P=function(){return(0,n.useContext)(d)},E=function(){return(0,n.useContext)(y)},k=function(){return(0,n.useContext)(b)},A=function(){return(0,n.useContext)(m)}},57165:function(t,e,r){"use strict";r.d(e,{H:function(){return H}});var n=r(2265);function o(){}function i(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function a(t){this._context=t}function u(t){this._context=t}function c(t){this._context=t}a.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:i(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},u.prototype={areaStart:o,areaEnd:o,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},c.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class l{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function s(t){this._context=t}function f(t){this._context=t}function p(t){return new f(t)}function h(t,e,r){var n=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(n||o<0&&-0),a=(r-t._y1)/(o||n<0&&-0);return((i<0?-1:1)+(a<0?-1:1))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs((i*o+a*n)/(n+o)))||0}function d(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function y(t,e,r){var n=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-n)/3;t._context.bezierCurveTo(n+u,o+u*e,i-u,a-u*r,i,a)}function v(t){this._context=t}function m(t){this._context=new b(t)}function b(t){this._context=t}function g(t){this._context=t}function x(t){var e,r,n=t.length-1,o=Array(n),i=Array(n),a=Array(n);for(o[0]=0,i[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)o[e]=(a[e]-o[e+1])/i[e];for(e=0,i[n-1]=(t[n]+o[n-1])/2;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}};var O=r(22516),j=r(76115),S=r(67790);function P(t){return t[0]}function E(t){return t[1]}function k(t,e){var r=(0,j.Z)(!0),n=null,o=p,i=null,a=(0,S.d)(u);function u(u){var c,l,s,f=(u=(0,O.Z)(u)).length,p=!1;for(null==n&&(i=o(s=a())),c=0;c<=f;++c)!(c=f;--p)u.point(m[p],b[p]);u.lineEnd(),u.areaEnd()}}v&&(m[s]=+t(h,s,l),b[s]=+e(h,s,l),u.point(n?+n(h,s,l):m[s],r?+r(h,s,l):b[s]))}if(d)return u=null,d+""||null}function s(){return k().defined(o).curve(a).context(i)}return t="function"==typeof t?t:void 0===t?P:(0,j.Z)(+t),e="function"==typeof e?e:void 0===e?(0,j.Z)(0):(0,j.Z)(+e),r="function"==typeof r?r:void 0===r?E:(0,j.Z)(+r),l.x=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),n=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),l):t},l.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):n},l.y=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),r=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),l):e},l.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):r},l.lineX0=l.lineY0=function(){return s().x(t).y(e)},l.lineY1=function(){return s().x(t).y(r)},l.lineX1=function(){return s().x(n).y(e)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:(0,j.Z)(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=i&&(u=a(i)),l):a},l.context=function(t){return arguments.length?(null==t?i=u=null:u=a(i=t),l):i},l}var M=r(75551),_=r.n(M),T=r(86757),C=r.n(T),N=r(87602),D=r(41637),I=r(82944),L=r(16630);function B(t){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(){return(R=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1,c=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0;if(a>0&&o instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=o[f]>a?a:o[f];i="M".concat(t,",").concat(e+u*s[0]),s[0]>0&&(i+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(l,",").concat(t+c*s[0],",").concat(e)),i+="L ".concat(t+r-c*s[1],",").concat(e),s[1]>0&&(i+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(l,",\n ").concat(t+r,",").concat(e+u*s[1])),i+="L ".concat(t+r,",").concat(e+n-u*s[2]),s[2]>0&&(i+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(l,",\n ").concat(t+r-c*s[2],",").concat(e+n)),i+="L ".concat(t+c*s[3],",").concat(e+n),s[3]>0&&(i+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(l,",\n ").concat(t,",").concat(e+n-u*s[3])),i+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);i="M ".concat(t,",").concat(e+u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+c*p,",").concat(e,"\n L ").concat(t+r-c*p,",").concat(e,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r,",").concat(e+u*p,"\n L ").concat(t+r,",").concat(e+n-u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r-c*p,",").concat(e+n,"\n L ").concat(t+c*p,",").concat(e+n,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t,",").concat(e+n-u*p," Z")}else i="M ".concat(t,",").concat(e," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return i},h=function(t,e){if(!t||!e)return!1;var r=t.x,n=t.y,o=e.x,i=e.y,a=e.width,u=e.height;return!!(Math.abs(a)>0&&Math.abs(u)>0)&&r>=Math.min(o,o+a)&&r<=Math.max(o,o+a)&&n>=Math.min(i,i+u)&&n<=Math.max(i,i+u)},d={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y=function(t){var e,r=f(f({},d),t),u=(0,n.useRef)(),s=function(t){if(Array.isArray(t))return t}(e=(0,n.useState)(-1))||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,2)||function(t,e){if(t){if("string"==typeof t)return l(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,2)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),h=s[0],y=s[1];(0,n.useEffect)(function(){if(u.current&&u.current.getTotalLength)try{var t=u.current.getTotalLength();t&&y(t)}catch(t){}},[]);var v=r.x,m=r.y,b=r.width,g=r.height,x=r.radius,w=r.className,O=r.animationEasing,j=r.animationDuration,S=r.animationBegin,P=r.isAnimationActive,E=r.isUpdateAnimationActive;if(v!==+v||m!==+m||b!==+b||g!==+g||0===b||0===g)return null;var k=(0,o.Z)("recharts-rectangle",w);return E?n.createElement(i.ZP,{canBegin:h>0,from:{width:b,height:g,x:v,y:m},to:{width:b,height:g,x:v,y:m},duration:j,animationEasing:O,isActive:E},function(t){var e=t.width,o=t.height,l=t.x,s=t.y;return n.createElement(i.ZP,{canBegin:h>0,from:"0px ".concat(-1===h?1:h,"px"),to:"".concat(h,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,isActive:P,easing:O},n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(l,s,e,o,x),ref:u})))}):n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(v,m,b,g,x)}))}},60474:function(t,e,r){"use strict";r.d(e,{L:function(){return v}});var n=r(2265),o=r(87602),i=r(82944),a=r(39206),u=r(16630);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>s),",\n ").concat(p.x,",").concat(p.y,"\n ");if(o>0){var d=(0,a.op)(r,n,o,c),y=(0,a.op)(r,n,o,s);h+="L ".concat(y.x,",").concat(y.y,"\n A ").concat(o,",").concat(o,",0,\n ").concat(+(Math.abs(l)>180),",").concat(+(c<=s),",\n ").concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},d=function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,a=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,s=t.endAngle,f=(0,u.uY)(s-l),d=p({cx:e,cy:r,radius:o,angle:l,sign:f,cornerRadius:i,cornerIsExternal:c}),y=d.circleTangency,v=d.lineTangency,m=d.theta,b=p({cx:e,cy:r,radius:o,angle:s,sign:-f,cornerRadius:i,cornerIsExternal:c}),g=b.circleTangency,x=b.lineTangency,w=b.theta,O=c?Math.abs(l-s):Math.abs(l-s)-m-w;if(O<0)return a?"M ".concat(v.x,",").concat(v.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(-(2*i),",0\n "):h({cx:e,cy:r,innerRadius:n,outerRadius:o,startAngle:l,endAngle:s});var j="M ".concat(v.x,",").concat(v.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,"\n A").concat(o,",").concat(o,",0,").concat(+(O>180),",").concat(+(f<0),",").concat(g.x,",").concat(g.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,"\n ");if(n>0){var S=p({cx:e,cy:r,radius:n,angle:l,sign:f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),P=S.circleTangency,E=S.lineTangency,k=S.theta,A=p({cx:e,cy:r,radius:n,angle:s,sign:-f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),M=A.circleTangency,_=A.lineTangency,T=A.theta,C=c?Math.abs(l-s):Math.abs(l-s)-k-T;if(C<0&&0===i)return"".concat(j,"L").concat(e,",").concat(r,"Z");j+="L".concat(_.x,",").concat(_.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,"\n A").concat(n,",").concat(n,",0,").concat(+(C>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,"Z")}else j+="L".concat(e,",").concat(r,"Z");return j},y={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},v=function(t){var e,r=f(f({},y),t),a=r.cx,c=r.cy,s=r.innerRadius,p=r.outerRadius,v=r.cornerRadius,m=r.forceCornerRadius,b=r.cornerIsExternal,g=r.startAngle,x=r.endAngle,w=r.className;if(p0&&360>Math.abs(g-x)?d({cx:a,cy:c,innerRadius:s,outerRadius:p,cornerRadius:Math.min(S,j/2),forceCornerRadius:m,cornerIsExternal:b,startAngle:g,endAngle:x}):h({cx:a,cy:c,innerRadius:s,outerRadius:p,startAngle:g,endAngle:x}),n.createElement("path",l({},(0,i.L6)(r,!0),{className:O,d:e,role:"img"}))}},14870:function(t,e,r){"use strict";r.d(e,{v:function(){return N}});var n=r(2265),o=r(75551),i=r.n(o);let a=Math.cos,u=Math.sin,c=Math.sqrt,l=Math.PI,s=2*l;var f={draw(t,e){let r=c(e/l);t.moveTo(r,0),t.arc(0,0,r,0,s)}};let p=c(1/3),h=2*p,d=u(l/10)/u(7*l/10),y=u(s/10)*d,v=-a(s/10)*d,m=c(3),b=c(3)/2,g=1/c(12),x=(g/2+1)*3;var w=r(76115),O=r(67790);c(3),c(3);var j=r(87602),S=r(82944);function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var E=["type","size","sizeType"];function k(){return(k=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,E)),{},{type:o,size:u,sizeType:l}),p=s.className,h=s.cx,d=s.cy,y=(0,S.L6)(s,!0);return h===+h&&d===+d&&u===+u?n.createElement("path",k({},y,{className:(0,j.Z)("recharts-symbols",p),transform:"translate(".concat(h,", ").concat(d,")"),d:(e=_["symbol".concat(i()(o))]||f,(function(t,e){let r=null,n=(0,O.d)(o);function o(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return t="function"==typeof t?t:(0,w.Z)(t||f),e="function"==typeof e?e:(0,w.Z)(void 0===e?64:+e),o.type=function(e){return arguments.length?(t="function"==typeof e?e:(0,w.Z)(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:(0,w.Z)(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o})().type(e).size(C(u,l,o))())})):null};N.registerSymbol=function(t,e){_["symbol".concat(i()(t))]=e}},11638:function(t,e,r){"use strict";r.d(e,{bn:function(){return C},a3:function(){return z},lT:function(){return N},V$:function(){return D},w7:function(){return I}});var n=r(2265),o=r(86757),i=r.n(o),a=r(90231),u=r.n(a),c=r(24342),l=r.n(c),s=r(21652),f=r.n(s),p=r(73649),h=r(87602),d=r(84735),y=r(82944);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){return(m=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:l},to:{upperWidth:s,lowerWidth:f,height:p,x:c,y:l},duration:j,animationEasing:g,isActive:P},function(t){var e=t.upperWidth,i=t.lowerWidth,u=t.height,c=t.x,l=t.y;return n.createElement(d.ZP,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,easing:g},n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,e,i,u),ref:o})))}):n.createElement("g",null,n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,s,f,p)})))},S=r(60474),P=r(9841),E=r(14870),k=["option","shapeType","propTransformer","activeClassName","isActive"];function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,k);if((0,n.isValidElement)(r))e=(0,n.cloneElement)(r,_(_({},f),(0,n.isValidElement)(r)?r.props:r));else if(i()(r))e=r(f);else if(u()(r)&&!l()(r)){var p=(void 0===a?function(t,e){return _(_({},e),t)}:a)(r,f);e=n.createElement(T,{shapeType:o,elementProps:p})}else e=n.createElement(T,{shapeType:o,elementProps:f});return s?n.createElement(P.m,{className:void 0===c?"recharts-active-shape":c},e):e}function N(t,e){return null!=e&&"trapezoids"in t.props}function D(t,e){return null!=e&&"sectors"in t.props}function I(t,e){return null!=e&&"points"in t.props}function L(t,e){var r,n,o=t.x===(null==e||null===(r=e.labelViewBox)||void 0===r?void 0:r.x)||t.x===e.x,i=t.y===(null==e||null===(n=e.labelViewBox)||void 0===n?void 0:n.y)||t.y===e.y;return o&&i}function B(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function R(t,e){var r=t.x===e.x,n=t.y===e.y,o=t.z===e.z;return r&&n&&o}function z(t){var e,r,n,o=t.activeTooltipItem,i=t.graphicalItem,a=t.itemData,u=(N(i,o)?e="trapezoids":D(i,o)?e="sectors":I(i,o)&&(e="points"),e),c=N(i,o)?null===(r=o.tooltipPayload)||void 0===r||null===(r=r[0])||void 0===r||null===(r=r.payload)||void 0===r?void 0:r.payload:D(i,o)?null===(n=o.tooltipPayload)||void 0===n||null===(n=n[0])||void 0===n||null===(n=n.payload)||void 0===n?void 0:n.payload:I(i,o)?o.payload:{},l=a.filter(function(t,e){var r=f()(c,t),n=i.props[u].filter(function(t){var e;return(N(i,o)?e=L:D(i,o)?e=B:I(i,o)&&(e=R),e)(t,o)}),a=i.props[u].indexOf(n[n.length-1]);return r&&e===a});return a.indexOf(l[l.length-1])}},25311:function(t,e,r){"use strict";r.d(e,{Ky:function(){return w},O1:function(){return b},_b:function(){return g},t9:function(){return m},xE:function(){return O}});var n=r(41443),o=r.n(n),i=r(32242),a=r.n(i),u=r(85355),c=r(82944),l=r(16630),s=r(31699);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r0&&(A=Math.min((t||0)-(M[e-1]||0),A))}),Number.isFinite(A)){var _=A/k,T="vertical"===g.layout?r.height:r.width;if("gap"===g.padding&&(c=_*T/2),"no-gap"===g.padding){var C=(0,l.h1)(t.barCategoryGap,_*T),N=_*T/2;c=N-C-(N-C)/T*C}}}s="xAxis"===n?[r.left+(j.left||0)+(c||0),r.left+r.width-(j.right||0)-(c||0)]:"yAxis"===n?"horizontal"===f?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(c||0),r.top+r.height-(j.bottom||0)-(c||0)]:g.range,P&&(s=[s[1],s[0]]);var D=(0,u.Hq)(g,o,m),I=D.scale,L=D.realScaleType;I.domain(w).range(s),(0,u.zF)(I);var B=(0,u.g$)(I,d(d({},g),{},{realScaleType:L}));"xAxis"===n?(b="top"===x&&!S||"bottom"===x&&S,p=r.left,h=v[E]-b*g.height):"yAxis"===n&&(b="left"===x&&!S||"right"===x&&S,p=v[E]-b*g.width,h=r.top);var R=d(d(d({},g),B),{},{realScaleType:L,x:p,y:h,scale:I,width:"xAxis"===n?r.width:g.width,height:"yAxis"===n?r.height:g.height});return R.bandSize=(0,u.zT)(R,B),g.hide||"xAxis"!==n?g.hide||(v[E]+=(b?-1:1)*R.width):v[E]+=(b?-1:1)*R.height,d(d({},i),{},y({},a,R))},{})},b=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return{x:Math.min(r,o),y:Math.min(n,i),width:Math.abs(o-r),height:Math.abs(i-n)}},g=function(t){return b({x:t.x1,y:t.y1},{x:t.x2,y:t.y2})},x=function(){var t,e;function r(t){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,r),this.scale=t}return t=[{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(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.bandAware,n=e.position;if(void 0!==t){if(n)switch(n){case"start":default:return this.scale(t);case"middle":var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}},{key:"isInRange",value:function(t){var e=this.range(),r=e[0],n=e[e.length-1];return r<=n?t>=r&&t<=n:t>=n&&t<=r}}],e=[{key:"create",value:function(t){return new r(t)}}],t&&p(r.prototype,t),e&&p(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}();y(x,"EPS",1e-4);var w=function(t){var e=Object.keys(t).reduce(function(e,r){return d(d({},e),{},y({},r,x.create(t[r])))},{});return d(d({},e),{},{apply:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.bandAware,i=r.position;return o()(t,function(t,r){return e[r].apply(t,{bandAware:n,position:i})})},isInRange:function(t){return a()(t,function(t,r){return e[r].isInRange(t)})}})},O=function(t){var e=t.width,r=t.height,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(n%180+180)%180*Math.PI/180,i=Math.atan(r/e);return Math.abs(o>i&&otx(e,t()).base(e.base()),tj.o.apply(e,arguments),e}},scaleOrdinal:function(){return tX.Z},scalePoint:function(){return f.x},scalePow:function(){return tJ},scaleQuantile:function(){return function t(){var e,r=[],n=[],o=[];function i(){var t=0,e=Math.max(1,n.length);for(o=Array(e-1);++t=1)return+r(t[n-1],n-1,t);var n,o=(n-1)*e,i=Math.floor(o),a=+r(t[i],i,t);return a+(+r(t[i+1],i+1,t)-a)*(o-i)}}(r,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:n[P(o,t)]}return a.invertExtent=function(t){var e=n.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e=o?[i[o-1],n]:[i[e-1],i[e]]},u.unknown=function(t){return arguments.length&&(e=t),u},u.thresholds=function(){return i.slice()},u.copy=function(){return t().domain([r,n]).range(a).unknown(e)},tj.o.apply(tI(u),arguments)}},scaleRadial:function(){return function t(){var e,r=tO(),n=[0,1],o=!1;function i(t){var n,i=Math.sign(n=r(t))*Math.sqrt(Math.abs(n));return isNaN(i)?e:o?Math.round(i):i}return i.invert=function(t){return r.invert(t1(t))},i.domain=function(t){return arguments.length?(r.domain(t),i):r.domain()},i.range=function(t){return arguments.length?(r.range((n=Array.from(t,td)).map(t1)),i):n.slice()},i.rangeRound=function(t){return i.range(t).round(!0)},i.round=function(t){return arguments.length?(o=!!t,i):o},i.clamp=function(t){return arguments.length?(r.clamp(t),i):r.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(r.domain(),n).round(o).clamp(r.clamp()).unknown(e)},tj.o.apply(i,arguments),tI(i)}},scaleSequential:function(){return function t(){var e=tI(rX()(tv));return e.copy=function(){return rG(e,t())},tj.O.apply(e,arguments)}},scaleSequentialLog:function(){return function t(){var e=tZ(rX()).domain([1,10]);return e.copy=function(){return rG(e,t()).base(e.base())},tj.O.apply(e,arguments)}},scaleSequentialPow:function(){return rV},scaleSequentialQuantile:function(){return function t(){var e=[],r=tv;function n(t){if(null!=t&&!isNaN(t=+t))return r((P(e,t,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let r of(e=[],t))null==r||isNaN(r=+r)||e.push(r);return e.sort(g),n},n.interpolator=function(t){return arguments.length?(r=t,n):r},n.range=function(){return e.map((t,n)=>r(n/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(r,n)=>(function(t,e,r){if(!(!(n=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,void 0))).length)||isNaN(e=+e))){if(e<=0||n<2)return t5(t);if(e>=1)return t2(t);var n,o=(n-1)*e,i=Math.floor(o),a=t2((function t(e,r,n=0,o=1/0,i){if(r=Math.floor(r),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(e.length-1,o)),!(n<=r&&r<=o))return e;for(i=void 0===i?t6:function(t=g){if(t===g)return t6;if("function"!=typeof t)throw TypeError("compare is not a function");return(e,r)=>{let n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}(i);o>n;){if(o-n>600){let a=o-n+1,u=r-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),s=.5*Math.sqrt(c*l*(a-l)/a)*(u-a/2<0?-1:1),f=Math.max(n,Math.floor(r-u*l/a+s)),p=Math.min(o,Math.floor(r+(a-u)*l/a+s));t(e,r,f,p,i)}let a=e[r],u=n,c=o;for(t3(e,n,r),i(e[o],a)>0&&t3(e,n,o);ui(e[u],a);)++u;for(;i(e[c],a)>0;)--c}0===i(e[n],a)?t3(e,n,c):t3(e,++c,o),c<=r&&(n=c+1),r<=c&&(o=c-1)}return e})(t,i).subarray(0,i+1));return a+(t5(t.subarray(i+1))-a)*(o-i)}})(e,n/t))},n.copy=function(){return t(r).domain(e)},tj.O.apply(n,arguments)}},scaleSequentialSqrt:function(){return rK},scaleSequentialSymlog:function(){return function t(){var e=tH(rX());return e.copy=function(){return rG(e,t()).constant(e.constant())},tj.O.apply(e,arguments)}},scaleSqrt:function(){return t0},scaleSymlog:function(){return function t(){var e=tH(tw());return e.copy=function(){return tx(e,t()).constant(e.constant())},tj.o.apply(e,arguments)}},scaleThreshold:function(){return function t(){var e,r=[.5],n=[0,1],o=1;function i(t){return null!=t&&t<=t?n[P(r,t,0,o)]:e}return i.domain=function(t){return arguments.length?(o=Math.min((r=Array.from(t)).length,n.length-1),i):r.slice()},i.range=function(t){return arguments.length?(n=Array.from(t),o=Math.min(r.length,n.length-1),i):n.slice()},i.invertExtent=function(t){var e=n.indexOf(t);return[r[e-1],r[e]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t().domain(r).range(n).unknown(e)},tj.o.apply(i,arguments)}},scaleTime:function(){return rY},scaleUtc:function(){return rH},tickFormat:function(){return tD}});var f=r(55284);let p=Math.sqrt(50),h=Math.sqrt(10),d=Math.sqrt(2);function y(t,e,r){let n,o,i;let a=(e-t)/Math.max(0,r),u=Math.floor(Math.log10(a)),c=a/Math.pow(10,u),l=c>=p?10:c>=h?5:c>=d?2:1;return(u<0?(n=Math.round(t*(i=Math.pow(10,-u)/l)),o=Math.round(e*i),n/ie&&--o,i=-i):(n=Math.round(t/(i=Math.pow(10,u)*l)),o=Math.round(e/i),n*ie&&--o),o0))return[];if(t===e)return[t];let n=e=o))return[];let u=i-o+1,c=Array(u);if(n){if(a<0)for(let t=0;te?1:t>=e?0:NaN}function x(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function w(t){let e,r,n;function o(t,n,o=0,i=t.length){if(o>>1;0>r(t[e],n)?o=e+1:i=e}while(og(t(e),r),n=(e,r)=>t(e)-r):(e=t===g||t===x?t:O,r=t,n=t),{left:o,center:function(t,e,r=0,i=t.length){let a=o(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,o=0,i=t.length){if(o>>1;0>=r(t[e],n)?o=e+1:i=e}while(o>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Z(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Z(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=N.exec(t))?new Y(e[1],e[2],e[3],1):(e=D.exec(t))?new Y(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=I.exec(t))?Z(e[1],e[2],e[3],e[4]):(e=L.exec(t))?Z(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=B.exec(t))?Q(e[1],e[2]/100,e[3]/100,1):(e=R.exec(t))?Q(e[1],e[2]/100,e[3]/100,e[4]):z.hasOwnProperty(t)?q(z[t]):"transparent"===t?new Y(NaN,NaN,NaN,0):null}function q(t){return new Y(t>>16&255,t>>8&255,255&t,1)}function Z(t,e,r,n){return n<=0&&(t=e=r=NaN),new Y(t,e,r,n)}function W(t,e,r,n){var o;return 1==arguments.length?((o=t)instanceof A||(o=$(o)),o)?new Y((o=o.rgb()).r,o.g,o.b,o.opacity):new Y:new Y(t,e,r,null==n?1:n)}function Y(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function H(){return`#${K(this.r)}${K(this.g)}${K(this.b)}`}function X(){let t=G(this.opacity);return`${1===t?"rgb(":"rgba("}${V(this.r)}, ${V(this.g)}, ${V(this.b)}${1===t?")":`, ${t})`}`}function G(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function V(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function K(t){return((t=V(t))<16?"0":"")+t.toString(16)}function Q(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tt(t,e,r,n)}function J(t){if(t instanceof tt)return new tt(t.h,t.s,t.l,t.opacity);if(t instanceof A||(t=$(t)),!t)return new tt;if(t instanceof tt)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,u=i-o,c=(i+o)/2;return u?(a=e===i?(r-n)/u+(r0&&c<1?0:a,new tt(a,u,c,t.opacity)}function tt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function te(t){return(t=(t||0)%360)<0?t+360:t}function tr(t){return Math.max(0,Math.min(1,t||0))}function tn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function to(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}E(A,$,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:U,formatHex:U,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return J(this).formatHsl()},formatRgb:F,toString:F}),E(Y,W,k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Y(V(this.r),V(this.g),V(this.b),G(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:H,formatHex:H,formatHex8:function(){return`#${K(this.r)}${K(this.g)}${K(this.b)}${K((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:X,toString:X})),E(tt,function(t,e,r,n){return 1==arguments.length?J(t):new tt(t,e,r,null==n?1:n)},k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Y(tn(t>=240?t-240:t+120,o,n),tn(t,o,n),tn(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new tt(te(this.h),tr(this.s),tr(this.l),G(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=G(this.opacity);return`${1===t?"hsl(":"hsla("}${te(this.h)}, ${100*tr(this.s)}%, ${100*tr(this.l)}%${1===t?")":`, ${t})`}`}}));var ti=t=>()=>t;function ta(t,e){var r=e-t;return r?function(e){return t+e*r}:ti(isNaN(t)?e:t)}var tu=function t(e){var r,n=1==(r=+(r=e))?ta:function(t,e){var n,o,i;return e-t?(n=t,o=e,n=Math.pow(n,i=r),o=Math.pow(o,i)-n,i=1/i,function(t){return Math.pow(n+t*o,i)}):ti(isNaN(t)?e:t)};function o(t,e){var r=n((t=W(t)).r,(e=W(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=ta(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function tc(t){return function(e){var r,n,o=e.length,i=Array(o),a=Array(o),u=Array(o);for(r=0;r=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,u=nu&&(a=e.slice(u,a),l[c]?l[c]+=a:l[++c]=a),(o=o[0])===(i=i[0])?l[c]?l[c]+=i:l[++c]=i:(l[++c]=null,s.push({i:c,x:tl(o,i)})),u=tf.lastIndex;return ue&&(r=t,t=e,e=r),l=function(r){return Math.max(t,Math.min(e,r))}),n=c>2?tg:tb,o=i=null,f}function f(e){return null==e||isNaN(e=+e)?r:(o||(o=n(a.map(t),u,c)))(t(l(e)))}return f.invert=function(r){return l(e((i||(i=n(u,a.map(t),tl)))(r)))},f.domain=function(t){return arguments.length?(a=Array.from(t,td),s()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),c=th,s()},f.clamp=function(t){return arguments.length?(l=!!t||tv,s()):l!==tv},f.interpolate=function(t){return arguments.length?(c=t,s()):c},f.unknown=function(t){return arguments.length?(r=t,f):r},function(r,n){return t=r,e=n,s()}}function tO(){return tw()(tv,tv)}var tj=r(89999),tS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tP(t){var e;if(!(e=tS.exec(t)))throw Error("invalid format: "+t);return new tE({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function tE(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function tk(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function tA(t){return(t=tk(Math.abs(t)))?t[1]:NaN}function tM(t,e){var r=tk(t,e);if(!r)return t+"";var n=r[0],o=r[1];return o<0?"0."+Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+Array(o-n.length+2).join("0")}tP.prototype=tE.prototype,tE.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var t_={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>tM(100*t,e),r:tM,s:function(t,e){var r=tk(t,e);if(!r)return t+"";var o=r[0],i=r[1],a=i-(n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=o.length;return a===u?o:a>u?o+Array(a-u+1).join("0"):a>0?o.slice(0,a)+"."+o.slice(a):"0."+Array(1-a).join("0")+tk(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tT(t){return t}var tC=Array.prototype.map,tN=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function tD(t,e,r,n){var o,u,c=b(t,e,r);switch((n=tP(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(u=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tA(l)/3)))-tA(Math.abs(c))))||(n.precision=u),a(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(u=Math.max(0,tA(Math.abs(Math.max(Math.abs(t),Math.abs(e)))-(o=Math.abs(o=c)))-tA(o))+1)||(n.precision=u-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(u=Math.max(0,-tA(Math.abs(c))))||(n.precision=u-("%"===n.type)*2)}return i(n)}function tI(t){var e=t.domain;return t.ticks=function(t){var r=e();return v(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return tD(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,o,i=e(),a=0,u=i.length-1,c=i[a],l=i[u],s=10;for(l0;){if((o=m(c,l,r))===n)return i[a]=c,i[u]=l,e(i);if(o>0)c=Math.floor(c/o)*o,l=Math.ceil(l/o)*o;else if(o<0)c=Math.ceil(c*o)/o,l=Math.floor(l*o)/o;else break;n=o}return t},t}function tL(){var t=tO();return t.copy=function(){return tx(t,tL())},tj.o.apply(t,arguments),tI(t)}function tB(t,e){t=t.slice();var r,n=0,o=t.length-1,i=t[n],a=t[o];return a-t(-e,r)}function tZ(t){let e,r;let n=t(tR,tz),o=n.domain,a=10;function u(){var i,u;return e=(i=a)===Math.E?Math.log:10===i&&Math.log10||2===i&&Math.log2||(i=Math.log(i),t=>Math.log(t)/i),r=10===(u=a)?t$:u===Math.E?Math.exp:t=>Math.pow(u,t),o()[0]<0?(e=tq(e),r=tq(r),t(tU,tF)):t(tR,tz),n}return n.base=function(t){return arguments.length?(a=+t,u()):a},n.domain=function(t){return arguments.length?(o(t),u()):o()},n.ticks=t=>{let n,i;let u=o(),c=u[0],l=u[u.length-1],s=l0){for(;f<=p;++f)for(n=1;nl)break;d.push(i)}}else for(;f<=p;++f)for(n=a-1;n>=1;--n)if(!((i=f>0?n/r(-f):n*r(f))l)break;d.push(i)}2*d.length{if(null==t&&(t=10),null==o&&(o=10===a?"s":","),"function"!=typeof o&&(a%1||null!=(o=tP(o)).precision||(o.trim=!0),o=i(o)),t===1/0)return o;let u=Math.max(1,a*t/n.ticks().length);return t=>{let n=t/r(Math.round(e(t)));return n*ao(tB(o(),{floor:t=>r(Math.floor(e(t))),ceil:t=>r(Math.ceil(e(t)))})),n}function tW(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function tY(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function tH(t){var e=1,r=t(tW(1),tY(e));return r.constant=function(r){return arguments.length?t(tW(e=+r),tY(e)):e},tI(r)}i=(o=function(t){var e,r,o,i=void 0===t.grouping||void 0===t.thousands?tT:(e=tC.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var o=t.length,i=[],a=0,u=e[0],c=0;o>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),i.push(t.substring(o-=u,o+u)),!((c+=u+1)>n));)u=e[a=(a+1)%e.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",c=void 0===t.decimal?".":t.decimal+"",l=void 0===t.numerals?tT:(o=tC.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return o[+t]})}),s=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",p=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=tP(t)).fill,r=t.align,o=t.sign,h=t.symbol,d=t.zero,y=t.width,v=t.comma,m=t.precision,b=t.trim,g=t.type;"n"===g?(v=!0,g="g"):t_[g]||(void 0===m&&(m=12),b=!0,g="g"),(d||"0"===e&&"="===r)&&(d=!0,e="0",r="=");var x="$"===h?a:"#"===h&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===h?u:/[%p]/.test(g)?s:"",O=t_[g],j=/[defgprs%]/.test(g);function S(t){var a,u,s,h=x,S=w;if("c"===g)S=O(t)+S,t="";else{var P=(t=+t)<0||1/t<0;if(t=isNaN(t)?p:O(Math.abs(t),m),b&&(t=function(t){e:for(var e,r=t.length,n=1,o=-1;n0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),P&&0==+t&&"+"!==o&&(P=!1),h=(P?"("===o?o:f:"-"===o||"("===o?"":o)+h,S=("s"===g?tN[8+n/3]:"")+S+(P&&"("===o?")":""),j){for(a=-1,u=t.length;++a(s=t.charCodeAt(a))||s>57){S=(46===s?c+t.slice(a+1):t.slice(a))+S,t=t.slice(0,a);break}}}v&&!d&&(t=i(t,1/0));var E=h.length+t.length+S.length,k=E>1)+h+t+S+k.slice(E);break;default:t=k+h+t+S}return l(t)}return m=void 0===m?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),S.toString=function(){return t+""},S}return{format:h,formatPrefix:function(t,e){var r=h(((t=tP(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(tA(e)/3))),o=Math.pow(10,-n),i=tN[8+n/3];return function(t){return r(o*t)+i}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,a=o.formatPrefix;var tX=r(36967);function tG(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function tV(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function tK(t){return t<0?-t*t:t*t}function tQ(t){var e=t(tv,tv),r=1;return e.exponent=function(e){return arguments.length?1==(r=+e)?t(tv,tv):.5===r?t(tV,tK):t(tG(r),tG(1/r)):r},tI(e)}function tJ(){var t=tQ(tw());return t.copy=function(){return tx(t,tJ()).exponent(t.exponent())},tj.o.apply(t,arguments),t}function t0(){return tJ.apply(null,arguments).exponent(.5)}function t1(t){return Math.sign(t)*t*t}function t2(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r=o)&&(r=o)}return r}function t5(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function t6(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function t3(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}let t7=new Date,t8=new Date;function t4(t,e,r,n){function o(e){return t(e=0==arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),o.round=t=>{let e=o(t),r=o.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),o.range=(r,n,i)=>{let a;let u=[];if(r=o.ceil(r),i=null==i?1:Math.floor(i),!(r0))return u;do u.push(a=new Date(+r)),e(r,i),t(r);while(at4(e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)},(t,n)=>{if(t>=t){if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););}}),r&&(o.count=(e,n)=>(t7.setTime(+e),t8.setTime(+n),t(t7),t(t8),Math.floor(r(t7,t8))),o.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?o.filter(n?e=>n(e)%t==0:e=>o.count(0,e)%t==0):o:null),o}let t9=t4(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);t9.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?t4(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):t9:null,t9.range;let et=t4(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+1e3*e)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds());et.range;let ee=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getMinutes());ee.range;let er=t4(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes());er.range;let en=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getHours());en.range;let eo=t4(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours());eo.range;let ei=t4(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1);ei.range;let ea=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1);ea.range;let eu=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5));function ec(t){return t4(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}eu.range;let el=ec(0),es=ec(1),ef=ec(2),ep=ec(3),eh=ec(4),ed=ec(5),ey=ec(6);function ev(t){return t4(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/6048e5)}el.range,es.range,ef.range,ep.range,eh.range,ed.range,ey.range;let em=ev(0),eb=ev(1),eg=ev(2),ex=ev(3),ew=ev(4),eO=ev(5),ej=ev(6);em.range,eb.range,eg.range,ex.range,ew.range,eO.range,ej.range;let eS=t4(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());eS.range;let eP=t4(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());eP.range;let eE=t4(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());eE.every=t=>isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)}):null,eE.range;let ek=t4(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function eA(t,e,r,n,o,i){let a=[[et,1,1e3],[et,5,5e3],[et,15,15e3],[et,30,3e4],[i,1,6e4],[i,5,3e5],[i,15,9e5],[i,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[n,1,864e5],[n,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function u(e,r,n){let o=Math.abs(r-e)/n,i=w(([,,t])=>t).right(a,o);if(i===a.length)return t.every(b(e/31536e6,r/31536e6,n));if(0===i)return t9.every(Math.max(b(e,r,n),1));let[u,c]=a[o/a[i-1][2]isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)}):null,ek.range;let[eM,e_]=eA(ek,eP,em,eu,eo,er),[eT,eC]=eA(eE,eS,el,ei,en,ee);function eN(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function eD(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function eI(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}var eL={"-":"",_:" ",0:"0"},eB=/^\s*\d+/,eR=/^%/,ez=/[\\^$*+?|[\]().{}]/g;function eU(t,e,r){var n=t<0?"-":"",o=(n?-t:t)+"",i=o.length;return n+(i[t.toLowerCase(),e]))}function eZ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function eW(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function eY(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function eH(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function eX(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function eG(t,e,r){var n=eB.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function eV(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function eK(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function eQ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function eJ(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function e0(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function e1(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function e2(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function e5(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function e6(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function e3(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function e7(t,e,r){var n=eB.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function e8(t,e,r){var n=eR.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function e4(t,e,r){var n=eB.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function e9(t,e,r){var n=eB.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function rt(t,e){return eU(t.getDate(),e,2)}function re(t,e){return eU(t.getHours(),e,2)}function rr(t,e){return eU(t.getHours()%12||12,e,2)}function rn(t,e){return eU(1+ei.count(eE(t),t),e,3)}function ro(t,e){return eU(t.getMilliseconds(),e,3)}function ri(t,e){return ro(t,e)+"000"}function ra(t,e){return eU(t.getMonth()+1,e,2)}function ru(t,e){return eU(t.getMinutes(),e,2)}function rc(t,e){return eU(t.getSeconds(),e,2)}function rl(t){var e=t.getDay();return 0===e?7:e}function rs(t,e){return eU(el.count(eE(t)-1,t),e,2)}function rf(t){var e=t.getDay();return e>=4||0===e?eh(t):eh.ceil(t)}function rp(t,e){return t=rf(t),eU(eh.count(eE(t),t)+(4===eE(t).getDay()),e,2)}function rh(t){return t.getDay()}function rd(t,e){return eU(es.count(eE(t)-1,t),e,2)}function ry(t,e){return eU(t.getFullYear()%100,e,2)}function rv(t,e){return eU((t=rf(t)).getFullYear()%100,e,2)}function rm(t,e){return eU(t.getFullYear()%1e4,e,4)}function rb(t,e){var r=t.getDay();return eU((t=r>=4||0===r?eh(t):eh.ceil(t)).getFullYear()%1e4,e,4)}function rg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+eU(e/60|0,"0",2)+eU(e%60,"0",2)}function rx(t,e){return eU(t.getUTCDate(),e,2)}function rw(t,e){return eU(t.getUTCHours(),e,2)}function rO(t,e){return eU(t.getUTCHours()%12||12,e,2)}function rj(t,e){return eU(1+ea.count(ek(t),t),e,3)}function rS(t,e){return eU(t.getUTCMilliseconds(),e,3)}function rP(t,e){return rS(t,e)+"000"}function rE(t,e){return eU(t.getUTCMonth()+1,e,2)}function rk(t,e){return eU(t.getUTCMinutes(),e,2)}function rA(t,e){return eU(t.getUTCSeconds(),e,2)}function rM(t){var e=t.getUTCDay();return 0===e?7:e}function r_(t,e){return eU(em.count(ek(t)-1,t),e,2)}function rT(t){var e=t.getUTCDay();return e>=4||0===e?ew(t):ew.ceil(t)}function rC(t,e){return t=rT(t),eU(ew.count(ek(t),t)+(4===ek(t).getUTCDay()),e,2)}function rN(t){return t.getUTCDay()}function rD(t,e){return eU(eb.count(ek(t)-1,t),e,2)}function rI(t,e){return eU(t.getUTCFullYear()%100,e,2)}function rL(t,e){return eU((t=rT(t)).getUTCFullYear()%100,e,2)}function rB(t,e){return eU(t.getUTCFullYear()%1e4,e,4)}function rR(t,e){var r=t.getUTCDay();return eU((t=r>=4||0===r?ew(t):ew.ceil(t)).getUTCFullYear()%1e4,e,4)}function rz(){return"+0000"}function rU(){return"%"}function rF(t){return+t}function r$(t){return Math.floor(+t/1e3)}function rq(t){return new Date(t)}function rZ(t){return t instanceof Date?+t:+new Date(+t)}function rW(t,e,r,n,o,i,a,u,c,l){var s=tO(),f=s.invert,p=s.domain,h=l(".%L"),d=l(":%S"),y=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),b=l("%b %d"),g=l("%B"),x=l("%Y");function w(t){return(c(t)1)for(var r,n,o,i=1,a=t[e[0]],u=a.length;i=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rF,s:r$,S:rc,u:rl,U:rs,V:rp,w:rh,W:rd,x:null,X:null,y:ry,Y:rm,Z:rg,"%":rU},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:rx,e:rx,f:rP,g:rL,G:rR,H:rw,I:rO,j:rj,L:rS,m:rE,M:rk,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:rF,s:r$,S:rA,u:rM,U:r_,V:rC,w:rN,W:rD,x:null,X:null,y:rI,Y:rB,Z:rz,"%":rU},w={a:function(t,e,r){var n=h.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){var n=f.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){var n=m.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){var n=y.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,r,n){return S(t,e,r,n)},d:e0,e:e0,f:e7,g:eV,G:eG,H:e2,I:e2,j:e1,L:e3,m:eJ,M:e5,p:function(t,e,r){var n=l.exec(e.slice(r));return n?(t.p=s.get(n[0].toLowerCase()),r+n[0].length):-1},q:eQ,Q:e4,s:e9,S:e6,u:eW,U:eY,V:eH,w:eZ,W:eX,x:function(t,e,n){return S(t,r,e,n)},X:function(t,e,r){return S(t,n,e,r)},y:eV,Y:eG,Z:eK,"%":e8};function O(t,e){return function(r){var n,o,i,a=[],u=-1,c=0,l=t.length;for(r instanceof Date||(r=new Date(+r));++u53)return null;"w"in i||(i.w=1),"Z"in i?(n=(o=(n=eD(eI(i.y,0,1))).getUTCDay())>4||0===o?eb.ceil(n):eb(n),n=ea.offset(n,(i.V-1)*7),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=(o=(n=eN(eI(i.y,0,1))).getDay())>4||0===o?es.ceil(n):es(n),n=ei.offset(n,(i.V-1)*7),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?eD(eI(i.y,0,1)).getUTCDay():eN(eI(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,eD(i)):eN(i)}}function S(t,e,r,n){for(var o,i,a=0,u=e.length,c=r.length;a=c)return -1;if(37===(o=e.charCodeAt(a++))){if(!(i=w[(o=e.charAt(a++))in eL?e.charAt(a++):o])||(n=i(t,r,n))<0)return -1}else if(o!=r.charCodeAt(n++))return -1}return n}return g.x=O(r,g),g.X=O(n,g),g.c=O(e,g),x.x=O(r,x),x.X=O(n,x),x.c=O(e,x),{format:function(t){var e=O(t+="",g);return e.toString=function(){return t},e},parse:function(t){var e=j(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=O(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=j(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,u.parse,l=u.utcFormat,u.utcParse;var r2=r(22516),r5=r(76115);function r6(t){for(var e=t.length,r=Array(e);--e>=0;)r[e]=e;return r}function r3(t,e){return t[e]}function r7(t){let e=[];return e.key=t,e}var r8=r(95645),r4=r.n(r8),r9=r(99008),nt=r.n(r9),ne=r(77571),nr=r.n(ne),nn=r(86757),no=r.n(nn),ni=r(42715),na=r.n(ni),nu=r(13735),nc=r.n(nu),nl=r(11314),ns=r.n(nl),nf=r(82559),np=r.n(nf),nh=r(75551),nd=r.n(nh),ny=r(21652),nv=r.n(ny),nm=r(34935),nb=r.n(nm),ng=r(61134),nx=r.n(ng);function nw(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=e?r.apply(void 0,o):t(e-a,nP(function(){for(var t=arguments.length,e=Array(t),n=0;nt.length)&&(e=t.length);for(var r=0,n=Array(e);rn&&(o=n,i=r),[o,i]}function nR(t,e,r){if(t.lte(0))return new(nx())(0);var n=nC.getDigitCount(t.toNumber()),o=new(nx())(10).pow(n),i=t.div(o),a=1!==n?.05:.1,u=new(nx())(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return e?u:new(nx())(Math.ceil(u))}function nz(t,e,r){var n=1,o=new(nx())(t);if(!o.isint()&&r){var i=Math.abs(t);i<1?(n=new(nx())(10).pow(nC.getDigitCount(t)-1),o=new(nx())(Math.floor(o.div(n).toNumber())).mul(n)):i>1&&(o=new(nx())(Math.floor(t)))}else 0===t?o=new(nx())(Math.floor((e-1)/2)):r||(o=new(nx())(Math.floor(t)));var a=Math.floor((e-1)/2);return nM(nA(function(t){return o.add(new(nx())(t-a).mul(n)).toNumber()}),nk)(0,e)}var nU=nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0){var s=l===1/0?[c].concat(nN(nk(0,o-1).map(function(){return 1/0}))):[].concat(nN(nk(0,o-1).map(function(){return-1/0})),[l]);return r>n?n_(s):s}if(c===l)return nz(c,o,i);var f=function t(e,r,n,o){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((r-e)/(n-1)))return{step:new(nx())(0),tickMin:new(nx())(0),tickMax:new(nx())(0)};var u=nR(new(nx())(r).sub(e).div(n-1),o,a),c=Math.ceil((i=e<=0&&r>=0?new(nx())(0):(i=new(nx())(e).add(r).div(2)).sub(new(nx())(i).mod(u))).sub(e).div(u).toNumber()),l=Math.ceil(new(nx())(r).sub(i).div(u).toNumber()),s=c+l+1;return s>n?t(e,r,n,o,a+1):(s0?l+(n-s):l,c=r>0?c:c+(n-s)),{step:u,tickMin:i.sub(new(nx())(c).mul(u)),tickMax:i.add(new(nx())(l).mul(u))})}(c,l,a,i),p=f.step,h=f.tickMin,d=f.tickMax,y=nC.rangeStep(h,d.add(new(nx())(.1).mul(p)),p);return r>n?n_(y):y});nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0)return[r,n];if(c===l)return nz(c,o,i);var s=nR(new(nx())(l).sub(c).div(a-1),i,0),f=nM(nA(function(t){return new(nx())(c).add(new(nx())(t).mul(s)).toNumber()}),nk)(0,a).filter(function(t){return t>=c&&t<=l});return r>n?n_(f):f});var nF=nT(function(t,e){var r=nD(t,2),n=r[0],o=r[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=nD(nB([n,o]),2),u=a[0],c=a[1];if(u===-1/0||c===1/0)return[n,o];if(u===c)return[u];var l=nR(new(nx())(c).sub(u).div(Math.max(e,2)-1),i,0),s=[].concat(nN(nC.rangeStep(new(nx())(u),new(nx())(c).sub(new(nx())(.99).mul(l)),l)),[c]);return n>o?n_(s):s}),n$=r(13137),nq=r(16630),nZ=r(82944),nW=r(38569);function nY(t){return(nY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nH(t){return function(t){if(Array.isArray(t))return nX(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return nX(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nX(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nX(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,a=null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0;if(a<=1)return 0;if(o&&"angleAxis"===o.axisType&&1e-6>=Math.abs(Math.abs(o.range[1]-o.range[0])-360))for(var u=o.range,c=0;c0?n[c-1].coordinate:n[a-1].coordinate,s=n[c].coordinate,f=c>=a-1?n[0].coordinate:n[c+1].coordinate,p=void 0;if((0,nq.uY)(s-l)!==(0,nq.uY)(f-s)){var h=[];if((0,nq.uY)(f-s)===(0,nq.uY)(u[1]-u[0])){p=f;var d=s+u[1]-u[0];h[0]=Math.min(d,(d+l)/2),h[1]=Math.max(d,(d+l)/2)}else{p=l;var y=f+u[1]-u[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(p+s)/2),Math.max(s,(p+s)/2)];if(t>v[0]&&t<=v[1]||t>=h[0]&&t<=h[1]){i=n[c].index;break}}else{var m=Math.min(l,f),b=Math.max(l,f);if(t>(m+s)/2&&t<=(b+s)/2){i=n[c].index;break}}}else for(var g=0;g0&&g(r[g].coordinate+r[g-1].coordinate)/2&&t<=(r[g].coordinate+r[g+1].coordinate)/2||g===a-1&&t>(r[g].coordinate+r[g-1].coordinate)/2){i=r[g].index;break}return i},n1=function(t){var e,r,n=t.type.displayName,o=null!==(e=t.type)&&void 0!==e&&e.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props,i=o.stroke,a=o.fill;switch(n){case"Line":r=i;break;case"Area":case"Radar":r=i&&"none"!==i?i:a;break;default:r=a}return r},n2=function(t){var e=t.barSize,r=t.totalSize,n=t.stackGroups,o=void 0===n?{}:n;if(!o)return{};for(var i={},a=Object.keys(o),u=0,c=a.length;u=0});if(v&&v.length){var m=v[0].type.defaultProps,b=void 0!==m?nV(nV({},m),v[0].props):v[0].props,g=b.barSize,x=b[y];i[x]||(i[x]=[]);var w=nr()(g)?e:g;i[x].push({item:v[0],stackList:v.slice(1),barSize:nr()(w)?void 0:(0,nq.h1)(w,r,0)})}}return i},n5=function(t){var e,r=t.barGap,n=t.barCategoryGap,o=t.bandSize,i=t.sizeList,a=void 0===i?[]:i,u=t.maxBarSize,c=a.length;if(c<1)return null;var l=(0,nq.h1)(r,o,0,!0),s=[];if(a[0].barSize===+a[0].barSize){var f=!1,p=o/c,h=a.reduce(function(t,e){return t+e.barSize||0},0);(h+=(c-1)*l)>=o&&(h-=(c-1)*l,l=0),h>=o&&p>0&&(f=!0,p*=.9,h=c*p);var d={offset:((o-h)/2>>0)-l,size:0};e=a.reduce(function(t,e){var r={item:e.item,position:{offset:d.offset+d.size+l,size:f?p:e.barSize}},n=[].concat(nH(t),[r]);return d=n[n.length-1].position,e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:d})}),n},s)}else{var y=(0,nq.h1)(n,o,0,!0);o-2*y-(c-1)*l<=0&&(l=0);var v=(o-2*y-(c-1)*l)/c;v>1&&(v>>=0);var m=u===+u?Math.min(v,u):v;e=a.reduce(function(t,e,r){var n=[].concat(nH(t),[{item:e.item,position:{offset:y+(v+l)*r+(v-m)/2,size:m}}]);return e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:n[n.length-1].position})}),n},s)}return e},n6=function(t,e,r,n){var o=r.children,i=r.width,a=r.margin,u=i-(a.left||0)-(a.right||0),c=(0,nW.z)({children:o,legendWidth:u});if(c){var l=n||{},s=l.width,f=l.height,p=c.align,h=c.verticalAlign,d=c.layout;if(("vertical"===d||"horizontal"===d&&"middle"===h)&&"center"!==p&&(0,nq.hj)(t[p]))return nV(nV({},t),{},nK({},p,t[p]+(s||0)));if(("horizontal"===d||"vertical"===d&&"center"===p)&&"middle"!==h&&(0,nq.hj)(t[h]))return nV(nV({},t),{},nK({},h,t[h]+(f||0)))}return t},n3=function(t,e,r,n,o){var i=e.props.children,a=(0,nZ.NN)(i,n$.W).filter(function(t){var e;return e=t.props.direction,!!nr()(o)||("horizontal"===n?"yAxis"===o:"vertical"===n||"x"===e?"xAxis"===o:"y"!==e||"yAxis"===o)});if(a&&a.length){var u=a.map(function(t){return t.props.dataKey});return t.reduce(function(t,e){var n=nQ(e,r);if(nr()(n))return t;var o=Array.isArray(n)?[nt()(n),r4()(n)]:[n,n],i=u.reduce(function(t,r){var n=nQ(e,r,0),i=o[0]-Math.abs(Array.isArray(n)?n[0]:n),a=o[1]+Math.abs(Array.isArray(n)?n[1]:n);return[Math.min(i,t[0]),Math.max(a,t[1])]},[1/0,-1/0]);return[Math.min(i[0],t[0]),Math.max(i[1],t[1])]},[1/0,-1/0])}return null},n7=function(t,e,r,n,o){var i=e.map(function(e){return n3(t,e,r,o,n)}).filter(function(t){return!nr()(t)});return i&&i.length?i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]):null},n8=function(t,e,r,n,o){var i=e.map(function(e){var i=e.props.dataKey;return"number"===r&&i&&n3(t,e,i,n)||nJ(t,i,r,o)});if("number"===r)return i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]);var a={};return i.reduce(function(t,e){for(var r=0,n=e.length;r=2?2*(0,nq.uY)(a[0]-a[1])*c:c,e&&(t.ticks||t.niceTicks))?(t.ticks||t.niceTicks).map(function(t){return{coordinate:n(o?o.indexOf(t):t)+c,value:t,offset:c}}).filter(function(t){return!np()(t.coordinate)}):t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(t,e){return{coordinate:n(t)+c,value:t,index:e,offset:c}}):n.ticks&&!r?n.ticks(t.tickCount).map(function(t){return{coordinate:n(t)+c,value:t,offset:c}}):n.domain().map(function(t,e){return{coordinate:n(t)+c,value:o?o[t]:t,index:e,offset:c}})},oe=new WeakMap,or=function(t,e){if("function"!=typeof e)return t;oe.has(t)||oe.set(t,new WeakMap);var r=oe.get(t);if(r.has(e))return r.get(e);var n=function(){t.apply(void 0,arguments),e.apply(void 0,arguments)};return r.set(e,n),n},on=function(t,e,r){var n=t.scale,o=t.type,i=t.layout,a=t.axisType;if("auto"===n)return"radial"===i&&"radiusAxis"===a?{scale:f.Z(),realScaleType:"band"}:"radial"===i&&"angleAxis"===a?{scale:tL(),realScaleType:"linear"}:"category"===o&&e&&(e.indexOf("LineChart")>=0||e.indexOf("AreaChart")>=0||e.indexOf("ComposedChart")>=0&&!r)?{scale:f.x(),realScaleType:"point"}:"category"===o?{scale:f.Z(),realScaleType:"band"}:{scale:tL(),realScaleType:"linear"};if(na()(n)){var u="scale".concat(nd()(n));return{scale:(s[u]||f.x)(),realScaleType:s[u]?u:"point"}}return no()(n)?{scale:n}:{scale:f.x(),realScaleType:"point"}},oo=function(t){var e=t.domain();if(e&&!(e.length<=2)){var r=e.length,n=t.range(),o=Math.min(n[0],n[1])-1e-4,i=Math.max(n[0],n[1])+1e-4,a=t(e[0]),u=t(e[r-1]);(ai||ui)&&t.domain([e[0],e[r-1]])}},oi=function(t,e){if(!t)return null;for(var r=0,n=t.length;rn)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]=0?(t[a][r][0]=o,t[a][r][1]=o+u,o=t[a][r][1]):(t[a][r][0]=i,t[a][r][1]=i+u,i=t[a][r][1])}},expand:function(t,e){if((n=t.length)>0){for(var r,n,o,i=0,a=t[0].length;i0){for(var r,n=0,o=t[e[0]],i=o.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,o,i=0,a=1;a=0?(t[i][r][0]=o,t[i][r][1]=o+a,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}}},oc=function(t,e,r){var n=e.map(function(t){return t.props.dataKey}),o=ou[r];return(function(){var t=(0,r5.Z)([]),e=r6,r=r1,n=r3;function o(o){var i,a,u=Array.from(t.apply(this,arguments),r7),c=u.length,l=-1;for(let t of o)for(i=0,++l;i=0?0:o<0?o:n}return r[0]},od=function(t,e){var r,n=(null!==(r=t.type)&&void 0!==r&&r.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props).stackId;if((0,nq.P2)(n)){var o=e[n];if(o){var i=o.items.indexOf(t);return i>=0?o.stackedData[i]:null}}return null},oy=function(t,e,r){return Object.keys(t).reduce(function(n,o){var i=t[o].stackedData.reduce(function(t,n){var o=n.slice(e,r+1).reduce(function(t,e){return[nt()(e.concat([t[0]]).filter(nq.hj)),r4()(e.concat([t[1]]).filter(nq.hj))]},[1/0,-1/0]);return[Math.min(t[0],o[0]),Math.max(t[1],o[1])]},[1/0,-1/0]);return[Math.min(i[0],n[0]),Math.max(i[1],n[1])]},[1/0,-1/0]).map(function(t){return t===1/0||t===-1/0?0:t})},ov=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,om=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ob=function(t,e,r){if(no()(t))return t(e,r);if(!Array.isArray(t))return e;var n=[];if((0,nq.hj)(t[0]))n[0]=r?t[0]:Math.min(t[0],e[0]);else if(ov.test(t[0])){var o=+ov.exec(t[0])[1];n[0]=e[0]-o}else no()(t[0])?n[0]=t[0](e[0]):n[0]=e[0];if((0,nq.hj)(t[1]))n[1]=r?t[1]:Math.max(t[1],e[1]);else if(om.test(t[1])){var i=+om.exec(t[1])[1];n[1]=e[1]+i}else no()(t[1])?n[1]=t[1](e[1]):n[1]=e[1];return n},og=function(t,e,r){if(t&&t.scale&&t.scale.bandwidth){var n=t.scale.bandwidth();if(!r||n>0)return n}if(t&&e&&e.length>=2){for(var o=nb()(e,function(t){return t.coordinate}),i=1/0,a=1,u=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||n.x.isSsr)return{width:0,height:0};var o=(Object.keys(e=a({},r)).forEach(function(t){e[t]||delete e[t]}),e),i=JSON.stringify({text:t,copyStyle:o});if(u.widthCache[i])return u.widthCache[i];try{var s=document.getElementById(l);s||((s=document.createElement("span")).setAttribute("id",l),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var f=a(a({},c),o);Object.assign(s.style,f),s.textContent="".concat(t);var p=s.getBoundingClientRect(),h={width:p.width,height:p.height};return u.widthCache[i]=h,++u.cacheCount>2e3&&(u.cacheCount=0,u.widthCache={}),h}catch(t){return{width:0,height:0}}},f=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}}},16630:function(t,e,r){"use strict";r.d(e,{Ap:function(){return S},EL:function(){return g},Kt:function(){return w},P2:function(){return m},Rw:function(){return v},bv:function(){return O},fC:function(){return P},h1:function(){return x},hU:function(){return d},hj:function(){return y},k4:function(){return j},uY:function(){return h}});var n=r(42715),o=r.n(n),i=r(82559),a=r.n(i),u=r(13735),c=r.n(u),l=r(22345),s=r.n(l),f=r(77571),p=r.n(f),h=function(t){return 0===t?0:t>0?1:-1},d=function(t){return o()(t)&&t.indexOf("%")===t.length-1},y=function(t){return s()(t)&&!a()(t)},v=function(t){return p()(t)},m=function(t){return y(t)||o()(t)},b=0,g=function(t){var e=++b;return"".concat(t||"").concat(e)},x=function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!y(t)&&!o()(t))return n;if(d(t)){var u=t.indexOf("%");r=e*parseFloat(t.slice(0,u))/100}else r=+t;return a()(r)&&(r=n),i&&r>e&&(r=e),r},w=function(t){if(!t)return null;var e=Object.keys(t);return e&&e.length?t[e[0]]:null},O=function(t){if(!Array.isArray(t))return!1;for(var e=t.length,r={},n=0;n2?r-2:0),o=2;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(e-(r.top||0)-(r.bottom||0)))/2},b=function(t,e,r,n,i){var a=t.width,u=t.height,s=t.startAngle,f=t.endAngle,y=(0,c.h1)(t.cx,a,a/2),v=(0,c.h1)(t.cy,u,u/2),b=m(a,u,r),g=(0,c.h1)(t.innerRadius,b,0),x=(0,c.h1)(t.outerRadius,b,.8*b);return Object.keys(e).reduce(function(t,r){var a,u=e[r],c=u.domain,m=u.reversed;if(o()(u.range))"angleAxis"===n?a=[s,f]:"radiusAxis"===n&&(a=[g,x]),m&&(a=[a[1],a[0]]);else{var b,w=function(t){if(Array.isArray(t))return t}(b=a=u.range)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(b,2)||function(t,e){if(t){if("string"==typeof t)return d(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,2)}}(b,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();s=w[0],f=w[1]}var O=(0,l.Hq)(u,i),j=O.realScaleType,S=O.scale;S.domain(c).range(a),(0,l.zF)(S);var P=(0,l.g$)(S,p(p({},u),{},{realScaleType:j})),E=p(p(p({},u),P),{},{range:a,radius:x,realScaleType:j,scale:S,cx:y,cy:v,innerRadius:g,outerRadius:x,startAngle:s,endAngle:f});return p(p({},t),{},h({},r,E))},{})},g=function(t,e){var r=t.x,n=t.y;return Math.sqrt(Math.pow(r-e.x,2)+Math.pow(n-e.y,2))},x=function(t,e){var r=t.x,n=t.y,o=e.cx,i=e.cy,a=g({x:r,y:n},{x:o,y:i});if(a<=0)return{radius:a};var u=Math.acos((r-o)/a);return n>i&&(u=2*Math.PI-u),{radius:a,angle:180*u/Math.PI,angleInRadian:u}},w=function(t){var e=t.startAngle,r=t.endAngle,n=Math.min(Math.floor(e/360),Math.floor(r/360));return{startAngle:e-360*n,endAngle:r-360*n}},O=function(t,e){var r,n=x({x:t.x,y:t.y},e),o=n.radius,i=n.angle,a=e.innerRadius,u=e.outerRadius;if(ou)return!1;if(0===o)return!0;var c=w(e),l=c.startAngle,s=c.endAngle,f=i;if(l<=s){for(;f>s;)f-=360;for(;f=l&&f<=s}else{for(;f>l;)f-=360;for(;f=s&&f<=l}return r?p(p({},e),{},{radius:o,angle:f+360*Math.min(Math.floor(e.startAngle/360),Math.floor(e.endAngle/360))}):null},j=function(t){return(0,i.isValidElement)(t)||u()(t)||"boolean"==typeof t?"":t.className}},82944:function(t,e,r){"use strict";r.d(e,{$R:function(){return R},Bh:function(){return B},Gf:function(){return j},L6:function(){return N},NN:function(){return k},TT:function(){return M},eu:function(){return L},jf:function(){return T},rL:function(){return D},sP:function(){return A}});var n=r(13735),o=r.n(n),i=r(77571),a=r.n(i),u=r(42715),c=r.n(u),l=r(86757),s=r.n(l),f=r(28302),p=r.n(f),h=r(2265),d=r(14326),y=r(16630),v=r(46485),m=r(41637),b=["children"],g=["children"];function x(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var O={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},j=function(t){return"string"==typeof t?t:t?t.displayName||t.name||"Component":""},S=null,P=null,E=function t(e){if(e===S&&Array.isArray(P))return P;var r=[];return h.Children.forEach(e,function(e){a()(e)||((0,d.isFragment)(e)?r=r.concat(t(e.props.children)):r.push(e))}),P=r,S=e,r};function k(t,e){var r=[],n=[];return n=Array.isArray(e)?e.map(function(t){return j(t)}):[j(e)],E(t).forEach(function(t){var e=o()(t,"type.displayName")||o()(t,"type.name");-1!==n.indexOf(e)&&r.push(t)}),r}function A(t,e){var r=k(t,e);return r&&r[0]}var M=function(t){if(!t||!t.props)return!1;var e=t.props,r=e.width,n=e.height;return!!(0,y.hj)(r)&&!(r<=0)&&!!(0,y.hj)(n)&&!(n<=0)},_=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],T=function(t){return t&&"object"===w(t)&&"clipDot"in t},C=function(t,e,r,n){var o,i=null!==(o=null===m.ry||void 0===m.ry?void 0:m.ry[n])&&void 0!==o?o:[];return e.startsWith("data-")||!s()(t)&&(n&&i.includes(e)||m.Yh.includes(e))||r&&m.nv.includes(e)},N=function(t,e,r){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var n=t;if((0,h.isValidElement)(t)&&(n=t.props),!p()(n))return null;var o={};return Object.keys(n).forEach(function(t){var i;C(null===(i=n)||void 0===i?void 0:i[t],t,e,r)&&(o[t]=n[t])}),o},D=function t(e,r){if(e===r)return!0;var n=h.Children.count(e);if(n!==h.Children.count(r))return!1;if(0===n)return!0;if(1===n)return I(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var o=0;o=0)r.push(t);else if(t){var i=j(t.type),a=e[i]||{},u=a.handler,l=a.once;if(u&&(!l||!n[i])){var s=u(t,i,o);r.push(s),n[i]=!0}}}),r},B=function(t){var e=t&&t.type;return e&&O[e]?O[e]:null},R=function(t,e){return E(e).indexOf(t)}},46485:function(t,e,r){"use strict";function n(t,e){for(var r in t)if(({}).hasOwnProperty.call(t,r)&&(!({}).hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if(({}).hasOwnProperty.call(e,n)&&!({}).hasOwnProperty.call(t,n))return!1;return!0}r.d(e,{w:function(){return n}})},38569:function(t,e,r){"use strict";r.d(e,{z:function(){return l}});var n=r(22190),o=r(85355),i=r(82944);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e=0))throw Error(`invalid digits: ${t}`);if(e>15)return a;let r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e1e-6){if(Math.abs(f*c-l*s)>1e-6&&i){let h=r-a,d=o-u,y=c*c+l*l,v=Math.sqrt(y),m=Math.sqrt(p),b=i*Math.tan((n-Math.acos((y+p-(h*h+d*d))/(2*v*m)))/2),g=b/m,x=b/v;Math.abs(g-1)>1e-6&&this._append`L${t+g*s},${e+g*f}`,this._append`A${i},${i},0,0,${+(f*h>s*d)},${this._x1=t+x*c},${this._y1=e+x*l}`}else this._append`L${this._x1=t},${this._y1=e}`}}arc(t,e,r,a,u,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw Error(`negative radius: ${r}`);let l=r*Math.cos(a),s=r*Math.sin(a),f=t+l,p=e+s,h=1^c,d=c?a-u:u-a;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-p)>1e-6)&&this._append`L${f},${p}`,r&&(d<0&&(d=d%o+o),d>i?this._append`A${r},${r},0,1,${h},${t-l},${e-s}A${r},${r},0,1,${h},${this._x1=f},${this._y1=p}`:d>1e-6&&this._append`A${r},${r},0,${+(d>=n)},${h},${this._x1=t+r*Math.cos(u)},${this._y1=e+r*Math.sin(u)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{let t=Math.floor(r);if(!(t>=0))throw RangeError(`invalid digits: ${r}`);e=t}return t},()=>new u(e)}u.prototype},59121:function(t,e,r){"use strict";r.d(e,{E:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);return isNaN(e)?(0,o.L)(t,NaN):(e&&r.setDate(r.getDate()+e),r)}},31091:function(t,e,r){"use strict";r.d(e,{z:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);if(isNaN(e))return(0,o.L)(t,NaN);if(!e)return r;let i=r.getDate(),a=(0,o.L)(t,r.getTime());return(a.setMonth(r.getMonth()+e+1,0),i>=a.getDate())?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}},63497:function(t,e,r){"use strict";function n(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}r.d(e,{L:function(){return n}})},99649:function(t,e,r){"use strict";function n(t){let e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new t.constructor(+t):new Date("number"==typeof t||"[object Number]"===e||"string"==typeof t||"[object String]"===e?t:NaN)}r.d(e,{Q:function(){return n}})},69398:function(t,e,r){"use strict";function n(t,e){if(!t)throw Error("Invariant failed")}r.d(e,{Z:function(){return n}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1112-17ade2117284ab94.js b/litellm/proxy/_experimental/out/_next/static/chunks/1112-8d095bb73a8ed62a.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1112-17ade2117284ab94.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1112-8d095bb73a8ed62a.js index 70af9b9341..ea4e968a05 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1112-17ade2117284ab94.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1112-8d095bb73a8ed62a.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1112],{41112:function(e,l,s){s.d(l,{Z:function(){return B}});var a=s(57437),t=s(2265),r=s(16312),i=s(22116),n=s(19250),o=s(4260),c=s(37592),d=s(10032),m=s(42264),x=s(43769);let{TextArea:u}=o.default,{Option:h}=c.default,g=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"];var p=e=>{let{visible:l,onClose:s,accessToken:p,onSuccess:j}=e,[y]=d.Z.useForm(),[b,N]=(0,t.useState)(!1),[Z,f]=(0,t.useState)("github"),v=async e=>{if(!p){m.ZP.error("No access token available");return}if(!(0,x.$L)(e.name)){m.ZP.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");return}if(e.version&&!(0,x.Nq)(e.version)){m.ZP.error("Version must be in semantic versioning format (e.g., 1.0.0)");return}if(e.authorEmail&&!(0,x.vV)(e.authorEmail)){m.ZP.error("Invalid email format");return}if(e.homepage&&!(0,x.jv)(e.homepage)){m.ZP.error("Invalid homepage URL format");return}N(!0);try{let l={name:e.name.trim(),source:"github"===Z?{source:"github",repo:e.repo.trim()}:{source:"url",url:e.url.trim()}};e.version&&(l.version=e.version.trim()),e.description&&(l.description=e.description.trim()),(e.authorName||e.authorEmail)&&(l.author={},e.authorName&&(l.author.name=e.authorName.trim()),e.authorEmail&&(l.author.email=e.authorEmail.trim())),e.homepage&&(l.homepage=e.homepage.trim()),e.category&&(l.category=e.category),e.keywords&&(l.keywords=(0,x.jE)(e.keywords)),await (0,n.registerClaudeCodePlugin)(p,l),m.ZP.success("Plugin registered successfully"),y.resetFields(),f("github"),j(),s()}catch(e){console.error("Error registering plugin:",e),m.ZP.error("Failed to register plugin")}finally{N(!1)}},C=()=>{y.resetFields(),f("github"),s()};return(0,a.jsx)(i.Z,{title:"Add New Claude Code Plugin",open:l,onCancel:C,footer:null,width:700,className:"top-8",children:(0,a.jsxs)(d.Z,{form:y,layout:"vertical",onFinish:v,className:"mt-4",children:[(0,a.jsx)(d.Z.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,a.jsx)(o.default,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,a.jsxs)(c.default,{onChange:e=>{f(e),y.setFieldsValue({repo:void 0,url:void 0})},className:"rounded-lg",children:[(0,a.jsx)(h,{value:"github",children:"GitHub"}),(0,a.jsx)(h,{value:"url",children:"URL"})]})}),"github"===Z&&(0,a.jsx)(d.Z.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,a.jsx)(o.default,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),"url"===Z&&(0,a.jsx)(d.Z.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,a.jsx)(o.default,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,a.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,a.jsx)(c.default,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:g.map(e=>(0,a.jsx)(h,{value:e,children:e},e))})}),(0,a.jsx)(d.Z.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,a.jsx)(o.default,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,a.jsx)(o.default,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,a.jsx)(o.default,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{className:"mb-0 mt-6",children:(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(r.z,{variant:"secondary",onClick:C,disabled:b,children:"Cancel"}),(0,a.jsx)(r.z,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})},j=s(23639),y=s(74998),b=s(44633),N=s(86462),Z=s(49084),f=s(71594),v=s(24525),C=s(41649),w=s(78489),P=s(21626),k=s(97214),S=s(28241),_=s(58834),z=s(69552),I=s(71876),E=s(99981),A=s(63709),D=s(9114),L=e=>{let{pluginsList:l,isLoading:s,onDeleteClick:r,accessToken:i,onPluginUpdated:o,isAdmin:c,onPluginClick:d}=e,[m,u]=(0,t.useState)([{id:"created_at",desc:!0}]),[h,g]=(0,t.useState)(null),p=e=>e?new Date(e).toLocaleString():"-",L=e=>{navigator.clipboard.writeText(e),D.Z.success("Copied to clipboard!")},R=async e=>{if(i){g(e.id);try{e.enabled?(await (0,n.disableClaudeCodePlugin)(i,e.name),D.Z.success('Plugin "'.concat(e.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(i,e.name),D.Z.success('Plugin "'.concat(e.name,'" enabled'))),o()}catch(e){D.Z.error("Failed to toggle plugin status")}finally{g(null)}}},F=[{header:"Plugin Name",accessorKey:"name",cell:e=>{let{row:l}=e,s=l.original,t=s.name||"";return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E.Z,{title:t,children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>d(s.id),children:t})}),(0,a.jsx)(E.Z,{title:"Copy Plugin ID",children:(0,a.jsx)(j.Z,{onClick:e=>{e.stopPropagation(),L(s.id)},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:e=>{let{row:l}=e,s=l.original.version||"N/A";return(0,a.jsx)("span",{className:"text-xs text-gray-600",children:s})}},{header:"Description",accessorKey:"description",cell:e=>{let{row:l}=e,s=l.original.description||"No description";return(0,a.jsx)(E.Z,{title:s,children:(0,a.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:s})})}},{header:"Category",accessorKey:"category",cell:e=>{let{row:l}=e,s=l.original.category;if(!s)return(0,a.jsx)(C.Z,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let t=(0,x.LH)(s);return(0,a.jsx)(C.Z,{color:t,className:"text-xs font-normal",size:"xs",children:s})}},{header:"Enabled",accessorKey:"enabled",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(C.Z,{color:s.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:s.enabled?"Yes":"No"}),c&&(0,a.jsx)(E.Z,{title:s.enabled?"Disable plugin":"Enable plugin",children:(0,a.jsx)(A.Z,{size:"small",checked:s.enabled,loading:h===s.id,onChange:()=>R(s)})})]})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)(E.Z,{title:s.created_at,children:(0,a.jsx)("span",{className:"text-xs",children:p(s.created_at)})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)(E.Z,{title:"Delete plugin",children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),r(s.name,s.name)},icon:y.Z,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],U=(0,f.b7)({data:l,columns:F,state:{sorting:m},onSortingChange:u,getCoreRowModel:(0,v.sC)(),getSortedRowModel:(0,v.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(P.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(_.Z,{children:U.getHeaderGroups().map(e=>(0,a.jsx)(I.Z,{children:e.headers.map(e=>(0,a.jsx)(z.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,f.ie)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(b.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(N.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(Z.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(k.Z,{children:s?(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"Loading..."})})})}):l&&l.length>0?U.getRowModel().rows.map(e=>(0,a.jsx)(I.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(S.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,f.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})},R=s(20347),F=s(77331),U=s(3477),O=s(12514),T=s(67101),H=s(84264),K=s(96761),V=s(10353),q=e=>{let{pluginId:l,onClose:s,accessToken:r,isAdmin:i,onPluginUpdated:o}=e,[c,d]=(0,t.useState)(null),[m,u]=(0,t.useState)(!0),[h,g]=(0,t.useState)(!1);(0,t.useEffect)(()=>{p()},[l,r]);let p=async()=>{if(r){u(!0);try{let e=await (0,n.getClaudeCodePluginDetails)(r,l);d(e.plugin)}catch(e){console.error("Error fetching plugin info:",e),D.Z.error("Failed to load plugin information")}finally{u(!1)}}},y=async()=>{if(r&&c){g(!0);try{c.enabled?(await (0,n.disableClaudeCodePlugin)(r,c.name),D.Z.success('Plugin "'.concat(c.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(r,c.name),D.Z.success('Plugin "'.concat(c.name,'" enabled'))),o(),p()}catch(e){D.Z.error("Failed to toggle plugin status")}finally{g(!1)}}},b=e=>{navigator.clipboard.writeText(e),D.Z.success("Copied to clipboard!")};if(m)return(0,a.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,a.jsx)(V.Z,{size:"large"})});if(!c)return(0,a.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,a.jsx)("p",{children:"Plugin not found"}),(0,a.jsx)(w.Z,{className:"mt-4",onClick:s,children:"Go Back"})]});let N=(0,x.aB)(c),Z=(0,x.OB)(c.source),f=(0,x.LH)(c.category);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)(F.Z,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,a.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,a.jsxs)(C.Z,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}),(0,a.jsx)(C.Z,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,a.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:N})]}),(0,a.jsx)(E.Z,{title:"Copy install command",children:(0,a.jsx)(w.Z,{size:"xs",variant:"secondary",icon:j.Z,onClick:()=>b(N),className:"ml-4",children:"Copy"})})]})}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Plugin Details"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-mono text-xs",children:c.id}),(0,a.jsx)(j.Z,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>b(c.id)})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Version"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Source"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-semibold",children:(0,x.i5)(c.source)}),Z&&(0,a.jsx)("a",{href:Z,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,a.jsx)(U.Z,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Category"}),(0,a.jsx)("div",{className:"mt-1",children:c.category?(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}):(0,a.jsx)(H.Z,{className:"text-gray-400",children:"Uncategorized"})})]}),i&&(0,a.jsxs)("div",{className:"col-span-3",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Status"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,a.jsx)(A.Z,{checked:c.enabled,loading:h,onChange:y}),(0,a.jsx)(H.Z,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Description"}),(0,a.jsx)(H.Z,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Keywords"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,a.jsx)(C.Z,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Author Information"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Email"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,a.jsx)("a",{href:"mailto:".concat(c.author.email),className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Homepage"}),(0,a.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,a.jsx)(U.Z,{className:"h-4 w-4"})]})]}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Metadata"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.created_at)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.updated_at)})]}),c.created_by&&(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created By"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})},B=e=>{let{accessToken:l,userRole:s}=e,[o,c]=(0,t.useState)([]),[d,m]=(0,t.useState)(!1),[x,u]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[b,N]=(0,t.useState)(null),Z=!!s&&(0,R.tY)(s),f=async()=>{if(l){u(!0);try{let e=await (0,n.getClaudeCodePluginsList)(l,!1);console.log("Claude Code plugins: ".concat(JSON.stringify(e))),c(e.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{u(!1)}}};(0,t.useEffect)(()=>{f()},[l]);let v=async()=>{if(j&&l){g(!0);try{await (0,n.deleteClaudeCodePlugin)(l,j.name),D.Z.success('Plugin "'.concat(j.displayName,'" deleted successfully')),f()}catch(e){console.error("Error deleting plugin:",e),D.Z.error("Failed to delete plugin")}finally{g(!1),y(null)}}};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,a.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(r.z,{onClick:()=>{b&&N(null),m(!0)},disabled:!l||!Z,children:"+ Add New Plugin"})})]}),b?(0,a.jsx)(q,{pluginId:b,onClose:()=>N(null),accessToken:l,isAdmin:Z,onPluginUpdated:f}):(0,a.jsx)(L,{pluginsList:o,isLoading:x,onDeleteClick:(e,l)=>{y({name:e,displayName:l})},accessToken:l,onPluginUpdated:f,isAdmin:Z,onPluginClick:e=>N(e)}),(0,a.jsx)(p,{visible:d,onClose:()=>{m(!1)},accessToken:l,onSuccess:()=>{f()}}),j&&(0,a.jsxs)(i.Z,{title:"Delete Plugin",open:null!==j,onOk:v,onCancel:()=>{y(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,a.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,a.jsx)("strong",{children:j.displayName}),"?"]}),(0,a.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1112],{41112:function(e,l,s){s.d(l,{Z:function(){return B}});var a=s(57437),t=s(2265),r=s(16312),i=s(22116),n=s(19250),o=s(4260),c=s(37592),d=s(10032),m=s(42264),x=s(43769);let{TextArea:u}=o.default,{Option:h}=c.default,g=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"];var p=e=>{let{visible:l,onClose:s,accessToken:p,onSuccess:j}=e,[y]=d.Z.useForm(),[b,N]=(0,t.useState)(!1),[Z,f]=(0,t.useState)("github"),v=async e=>{if(!p){m.ZP.error("No access token available");return}if(!(0,x.$L)(e.name)){m.ZP.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");return}if(e.version&&!(0,x.Nq)(e.version)){m.ZP.error("Version must be in semantic versioning format (e.g., 1.0.0)");return}if(e.authorEmail&&!(0,x.vV)(e.authorEmail)){m.ZP.error("Invalid email format");return}if(e.homepage&&!(0,x.jv)(e.homepage)){m.ZP.error("Invalid homepage URL format");return}N(!0);try{let l={name:e.name.trim(),source:"github"===Z?{source:"github",repo:e.repo.trim()}:{source:"url",url:e.url.trim()}};e.version&&(l.version=e.version.trim()),e.description&&(l.description=e.description.trim()),(e.authorName||e.authorEmail)&&(l.author={},e.authorName&&(l.author.name=e.authorName.trim()),e.authorEmail&&(l.author.email=e.authorEmail.trim())),e.homepage&&(l.homepage=e.homepage.trim()),e.category&&(l.category=e.category),e.keywords&&(l.keywords=(0,x.jE)(e.keywords)),await (0,n.registerClaudeCodePlugin)(p,l),m.ZP.success("Plugin registered successfully"),y.resetFields(),f("github"),j(),s()}catch(e){console.error("Error registering plugin:",e),m.ZP.error("Failed to register plugin")}finally{N(!1)}},C=()=>{y.resetFields(),f("github"),s()};return(0,a.jsx)(i.Z,{title:"Add New Claude Code Plugin",open:l,onCancel:C,footer:null,width:700,className:"top-8",children:(0,a.jsxs)(d.Z,{form:y,layout:"vertical",onFinish:v,className:"mt-4",children:[(0,a.jsx)(d.Z.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,a.jsx)(o.default,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,a.jsxs)(c.default,{onChange:e=>{f(e),y.setFieldsValue({repo:void 0,url:void 0})},className:"rounded-lg",children:[(0,a.jsx)(h,{value:"github",children:"GitHub"}),(0,a.jsx)(h,{value:"url",children:"URL"})]})}),"github"===Z&&(0,a.jsx)(d.Z.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,a.jsx)(o.default,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),"url"===Z&&(0,a.jsx)(d.Z.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,a.jsx)(o.default,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,a.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,a.jsx)(c.default,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:g.map(e=>(0,a.jsx)(h,{value:e,children:e},e))})}),(0,a.jsx)(d.Z.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,a.jsx)(o.default,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,a.jsx)(o.default,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,a.jsx)(o.default,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{className:"mb-0 mt-6",children:(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(r.z,{variant:"secondary",onClick:C,disabled:b,children:"Cancel"}),(0,a.jsx)(r.z,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})},j=s(23639),y=s(74998),b=s(44633),N=s(86462),Z=s(49084),f=s(71594),v=s(24525),C=s(41649),w=s(78489),P=s(21626),k=s(97214),S=s(28241),_=s(58834),z=s(69552),I=s(71876),E=s(99981),A=s(63709),D=s(9114),L=e=>{let{pluginsList:l,isLoading:s,onDeleteClick:r,accessToken:i,onPluginUpdated:o,isAdmin:c,onPluginClick:d}=e,[m,u]=(0,t.useState)([{id:"created_at",desc:!0}]),[h,g]=(0,t.useState)(null),p=e=>e?new Date(e).toLocaleString():"-",L=e=>{navigator.clipboard.writeText(e),D.Z.success("Copied to clipboard!")},R=async e=>{if(i){g(e.id);try{e.enabled?(await (0,n.disableClaudeCodePlugin)(i,e.name),D.Z.success('Plugin "'.concat(e.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(i,e.name),D.Z.success('Plugin "'.concat(e.name,'" enabled'))),o()}catch(e){D.Z.error("Failed to toggle plugin status")}finally{g(null)}}},F=[{header:"Plugin Name",accessorKey:"name",cell:e=>{let{row:l}=e,s=l.original,t=s.name||"";return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E.Z,{title:t,children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>d(s.id),children:t})}),(0,a.jsx)(E.Z,{title:"Copy Plugin ID",children:(0,a.jsx)(j.Z,{onClick:e=>{e.stopPropagation(),L(s.id)},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:e=>{let{row:l}=e,s=l.original.version||"N/A";return(0,a.jsx)("span",{className:"text-xs text-gray-600",children:s})}},{header:"Description",accessorKey:"description",cell:e=>{let{row:l}=e,s=l.original.description||"No description";return(0,a.jsx)(E.Z,{title:s,children:(0,a.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:s})})}},{header:"Category",accessorKey:"category",cell:e=>{let{row:l}=e,s=l.original.category;if(!s)return(0,a.jsx)(C.Z,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let t=(0,x.LH)(s);return(0,a.jsx)(C.Z,{color:t,className:"text-xs font-normal",size:"xs",children:s})}},{header:"Enabled",accessorKey:"enabled",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(C.Z,{color:s.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:s.enabled?"Yes":"No"}),c&&(0,a.jsx)(E.Z,{title:s.enabled?"Disable plugin":"Enable plugin",children:(0,a.jsx)(A.Z,{size:"small",checked:s.enabled,loading:h===s.id,onChange:()=>R(s)})})]})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)(E.Z,{title:s.created_at,children:(0,a.jsx)("span",{className:"text-xs",children:p(s.created_at)})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)(E.Z,{title:"Delete plugin",children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),r(s.name,s.name)},icon:y.Z,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],U=(0,f.b7)({data:l,columns:F,state:{sorting:m},onSortingChange:u,getCoreRowModel:(0,v.sC)(),getSortedRowModel:(0,v.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(P.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(_.Z,{children:U.getHeaderGroups().map(e=>(0,a.jsx)(I.Z,{children:e.headers.map(e=>(0,a.jsx)(z.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,f.ie)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(b.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(N.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(Z.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(k.Z,{children:s?(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"Loading..."})})})}):l&&l.length>0?U.getRowModel().rows.map(e=>(0,a.jsx)(I.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(S.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,f.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})},R=s(20347),F=s(10900),U=s(3477),O=s(12514),T=s(67101),H=s(84264),K=s(96761),V=s(10353),q=e=>{let{pluginId:l,onClose:s,accessToken:r,isAdmin:i,onPluginUpdated:o}=e,[c,d]=(0,t.useState)(null),[m,u]=(0,t.useState)(!0),[h,g]=(0,t.useState)(!1);(0,t.useEffect)(()=>{p()},[l,r]);let p=async()=>{if(r){u(!0);try{let e=await (0,n.getClaudeCodePluginDetails)(r,l);d(e.plugin)}catch(e){console.error("Error fetching plugin info:",e),D.Z.error("Failed to load plugin information")}finally{u(!1)}}},y=async()=>{if(r&&c){g(!0);try{c.enabled?(await (0,n.disableClaudeCodePlugin)(r,c.name),D.Z.success('Plugin "'.concat(c.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(r,c.name),D.Z.success('Plugin "'.concat(c.name,'" enabled'))),o(),p()}catch(e){D.Z.error("Failed to toggle plugin status")}finally{g(!1)}}},b=e=>{navigator.clipboard.writeText(e),D.Z.success("Copied to clipboard!")};if(m)return(0,a.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,a.jsx)(V.Z,{size:"large"})});if(!c)return(0,a.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,a.jsx)("p",{children:"Plugin not found"}),(0,a.jsx)(w.Z,{className:"mt-4",onClick:s,children:"Go Back"})]});let N=(0,x.aB)(c),Z=(0,x.OB)(c.source),f=(0,x.LH)(c.category);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)(F.Z,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,a.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,a.jsxs)(C.Z,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}),(0,a.jsx)(C.Z,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,a.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:N})]}),(0,a.jsx)(E.Z,{title:"Copy install command",children:(0,a.jsx)(w.Z,{size:"xs",variant:"secondary",icon:j.Z,onClick:()=>b(N),className:"ml-4",children:"Copy"})})]})}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Plugin Details"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-mono text-xs",children:c.id}),(0,a.jsx)(j.Z,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>b(c.id)})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Version"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Source"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-semibold",children:(0,x.i5)(c.source)}),Z&&(0,a.jsx)("a",{href:Z,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,a.jsx)(U.Z,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Category"}),(0,a.jsx)("div",{className:"mt-1",children:c.category?(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}):(0,a.jsx)(H.Z,{className:"text-gray-400",children:"Uncategorized"})})]}),i&&(0,a.jsxs)("div",{className:"col-span-3",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Status"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,a.jsx)(A.Z,{checked:c.enabled,loading:h,onChange:y}),(0,a.jsx)(H.Z,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Description"}),(0,a.jsx)(H.Z,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Keywords"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,a.jsx)(C.Z,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Author Information"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Email"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,a.jsx)("a",{href:"mailto:".concat(c.author.email),className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Homepage"}),(0,a.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,a.jsx)(U.Z,{className:"h-4 w-4"})]})]}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Metadata"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.created_at)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.updated_at)})]}),c.created_by&&(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created By"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})},B=e=>{let{accessToken:l,userRole:s}=e,[o,c]=(0,t.useState)([]),[d,m]=(0,t.useState)(!1),[x,u]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[b,N]=(0,t.useState)(null),Z=!!s&&(0,R.tY)(s),f=async()=>{if(l){u(!0);try{let e=await (0,n.getClaudeCodePluginsList)(l,!1);console.log("Claude Code plugins: ".concat(JSON.stringify(e))),c(e.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{u(!1)}}};(0,t.useEffect)(()=>{f()},[l]);let v=async()=>{if(j&&l){g(!0);try{await (0,n.deleteClaudeCodePlugin)(l,j.name),D.Z.success('Plugin "'.concat(j.displayName,'" deleted successfully')),f()}catch(e){console.error("Error deleting plugin:",e),D.Z.error("Failed to delete plugin")}finally{g(!1),y(null)}}};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,a.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(r.z,{onClick:()=>{b&&N(null),m(!0)},disabled:!l||!Z,children:"+ Add New Plugin"})})]}),b?(0,a.jsx)(q,{pluginId:b,onClose:()=>N(null),accessToken:l,isAdmin:Z,onPluginUpdated:f}):(0,a.jsx)(L,{pluginsList:o,isLoading:x,onDeleteClick:(e,l)=>{y({name:e,displayName:l})},accessToken:l,onPluginUpdated:f,isAdmin:Z,onPluginClick:e=>N(e)}),(0,a.jsx)(p,{visible:d,onClose:()=>{m(!1)},accessToken:l,onSuccess:()=>{f()}}),j&&(0,a.jsxs)(i.Z,{title:"Delete Plugin",open:null!==j,onOk:v,onCancel:()=>{y(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,a.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,a.jsx)("strong",{children:j.displayName}),"?"]}),(0,a.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1572-978bd0dd60e50634.js b/litellm/proxy/_experimental/out/_next/static/chunks/1572-d039561b5597b5d5.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1572-978bd0dd60e50634.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1572-d039561b5597b5d5.js index 82f1773ea0..ba6b168e2b 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1572-978bd0dd60e50634.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1572-d039561b5597b5d5.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1572],{44625:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},77565:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},23907:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},41649:function(r,e,t){t.d(e,{Z:function(){return u}});var n=t(5853),o=t(2265),a=t(47187),i=t(7084),d=t(26898),l=t(13241),c=t(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,c.fn)("Badge"),u=o.forwardRef((r,e)=>{let{color:t,icon:u,size:p=i.u8.SM,tooltip:f,className:h,children:b}=r,w=(0,n._T)(r,["color","icon","size","tooltip","className","children"]),x=u||null,{tooltipProps:k,getReferenceProps:v}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,c.lq)([e,k.refs.setReference]),className:(0,l.q)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",t?(0,l.q)((0,c.bM)(t,d.K.background).bgColor,(0,c.bM)(t,d.K.iconText).textColor,(0,c.bM)(t,d.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,l.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),s[p].paddingX,s[p].paddingY,s[p].fontSize,h)},v,w),o.createElement(a.Z,Object.assign({text:f},k)),x?o.createElement(x,{className:(0,l.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",g[p].height,g[p].width)}):null,o.createElement("span",{className:(0,l.q)(m("text"),"whitespace-nowrap")},b))});u.displayName="Badge"},47323:function(r,e,t){t.d(e,{Z:function(){return f}});var n=t(5853),o=t(2265),a=t(47187),i=t(7084),d=t(13241),l=t(1153),c=t(26898);let s={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},g={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},u=(r,e)=>{switch(r){case"simple":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:e?(0,l.bM)(e,c.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:e?(0,d.q)((0,l.bM)(e,c.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,l.fn)("Icon"),f=o.forwardRef((r,e)=>{let{icon:t,variant:c="simple",tooltip:f,size:h=i.u8.SM,color:b,className:w}=r,x=(0,n._T)(r,["icon","variant","tooltip","size","color","className"]),k=u(c,b),{tooltipProps:v,getReferenceProps:C}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,l.lq)([e,v.refs.setReference]),className:(0,d.q)(p("root"),"inline-flex shrink-0 items-center justify-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,m[c].rounded,m[c].border,m[c].shadow,m[c].ring,s[h].paddingX,s[h].paddingY,w)},C,x),o.createElement(a.Z,Object.assign({text:f},v)),o.createElement(t,{className:(0,d.q)(p("icon"),"shrink-0",g[h].height,g[h].width)}))});f.displayName="Icon"},49804:function(r,e,t){t.d(e,{Z:function(){return c}});var n=t(5853),o=t(13241),a=t(1153),i=t(2265),d=t(9496);let l=(0,a.fn)("Col"),c=i.forwardRef((r,e)=>{let{numColSpan:t=1,numColSpanSm:a,numColSpanMd:c,numColSpanLg:s,children:g,className:m}=r,u=(0,n._T)(r,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),p=(r,e)=>r&&Object.keys(e).includes(String(r))?e[r]:"";return i.createElement("div",Object.assign({ref:e,className:(0,o.q)(l("root"),(()=>{let r=p(t,d.PT),e=p(a,d.SP),n=p(c,d.VS),i=p(s,d._w);return(0,o.q)(r,e,n,i)})(),m)},u),g)});c.displayName="Col"},67101:function(r,e,t){t.d(e,{Z:function(){return s}});var n=t(5853),o=t(13241),a=t(1153),i=t(2265),d=t(9496);let l=(0,a.fn)("Grid"),c=(r,e)=>r&&Object.keys(e).includes(String(r))?e[r]:"",s=i.forwardRef((r,e)=>{let{numItems:t=1,numItemsSm:a,numItemsMd:s,numItemsLg:g,children:m,className:u}=r,p=(0,n._T)(r,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=c(t,d._m),h=c(a,d.LH),b=c(s,d.l5),w=c(g,d.N4),x=(0,o.q)(f,h,b,w);return i.createElement("div",Object.assign({ref:e,className:(0,o.q)(l("root"),"grid",x,u)},p),m)});s.displayName="Grid"},9496:function(r,e,t){t.d(e,{LH:function(){return o},N4:function(){return i},PT:function(){return d},SP:function(){return l},VS:function(){return c},_m:function(){return n},_w:function(){return s},l5:function(){return a}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},a={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},i={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},d={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},l={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},c={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},s={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},84264:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(26898),o=t(13241),a=t(1153),i=t(2265);let d=i.forwardRef((r,e)=>{let{color:t,className:d,children:l}=r;return i.createElement("p",{ref:e,className:(0,o.q)("text-tremor-default",t?(0,a.bM)(t,n.K.text).textColor:(0,o.q)("text-tremor-content","dark:text-dark-tremor-content"),d)},l)});d.displayName="Text"},96761:function(r,e,t){t.d(e,{Z:function(){return l}});var n=t(5853),o=t(26898),a=t(13241),i=t(1153),d=t(2265);let l=d.forwardRef((r,e)=>{let{color:t,children:l,className:c}=r,s=(0,n._T)(r,["color","children","className"]);return d.createElement("p",Object.assign({ref:e,className:(0,a.q)("font-medium text-tremor-title",t?(0,i.bM)(t,o.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",c)},s),l)});l.displayName="Title"},23496:function(r,e,t){t.d(e,{Z:function(){return b}});var n=t(2265),o=t(36760),a=t.n(o),i=t(71744),d=t(33759),l=t(93463),c=t(12918),s=t(99320),g=t(71140);let m=r=>{let{componentCls:e}=r;return{[e]:{"&-horizontal":{["&".concat(e)]:{"&-sm":{marginBlock:r.marginXS},"&-md":{marginBlock:r.margin}}}}}},u=r=>{let{componentCls:e,sizePaddingEdgeHorizontal:t,colorSplit:n,lineWidth:o,textPaddingInline:a,orientationMargin:i,verticalMarginInline:d}=r;return{[e]:Object.assign(Object.assign({},(0,c.Wf)(r)),{borderBlockStart:"".concat((0,l.bf)(o)," solid ").concat(n),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:d,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,l.bf)(o)," solid ").concat(n)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,l.bf)(r.marginLG)," 0")},["&-horizontal".concat(e,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,l.bf)(r.dividerHorizontalWithTextGutterMargin)," 0"),color:r.colorTextHeading,fontWeight:500,fontSize:r.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(n),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,l.bf)(o)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(e,"-with-text-start")]:{"&::before":{width:"calc(".concat(i," * 100%)")},"&::after":{width:"calc(100% - ".concat(i," * 100%)")}},["&-horizontal".concat(e,"-with-text-end")]:{"&::before":{width:"calc(100% - ".concat(i," * 100%)")},"&::after":{width:"calc(".concat(i," * 100%)")}},["".concat(e,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:a},"&-dashed":{background:"none",borderColor:n,borderStyle:"dashed",borderWidth:"".concat((0,l.bf)(o)," 0 0")},["&-horizontal".concat(e,"-with-text").concat(e,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(e,"-dashed")]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:n,borderStyle:"dotted",borderWidth:"".concat((0,l.bf)(o)," 0 0")},["&-horizontal".concat(e,"-with-text").concat(e,"-dotted")]:{"&::before, &::after":{borderStyle:"dotted none none"}},["&-vertical".concat(e,"-dotted")]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(e,"-with-text")]:{color:r.colorText,fontWeight:"normal",fontSize:r.fontSize},["&-horizontal".concat(e,"-with-text-start").concat(e,"-no-default-orientation-margin-start")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(e,"-inner-text")]:{paddingInlineStart:t}},["&-horizontal".concat(e,"-with-text-end").concat(e,"-no-default-orientation-margin-end")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(e,"-inner-text")]:{paddingInlineEnd:t}}})}};var p=(0,s.I$)("Divider",r=>{let e=(0,g.IX)(r,{dividerHorizontalWithTextGutterMargin:r.margin,sizePaddingEdgeHorizontal:0});return[u(e),m(e)]},r=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:r.marginXS}),{unitless:{orientationMargin:!0}}),f=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&0>e.indexOf(n)&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(r);oe.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]]);return t};let h={small:"sm",middle:"md"};var b=r=>{let{getPrefixCls:e,direction:t,className:o,style:l}=(0,i.dj)("divider"),{prefixCls:c,type:s="horizontal",orientation:g="center",orientationMargin:m,className:u,rootClassName:b,children:w,dashed:x,variant:k="solid",plain:v,style:C,size:y}=r,S=f(r,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style","size"]),M=e("divider",c),[E,z,j]=p(M),L=h[(0,d.Z)(y)],N=!!w,O=n.useMemo(()=>"left"===g?"rtl"===t?"end":"start":"right"===g?"rtl"===t?"start":"end":g,[t,g]),Z="start"===O&&null!=m,B="end"===O&&null!=m,I=a()(M,o,z,j,"".concat(M,"-").concat(s),{["".concat(M,"-with-text")]:N,["".concat(M,"-with-text-").concat(O)]:N,["".concat(M,"-dashed")]:!!x,["".concat(M,"-").concat(k)]:"solid"!==k,["".concat(M,"-plain")]:!!v,["".concat(M,"-rtl")]:"rtl"===t,["".concat(M,"-no-default-orientation-margin-start")]:Z,["".concat(M,"-no-default-orientation-margin-end")]:B,["".concat(M,"-").concat(L)]:!!L},u,b),R=n.useMemo(()=>"number"==typeof m?m:/^\d+$/.test(m)?Number(m):m,[m]);return E(n.createElement("div",Object.assign({className:I,style:Object.assign(Object.assign({},l),C)},S,{role:"separator"}),w&&"vertical"!==s&&n.createElement("span",{className:"".concat(M,"-inner-text"),style:{marginInlineStart:Z?R:void 0,marginInlineEnd:B?R:void 0}},w)))}},77331:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=o},86462:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.Z=o},44633:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.Z=o},3477:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.Z=o},53410:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.Z=o},91126:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.Z=o},23628:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.Z=o},49084:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.Z=o},74998:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.Z=o}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1572],{44625:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},77565:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},23907:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"},i=t(55015),d=o.forwardRef(function(r,e){return o.createElement(i.Z,(0,n.Z)({},r,{ref:e,icon:a}))})},41649:function(r,e,t){t.d(e,{Z:function(){return u}});var n=t(5853),o=t(2265),a=t(47187),i=t(7084),d=t(26898),l=t(13241),c=t(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,c.fn)("Badge"),u=o.forwardRef((r,e)=>{let{color:t,icon:u,size:p=i.u8.SM,tooltip:f,className:h,children:b}=r,w=(0,n._T)(r,["color","icon","size","tooltip","className","children"]),x=u||null,{tooltipProps:k,getReferenceProps:v}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,c.lq)([e,k.refs.setReference]),className:(0,l.q)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",t?(0,l.q)((0,c.bM)(t,d.K.background).bgColor,(0,c.bM)(t,d.K.iconText).textColor,(0,c.bM)(t,d.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,l.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),s[p].paddingX,s[p].paddingY,s[p].fontSize,h)},v,w),o.createElement(a.Z,Object.assign({text:f},k)),x?o.createElement(x,{className:(0,l.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",g[p].height,g[p].width)}):null,o.createElement("span",{className:(0,l.q)(m("text"),"whitespace-nowrap")},b))});u.displayName="Badge"},47323:function(r,e,t){t.d(e,{Z:function(){return f}});var n=t(5853),o=t(2265),a=t(47187),i=t(7084),d=t(13241),l=t(1153),c=t(26898);let s={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},g={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},u=(r,e)=>{switch(r){case"simple":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:e?(0,l.bM)(e,c.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:e?(0,d.q)((0,l.bM)(e,c.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:e?(0,l.bM)(e,c.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:e?(0,d.q)((0,l.bM)(e,c.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,l.fn)("Icon"),f=o.forwardRef((r,e)=>{let{icon:t,variant:c="simple",tooltip:f,size:h=i.u8.SM,color:b,className:w}=r,x=(0,n._T)(r,["icon","variant","tooltip","size","color","className"]),k=u(c,b),{tooltipProps:v,getReferenceProps:C}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,l.lq)([e,v.refs.setReference]),className:(0,d.q)(p("root"),"inline-flex shrink-0 items-center justify-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,m[c].rounded,m[c].border,m[c].shadow,m[c].ring,s[h].paddingX,s[h].paddingY,w)},C,x),o.createElement(a.Z,Object.assign({text:f},v)),o.createElement(t,{className:(0,d.q)(p("icon"),"shrink-0",g[h].height,g[h].width)}))});f.displayName="Icon"},49804:function(r,e,t){t.d(e,{Z:function(){return c}});var n=t(5853),o=t(13241),a=t(1153),i=t(2265),d=t(9496);let l=(0,a.fn)("Col"),c=i.forwardRef((r,e)=>{let{numColSpan:t=1,numColSpanSm:a,numColSpanMd:c,numColSpanLg:s,children:g,className:m}=r,u=(0,n._T)(r,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),p=(r,e)=>r&&Object.keys(e).includes(String(r))?e[r]:"";return i.createElement("div",Object.assign({ref:e,className:(0,o.q)(l("root"),(()=>{let r=p(t,d.PT),e=p(a,d.SP),n=p(c,d.VS),i=p(s,d._w);return(0,o.q)(r,e,n,i)})(),m)},u),g)});c.displayName="Col"},67101:function(r,e,t){t.d(e,{Z:function(){return s}});var n=t(5853),o=t(13241),a=t(1153),i=t(2265),d=t(9496);let l=(0,a.fn)("Grid"),c=(r,e)=>r&&Object.keys(e).includes(String(r))?e[r]:"",s=i.forwardRef((r,e)=>{let{numItems:t=1,numItemsSm:a,numItemsMd:s,numItemsLg:g,children:m,className:u}=r,p=(0,n._T)(r,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=c(t,d._m),h=c(a,d.LH),b=c(s,d.l5),w=c(g,d.N4),x=(0,o.q)(f,h,b,w);return i.createElement("div",Object.assign({ref:e,className:(0,o.q)(l("root"),"grid",x,u)},p),m)});s.displayName="Grid"},9496:function(r,e,t){t.d(e,{LH:function(){return o},N4:function(){return i},PT:function(){return d},SP:function(){return l},VS:function(){return c},_m:function(){return n},_w:function(){return s},l5:function(){return a}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},a={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},i={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},d={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},l={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},c={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},s={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},84264:function(r,e,t){t.d(e,{Z:function(){return d}});var n=t(26898),o=t(13241),a=t(1153),i=t(2265);let d=i.forwardRef((r,e)=>{let{color:t,className:d,children:l}=r;return i.createElement("p",{ref:e,className:(0,o.q)("text-tremor-default",t?(0,a.bM)(t,n.K.text).textColor:(0,o.q)("text-tremor-content","dark:text-dark-tremor-content"),d)},l)});d.displayName="Text"},96761:function(r,e,t){t.d(e,{Z:function(){return l}});var n=t(5853),o=t(26898),a=t(13241),i=t(1153),d=t(2265);let l=d.forwardRef((r,e)=>{let{color:t,children:l,className:c}=r,s=(0,n._T)(r,["color","children","className"]);return d.createElement("p",Object.assign({ref:e,className:(0,a.q)("font-medium text-tremor-title",t?(0,i.bM)(t,o.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",c)},s),l)});l.displayName="Title"},23496:function(r,e,t){t.d(e,{Z:function(){return b}});var n=t(2265),o=t(36760),a=t.n(o),i=t(71744),d=t(33759),l=t(93463),c=t(12918),s=t(99320),g=t(71140);let m=r=>{let{componentCls:e}=r;return{[e]:{"&-horizontal":{["&".concat(e)]:{"&-sm":{marginBlock:r.marginXS},"&-md":{marginBlock:r.margin}}}}}},u=r=>{let{componentCls:e,sizePaddingEdgeHorizontal:t,colorSplit:n,lineWidth:o,textPaddingInline:a,orientationMargin:i,verticalMarginInline:d}=r;return{[e]:Object.assign(Object.assign({},(0,c.Wf)(r)),{borderBlockStart:"".concat((0,l.bf)(o)," solid ").concat(n),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:d,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,l.bf)(o)," solid ").concat(n)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,l.bf)(r.marginLG)," 0")},["&-horizontal".concat(e,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,l.bf)(r.dividerHorizontalWithTextGutterMargin)," 0"),color:r.colorTextHeading,fontWeight:500,fontSize:r.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(n),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,l.bf)(o)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(e,"-with-text-start")]:{"&::before":{width:"calc(".concat(i," * 100%)")},"&::after":{width:"calc(100% - ".concat(i," * 100%)")}},["&-horizontal".concat(e,"-with-text-end")]:{"&::before":{width:"calc(100% - ".concat(i," * 100%)")},"&::after":{width:"calc(".concat(i," * 100%)")}},["".concat(e,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:a},"&-dashed":{background:"none",borderColor:n,borderStyle:"dashed",borderWidth:"".concat((0,l.bf)(o)," 0 0")},["&-horizontal".concat(e,"-with-text").concat(e,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(e,"-dashed")]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:n,borderStyle:"dotted",borderWidth:"".concat((0,l.bf)(o)," 0 0")},["&-horizontal".concat(e,"-with-text").concat(e,"-dotted")]:{"&::before, &::after":{borderStyle:"dotted none none"}},["&-vertical".concat(e,"-dotted")]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(e,"-with-text")]:{color:r.colorText,fontWeight:"normal",fontSize:r.fontSize},["&-horizontal".concat(e,"-with-text-start").concat(e,"-no-default-orientation-margin-start")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(e,"-inner-text")]:{paddingInlineStart:t}},["&-horizontal".concat(e,"-with-text-end").concat(e,"-no-default-orientation-margin-end")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(e,"-inner-text")]:{paddingInlineEnd:t}}})}};var p=(0,s.I$)("Divider",r=>{let e=(0,g.IX)(r,{dividerHorizontalWithTextGutterMargin:r.margin,sizePaddingEdgeHorizontal:0});return[u(e),m(e)]},r=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:r.marginXS}),{unitless:{orientationMargin:!0}}),f=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&0>e.indexOf(n)&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(r);oe.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]]);return t};let h={small:"sm",middle:"md"};var b=r=>{let{getPrefixCls:e,direction:t,className:o,style:l}=(0,i.dj)("divider"),{prefixCls:c,type:s="horizontal",orientation:g="center",orientationMargin:m,className:u,rootClassName:b,children:w,dashed:x,variant:k="solid",plain:v,style:C,size:y}=r,S=f(r,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style","size"]),M=e("divider",c),[E,z,j]=p(M),L=h[(0,d.Z)(y)],N=!!w,O=n.useMemo(()=>"left"===g?"rtl"===t?"end":"start":"right"===g?"rtl"===t?"start":"end":g,[t,g]),Z="start"===O&&null!=m,B="end"===O&&null!=m,I=a()(M,o,z,j,"".concat(M,"-").concat(s),{["".concat(M,"-with-text")]:N,["".concat(M,"-with-text-").concat(O)]:N,["".concat(M,"-dashed")]:!!x,["".concat(M,"-").concat(k)]:"solid"!==k,["".concat(M,"-plain")]:!!v,["".concat(M,"-rtl")]:"rtl"===t,["".concat(M,"-no-default-orientation-margin-start")]:Z,["".concat(M,"-no-default-orientation-margin-end")]:B,["".concat(M,"-").concat(L)]:!!L},u,b),R=n.useMemo(()=>"number"==typeof m?m:/^\d+$/.test(m)?Number(m):m,[m]);return E(n.createElement("div",Object.assign({className:I,style:Object.assign(Object.assign({},l),C)},S,{role:"separator"}),w&&"vertical"!==s&&n.createElement("span",{className:"".concat(M,"-inner-text"),style:{marginInlineStart:Z?R:void 0,marginInlineEnd:B?R:void 0}},w)))}},10900:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=o},86462:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.Z=o},44633:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.Z=o},3477:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.Z=o},53410:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.Z=o},91126:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.Z=o},23628:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.Z=o},49084:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.Z=o},74998:function(r,e,t){var n=t(2265);let o=n.forwardRef(function(r,e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:e},r),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.Z=o}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1901-3372096cb83511c4.js b/litellm/proxy/_experimental/out/_next/static/chunks/1901-9d6d72bdecc0e0c8.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/1901-3372096cb83511c4.js rename to litellm/proxy/_experimental/out/_next/static/chunks/1901-9d6d72bdecc0e0c8.js index b6e6323cea..9f3b7ca550 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1901-3372096cb83511c4.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1901-9d6d72bdecc0e0c8.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1901],{91027:function(e,s,a){a.d(s,{Z:function(){return o}});var t=a(57437),l=a(33866),r=a(2265),n=a(9245);function i(e){let s=s=>{"disableShowNewBadge"===s.key&&e()},a=s=>{let{key:a}=s.detail;"disableShowNewBadge"===a&&e()};return window.addEventListener("storage",s),window.addEventListener(n.Qg,a),()=>{window.removeEventListener("storage",s),window.removeEventListener(n.Qg,a)}}function d(){return"true"===(0,n.le)("disableShowNewBadge")}function o(e){let{children:s}=e;return(0,r.useSyncExternalStore)(i,d)?s?(0,t.jsx)(t.Fragment,{children:s}):null:s?(0,t.jsx)(l.Z,{color:"blue",count:"New",children:s}):(0,t.jsx)(l.Z,{color:"blue",count:"New"})}},12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:o,initialValues:m={},buttonLabel:x="Filters"}=e,[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[j,f]=(0,l.useState)({}),[v,y]=(0,l.useState)({}),[b,N]=(0,l.useState)({}),[w,_]=(0,l.useState)({}),k=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){y(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);f(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),f(e=>({...e,[s.name]:[]}))}finally{y(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){y(s=>({...s,[e.name]:!0})),_(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");f(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),f(s=>({...s,[e.name]:[]}))}finally{y(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{u&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[u,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(d.Z,{className:"h-4 w-4"}),onClick:()=>h(!u),className:"flex items-center gap-2",children:x}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),o()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&k(e,a)},filterOption:!1,loading:v[a.name],options:j[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},31901:function(e,s,a){a.d(s,{I:function(){return eU},Z:function(){return eV}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),d=a(29827),o=a(19250),c=a(12322),m=a(59872),x=a(41649),u=a(78489),h=a(99981),g=a(42673);let p=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},j=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:p(s)})},f=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,g.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(u.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsx)(h.Z,{title:"$".concat(String(e.getValue()||0)," "),children:(0,t.jsx)("span",{children:(0,m.GS)(e.getValue()||0)})})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:f(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(h.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(h.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],y=e=>(0,t.jsx)(x.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),b=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:y(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(h.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(h.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,o.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),_=a(86669);function k(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:d}=e,o=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await o(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await o(JSON.stringify(d(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:i(),style:_.jF,clickToExpandNode:!0})})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:d(),style:_.jF,clickToExpandNode:!0})}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,d]=i.useState(!1),o=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),d=i.split("\n"),o="";return d.length>1&&(o=d[d.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:o,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(d(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var D=a(50665),M=a(12514),E=a(35829),T=a(84264),A=a(96761),R=a(77331),z=a(5545),O=a(30401),Z=a(78867);let I=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[d,o]=(0,i.useState)({}),x=a.reduce((e,s)=>e+(s.spend||0),0),g=a.reduce((e,s)=>e+(s.total_tokens||0),0),p=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),j=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),f=g+p+j,y=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-y.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let b=async(e,s)=>{await (0,m.vQ)(e)&&(o(e=>({...e,[s]:!0})),setTimeout(()=>{o(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(u.Z,{icon:R.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(z.ZP,{type:"text",size:"small",icon:d["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(Z.Z,{size:12}),onClick:()=>b(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(d["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,m.pw)(x,6)]})]}),(0,t.jsx)(h.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),p>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(p)})]}),j>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(j)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,m.pw)(f)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(M.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(T.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(E.Z,{children:(0,m.pw)(f)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eU,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function K(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let d=e=>new Date(1e3*e).toLocaleString(),o=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,g.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:d(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:d(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:o(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let H=e=>e>=.8?"text-green-600":"text-yellow-600";var P=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),d=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(H(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:H(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let F=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},q=e=>e?F("detected","red"):F("not detected","slate"),Y=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[d,o]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(d?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),d&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},B=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},V=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var U=e=>{var s,a,l,r,n,i,d,o,c,m;let{response:x}=e;if(!x)return null;let u=null!==(n=null!==(r=x.outputs)&&void 0!==r?r:x.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===x.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=x.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&F("text guarded ".concat(null!==(i=x.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(d=x.guardrailCoverage.textCharacters.total)&&void 0!==d?d:0),"blue"),(null===(a=x.guardrailCoverage)||void 0===a?void 0:a.images)&&F("images guarded ".concat(null!==(o=x.guardrailCoverage.images.guarded)&&void 0!==o?o:0,"/").concat(null!==(c=x.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=x.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Action:",children:F(null!==(m=x.action)&&void 0!==m?m:"N/A",h)}),x.actionReason&&(0,t.jsx)(B,{label:"Action Reason:",children:x.actionReason}),x.blockedResponse&&(0,t.jsx)(B,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:x.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Coverage:",children:g}),(0,t.jsx)(B,{label:"Usage:",children:p})]})]}),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=x.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:x.assessments.map((e,s)=>{var a,l,r,n,i,d,o,c,m,x,u,h,g,p,j,f,v,y,b,N,w,_,k,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&F("word","slate"),e.contentPolicy&&F("content","slate"),e.topicPolicy&&F("topic","slate"),e.sensitiveInformationPolicy&&F("sensitive-info","slate"),e.contextualGroundingPolicy&&F("contextual-grounding","slate"),e.automatedReasoningPolicy&&F("automated-reasoning","slate")]});return(0,t.jsxs)(Y,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&F("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(f=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==f?f:0)>0&&(0,t.jsx)(Y,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(Y,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&F(e.type,"slate")]}),q(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(o=e.contextualGroundingPolicy)||void 0===o?void 0:null===(d=o.filters)||void 0===d?void 0:d.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(y=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(Y,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&F(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(b=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(Y,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[q(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(u=e.topicPolicy)||void 0===u?void 0:null===(x=u.topics)||void 0===x?void 0:x.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&F(e.type,"slate"),q(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(Y,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(B,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&F("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(_=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==_?_:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&F("images ".concat(null!==(k=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==k?k:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(B,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(j=e.automatedReasoningPolicy)||void 0===j?void 0:null===(p=j.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(Y,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(Y,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(x,null,2)})})]})};let W=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},J=e=>{let{title:s,count:a,defaultOpen:l=!0,children:r}=e,[n,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(n?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]})}),n&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:r})]})},G=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})};var Q=e=>{let{response:s}=e;if(!s||"string"==typeof s)return"string"==typeof s&&s?(0,t.jsx)("div",{className:"bg-white rounded-lg border border-red-200 p-4",children:(0,t.jsxs)("div",{className:"text-red-800",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Error"}),(0,t.jsx)("p",{className:"text-sm",children:s})]})}):null;let a=Array.isArray(s)?s:[];if(0===a.length)return(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsx)("div",{className:"text-gray-600 text-sm",children:"No detections found"})});let l=a.filter(e=>"pattern"===e.type),r=a.filter(e=>"blocked_word"===e.type),n=a.filter(e=>"category_keyword"===e.type),i=a.filter(e=>"BLOCK"===e.action).length,d=a.filter(e=>"MASK"===e.action).length,o=a.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(G,{label:"Total Detections:",children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),(0,t.jsx)(G,{label:"Actions:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[i>0&&W("".concat(i," blocked"),"red"),d>0&&W("".concat(d," masked"),"blue"),0===i&&0===d&&W("passed","green")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(G,{label:"By Type:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.length>0&&W("".concat(l.length," patterns"),"slate"),r.length>0&&W("".concat(r.length," keywords"),"slate"),n.length>0&&W("".concat(n.length," categories"),"slate")]})})})]})}),l.length>0&&(0,t.jsx)(J,{title:"Patterns Matched",count:l.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:l.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Pattern:",children:e.pattern_name||"unknown"})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),r.length>0&&(0,t.jsx)(J,{title:"Blocked Words Detected",count:r.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:r.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.description&&(0,t.jsx)(G,{label:"Description:",children:e.description})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),n.length>0&&(0,t.jsx)(J,{title:"Category Keywords Detected",count:n.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:n.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Category:",children:e.category||"unknown"}),(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.severity&&(0,t.jsx)(G,{label:"Severity:",children:W(e.severity,"high"===e.severity?"red":"medium"===e.severity?"amber":"slate")})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),(0,t.jsx)(J,{title:"Raw Detection Data",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(a,null,2)})})]})};let $=e=>new Date(1e3*e).toLocaleString(),X=new Set(["presidio","bedrock","litellm_content_filter"]),ee=e=>{let{response:s}=e,[a,l]=(0,i.useState)(!1);return(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>l(!a),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h5",{className:"font-medium",children:"Raw Guardrail Response"})]})}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})})]})})},es=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",d=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",o="success"===d.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,u=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(h.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:$(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:$(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&u.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(P,{entities:u})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(U,{response:g})}),"litellm_content_filter"===i&&x&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(Q,{response:x})}),i&&!X.has(i)&&x&&(0,t.jsx)(ee,{response:x})]})};var ea=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),d=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),o=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(h.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),o>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[o," masked ",1===o?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(es,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},et=a(87452),el=a(88829),er=a(72208);let en=e=>null==e?"-":"$".concat((0,m.pw)(e,8)),ei=e=>null==e?"-":"".concat((100*e).toFixed(2),"%"),ed=e=>{var s;let{costBreakdown:a,totalSpend:l}=e;if(!a)return null;let r=void 0!==a.discount_percent&&0!==a.discount_percent||void 0!==a.discount_amount&&0!==a.discount_amount,n=void 0!==a.margin_percent&&0!==a.margin_percent||void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount||void 0!==a.margin_total_amount&&0!==a.margin_total_amount;return void 0!==a.input_cost||void 0!==a.output_cost||r||n?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:(0,t.jsxs)(et.Z,{children:[(0,t.jsx)(er.Z,{className:"p-4 border-b hover:bg-gray-50 transition-colors text-left",children:(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Cost Breakdown"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mr-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Total:"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:en(l)})]})]})}),(0,t.jsx)(el.Z,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2 max-w-2xl",children:[(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Input Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.input_cost)})]}),(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Output Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.output_cost)})]}),void 0!==a.tool_usage_cost&&a.tool_usage_cost>0&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Tool Usage Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.tool_usage_cost)})]})]}),(0,t.jsx)("div",{className:"pt-2 border-t border-gray-100 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex text-sm font-semibold",children:[(0,t.jsx)("span",{className:"text-gray-900 w-1/3",children:"Original LLM Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.original_cost)})]})}),(r||n)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[r&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.discount_percent&&0!==a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Discount (",ei(a.discount_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]}),void 0!==a.discount_amount&&void 0===a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Discount Amount:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]})]}),n&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.margin_percent&&0!==a.margin_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Margin (",ei(a.margin_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en((a.margin_total_amount||0)-(a.margin_fixed_amount||0))]})]}),void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Margin:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en(a.margin_fixed_amount)]})]})]})]}),(0,t.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-gray-900 w-1/3",children:"Final Calculated Cost:"}),(0,t.jsx)("span",{className:"text-sm font-bold text-gray-900",children:en(null!==(s=a.total_cost)&&void 0!==s?s:l)})]})})]})})]})}):null};var eo=a(23048),ec=a(30841),em=a(7310),ex=a.n(em),eu=a(12363);let eh={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias",ERROR_CODE:"Error Code"};var eg=a(59341),ep=a(12485),ej=a(18135),ef=a(35242),ev=a(29706),ey=a(77991),eb=a(92280);let eN="".concat("../ui/assets/","audit-logs-preview.png");function ew(e){let{userID:s,userRole:a,token:l,accessToken:d,isActive:x,premiumUser:u,allTeams:h}=e,[g,p]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),j=(0,i.useRef)(null),f=(0,i.useRef)(null),[v,y]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,_]=(0,i.useState)({}),[k,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[D,M]=(0,i.useState)(""),[E,T]=(0,i.useState)("all"),[A,R]=(0,i.useState)("all"),[z,O]=(0,i.useState)(!1),[Z,I]=(0,i.useState)(!1),K=(0,n.a)({queryKey:["all_audit_logs",d,l,a,s,g],queryFn:async()=>{if(!d||!l||!a||!s)return[];let e=r()(g).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,o.uiAuditLogsCall)(d,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!d&&!!l&&!!a&&!!s&&x,refetchInterval:5e3,refetchIntervalInBackground:!0}),H=(0,i.useCallback)(async e=>{if(d)try{let s=(await (0,o.keyListCall)(d,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[d]);(0,i.useEffect)(()=>{if(!d)return;let e=!1,s=!1;w["Team ID"]?k!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==k&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?H(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&y(1)},[w,d,H,k,C]),(0,i.useEffect)(()=>{y(1)},[k,C,g,D,E,A]),(0,i.useEffect)(()=>{function e(e){j.current&&!j.current.contains(e.target)&&O(!1),f.current&&!f.current.contains(e.target)&&I(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let P=(0,i.useMemo)(()=>K.data?K.data.filter(e=>{var s,a,t,l,r,n,i;let d=!0,o=!0,c=!0,m=!0,x=!0;if(k){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;d=r===k||n===k}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;o="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){o=!1}if(D&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(D.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}x=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return d&&o&&c&&m&&x}):[],[K.data,k,C,D,E,A]),F=P.length,q=Math.ceil(F/N)||1,Y=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return P.slice(e,s)},[P,v,N]),B=!K.data||0===K.data.length,V=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(eb.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,m.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,m.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(eb.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},d=a,o=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),d=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},o=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(d={"No fields changed":"N/A"},o={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(d,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(o,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:eN,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let U=F>0?(v-1)*N+1:0,W=Math.min(v*N,F);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:B}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:D,onChange:e=>M(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{K.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(K.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{T(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:f,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>I(!Z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),Z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{R(e.value),I(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",K.isLoading?"...":U," -"," ",K.isLoading?"...":W," of"," ",K.isLoading?"...":F," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",K.isLoading?"...":v," of"," ",K.isLoading?"...":q]}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.max(1,e-1)),disabled:K.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.min(q,e+1)),disabled:K.isLoading||v===q,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:b,data:Y,renderSubComponent:V,getRowCanExpand:()=>!0})]})]})}let e_=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ek=a(9309),eS=a(30280),eC=a(44633),eL=a(86462),eD=a(49084),eM=a(71594),eE=a(24525),eT=a(19130);function eA(e){let{keys:s,totalCount:a,isLoading:l,isFetching:r,pageIndex:n,pageSize:d,onPageChange:o}=e,[c,x]=(0,i.useState)([{id:"deleted_at",desc:!0}]),[u,g]=(0,i.useState)({pageIndex:n,pageSize:d});i.useEffect(()=>{g({pageIndex:n,pageSize:d})},[n,d]);let p=[{id:"token",accessorKey:"token",header:"Key ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[200px]",children:null!=s?s:"-"})})}},{id:"team_alias",accessorKey:"team_alias",header:"Team Alias",size:120,maxSize:180,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>(0,t.jsx)("span",{className:"block max-w-[140px]",children:(0,m.pw)(e.getValue(),4)})},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null===s?"Unlimited":"$".concat((0,m.pw)(s))})}},{id:"user_email",accessorKey:"user_email",header:"User Email",size:160,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[250px]",children:null!=s?s:"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:120,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:120,maxSize:180,cell:e=>{let s=e.row.original.created_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],j=(0,eM.b7)({data:s,columns:p,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:c,pagination:u},onSortingChange:x,onPaginationChange:e=>{let s="function"==typeof e?e(u):e;g(s),o(s.pageIndex)},getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),getPaginationRowModel:(0,eE.G_)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(a/d)}),{pageIndex:f}=j.getState().pagination,v=f*d+1,y="".concat(v," - ").concat(Math.min((f+1)*d,a));return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[l||r?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",y," of ",a," results"]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[l||r?(0,t.jsx)("span",{className:"text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",f+1," of ",j.getPageCount()]}),(0,t.jsx)("button",{onClick:()=>j.previousPage(),disabled:l||r||!j.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>j.nextPage(),disabled:l||r||!j.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eT.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:j.getCenterTotalSize()},children:[(0,t.jsx)(eT.ss,{children:j.getHeaderGroups().map(e=>(0,t.jsx)(eT.SC,{children:e.headers.map(e=>(0,t.jsx)(eT.xs,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(j.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eT.RM,{children:l||r?(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):s.length>0?j.getRowModel().rows.map(e=>(0,t.jsx)(eT.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eT.pj,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted keys found"})})})})})]})})})})]})})}function eR(){let[e,s]=(0,i.useState)(0),[a]=(0,i.useState)(50),{data:l,isPending:r,isFetching:n}=(0,eS.Tv)(e+1,a);return(0,t.jsx)(eA,{keys:(null==l?void 0:l.keys)||[],totalCount:(null==l?void 0:l.total_count)||0,isLoading:r,isFetching:n,pageIndex:e,pageSize:a,onPageChange:s})}var ez=a(47359),eO=a(21626),eZ=a(97214),eI=a(28241),eK=a(58834),eH=a(69552),eP=a(71876),eF=a(46468);function eq(e){let{teams:s,isLoading:a,isFetching:l}=e,[r,n]=(0,i.useState)([{id:"deleted_at",desc:!0}]),d=[{id:"team_alias",accessorKey:"team_alias",header:"Team Name",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"team_id",accessorKey:"team_id",header:"Team ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>{let s=e.row.original.spend;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:void 0!==s?(0,m.pw)(s,4):"-"})}},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null==s?"No limit":"$".concat((0,m.pw)(s))})}},{id:"models",accessorKey:"models",header:"Models",size:200,maxSize:300,cell:e=>{let s=e.getValue();return Array.isArray(s)&&0!==s.length?(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 max-w-[300px]",children:[s.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})},s):(0,t.jsx)(x.Z,{size:"xs",color:"blue",children:(0,t.jsx)(T.Z,{children:e.length>30?"".concat((0,eF.W0)(e).slice(0,30),"..."):(0,eF.W0)(e)})},s)),s.length>3&&(0,t.jsx)(x.Z,{size:"xs",color:"gray",children:(0,t.jsxs)(T.Z,{children:["+",s.length-3," ",s.length-3==1?"more model":"more models"]})})]}):(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})})}},{id:"organization_id",accessorKey:"organization_id",header:"Organization",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],o=(0,eM.b7)({data:s,columns:d,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:r},onSortingChange:n,getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),enableSorting:!0,manualSorting:!1});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between w-full mb-4",children:a||l?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",s.length," ",1===s.length?"team":"teams"]})}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eO.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:o.getCenterTotalSize()},children:[(0,t.jsx)(eK.Z,{children:o.getHeaderGroups().map(e=>(0,t.jsx)(eP.Z,{children:e.headers.map(e=>(0,t.jsx)(eH.Z,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(o.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eZ.Z,{children:a||l?(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading teams..."})})})}):s.length>0?o.getRowModel().rows.map(e=>(0,t.jsx)(eP.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eI.Z,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted teams found"})})})})})]})})})})]})})}function eY(){let{data:e,isPending:s,isFetching:a}=(0,ez.iN)(1,100);return(0,t.jsx)(eq,{teams:e||[],isLoading:s,isFetching:a})}var eB=a(91027);function eV(e){var s,a,l;let{accessToken:m,token:x,userRole:u,userID:h,allTeams:g,premiumUser:p}=e,[j,f]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,_]=(0,i.useState)(!1),[k,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),M=(0,i.useRef)(null),E=(0,i.useRef)(null),T=(0,i.useRef)(null),[A,R]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[z,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[Z,K]=(0,i.useState)(!1),[H,P]=(0,i.useState)(!1),[F,q]=(0,i.useState)(""),[Y,B]=(0,i.useState)(""),[V,U]=(0,i.useState)(""),[W,J]=(0,i.useState)(""),[G,Q]=(0,i.useState)(""),[$,X]=(0,i.useState)(null),[ee,es]=(0,i.useState)(null),[ea,et]=(0,i.useState)(""),[el,er]=(0,i.useState)(""),[en,ei]=(0,i.useState)(u&&C.lo.includes(u)),[ed,em]=(0,i.useState)("request logs"),[eb,eN]=(0,i.useState)(null),[ek,eS]=(0,i.useState)(null),eC=(0,d.NL)(),[eL,eD]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eL))},[eL]);let[eM,eE]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ee&&m&&X({...(await (0,o.keyInfoV1Call)(m,ee)).info,token:ee,api_key:ee})})()},[ee,m]),(0,i.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&_(!1),E.current&&!E.current.contains(e.target)&&b(!1),T.current&&!T.current.contains(e.target)&&P(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{u&&C.lo.includes(u)&&ei(!0)},[u]);let eT=(0,n.a)({queryKey:["logs","table",k,L,A,z,V,W,en?h:null,ea,G],queryFn:async()=>{if(!m||!x||!u||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=Z?r()(z).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,o.uiSpendLogsCall)(m,W||void 0,V||void 0,void 0,e,s,k,L,en?h:void 0,el,ea,G);return await N(a.data,e,m,eC),a.data=a.data.map(s=>{let a=eC.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!x&&!!u&&!!h&&"request logs"===ed,refetchInterval:!!eL&&1===k&&15e3,refetchIntervalInBackground:!0}),eA=eT.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},{filters:ez,filteredLogs:eO,allTeams:eZ,allKeyAliases:eI,handleFilterChange:eK,handleFilterReset:eH}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:d=eu.d,isCustomDate:c,setCurrentPage:m,userID:x,userRole:u}=e,h=(0,i.useMemo)(()=>({[eh.TEAM_ID]:"",[eh.KEY_HASH]:"",[eh.REQUEST_ID]:"",[eh.MODEL]:"",[eh.USER_ID]:"",[eh.END_USER]:"",[eh.STATUS]:"",[eh.KEY_ALIAS]:"",[eh.ERROR_CODE]:""}),[]),[g,p]=(0,i.useState)(h),[j,f]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),y=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,o.uiSpendLogsCall)(a,e[eh.KEY_HASH]||void 0,e[eh.TEAM_ID]||void 0,e[eh.REQUEST_ID]||void 0,i,m,s,d,e[eh.USER_ID]||void 0,e[eh.END_USER]||void 0,e[eh.STATUS]||void 0,e[eh.MODEL]||void 0,e[eh.KEY_ALIAS]||void 0,e[eh.ERROR_CODE]||void 0);n===v.current&&t.data&&f(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,d]),b=(0,i.useMemo)(()=>ex()((e,s)=>y(e,s),300),[y]);(0,i.useEffect)(()=>()=>b.cancel(),[b]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,ec.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[eh.KEY_ALIAS]||g[eh.KEY_HASH]||g[eh.REQUEST_ID]||g[eh.USER_ID]||g[eh.END_USER]||g[eh.ERROR_CODE]),[g]),_=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[eh.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[eh.TEAM_ID])),g[eh.STATUS]&&(e=e.filter(e=>"success"===g[eh.STATUS]?!e.status||"success"===e.status:e.status===g[eh.STATUS])),g[eh.MODEL]&&(e=e.filter(e=>e.model===g[eh.MODEL])),g[eh.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[eh.KEY_HASH])),g[eh.END_USER]&&(e=e.filter(e=>e.end_user===g[eh.END_USER])),g[eh.ERROR_CODE]&&(e=e.filter(e=>{let s=(e.metadata||{}).error_information;return s&&s.error_code===g[eh.ERROR_CODE]})),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),k=(0,i.useMemo)(()=>w?j&&j.data&&j.data.length>0?j:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:_,[w,j,_,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,ec.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:k,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),b(a,1)),a})},handleFilterReset:()=>{p(h),f({data:[],total:0,page:1,page_size:50,total_pages:0}),b(h,1)}}}({logs:eA,accessToken:m,startTime:A,endTime:z,pageSize:L,isCustomDate:Z,setCurrentPage:S,userID:h,userRole:u}),eP=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,o.keyListCall)(m,null,null,e,null,null,k,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,k,L]);(0,i.useEffect)(()=>{m&&(ez["Team ID"]?U(ez["Team ID"]):U(""),et(ez.Status||""),Q(ez.Model||""),er(ez["End User"]||""),ez["Key Hash"]?J(ez["Key Hash"]):ez["Key Alias"]?eP(ez["Key Alias"]):J(""))},[ez,m,eP]);let eF=(0,n.a)({queryKey:["sessionLogs",ek],queryFn:async()=>{if(!m||!ek)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,o.sessionSpendLogsCall)(m,ek);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!ek});if((0,i.useEffect)(()=>{var e;(null===(e=eT.data)||void 0===e?void 0:e.data)&&eb&&!eT.data.data.some(e=>e.request_id===eb)&&eN(null)},[null===(s=eT.data)||void 0===s?void 0:s.data,eb]),!m||!x||!u||!h)return null;let eq=eO.data.filter(e=>!j||e.request_id.includes(j)||e.model.includes(j)||e.user&&e.user.includes(j)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>es(e),onSessionClick:e=>{e&&eS(e)}}))||[],eV=(null===(l=eF.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>es(e),onSessionClick:e=>{}})))||[],eW=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=new Set;return e.forEach(e=>{let t=e.metadata||{};if("failure"===t.status&&t.error_information){let e=t.error_information.error_code;e&&(!s||e.toLowerCase().includes(s.toLowerCase()))&&a.add(e)}}),Array.from(a).map(e=>({label:e,value:e}))},eJ=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,ec.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,o.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Error Code",label:"Error Code",isSearchable:!0,searchFn:async e=>eW(eA.data,e)},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(ek&&eF.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(I,{sessionId:ek,logs:eF.data.data,onBack:()=>eS(null)})});let eG=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eQ=eG.find(e=>e.value===eM.value&&e.unit===eM.unit),e$=Z?e_(Z,A,z):null==eQ?void 0:eQ.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(ej.Z,{defaultIndex:0,onIndexChange:e=>em(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(ef.Z,{children:[(0,t.jsx)(ep.Z,{children:"Request Logs"}),(0,t.jsx)(ep.Z,{children:"Audit Logs"}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Keys ",(0,t.jsx)(eB.Z,{})]})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Teams ",(0,t.jsx)(eB.Z,{})]})})]}),(0,t.jsxs)(ey.Z,{children:[(0,t.jsxs)(ev.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:ek?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:ek}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eS(null),children:"← Back to All Logs"})]}):"Request Logs"})}),$&&ee&&$.api_key===ee?(0,t.jsx)(D.Z,{keyId:ee,keyData:$,teams:g,onClose:()=>es(null),backButtonText:"Back to Logs"}):ek?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eV,renderSubComponent:eU,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo.Z,{options:eJ,onApplyFilters:eK,onResetFilters:eH}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j,onChange:e=>f(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:T,children:[(0,t.jsxs)("button",{onClick:()=>P(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e$]}),H&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eG.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(e$===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),R(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eE({value:e.value,unit:e.unit}),K(!1),P(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(Z?"bg-blue-50 text-blue-600":""),onClick:()=>K(!Z),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(eg.Z,{color:"green",checked:eL,defaultChecked:!0,onChange:eD})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eT.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eT.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),Z&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{R(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:z,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eT.isLoading?"...":eO?(k-1)*L+1:0," -"," ",eT.isLoading?"...":eO?Math.min(k*L,eO.total):0," ","of ",eT.isLoading?"...":eO?eO.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eT.isLoading?"...":k," of"," ",eT.isLoading?"...":eO?eO.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eT.isLoading||1===k,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eO.total_pages||1,e+1)),disabled:eT.isLoading||k===(eO.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eL&&1===k&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eD(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eq,renderSubComponent:eU,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(ew,{userID:h,userRole:u,token:x,accessToken:m,isActive:"audit logs"===ed,premiumUser:p,allTeams:g})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eR,{})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eY,{})})]})]})})}function eU(e){var s,a,l,r,n,i,d,o,c,x,u,g;let{row:p}=e,j=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},f=p.original.metadata||{},v="failure"===f.status,y=v?f.error_information:null,b=p.original.messages&&(Array.isArray(p.original.messages)?p.original.messages.length>0:Object.keys(p.original.messages).length>0),N=p.original.response&&Object.keys(j(p.original.response)).length>0,w=f.vector_store_request_metadata&&Array.isArray(f.vector_store_request_metadata)&&f.vector_store_request_metadata.length>0,_=null===(s=p.original.metadata)||void 0===s?void 0:s.guardrail_information,C=Array.isArray(_)?_:_?[_]:[],D=C.length>0,M=C.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),E=1===C.length?null!==(g=null===(a=C[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==g?g:"-":C.length>1?"".concat(C.length," guardrails"):"-",T=(0,ek.aS)(p.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),p.original.request_id.length>64?(0,t.jsx)(h.Z,{title:p.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:p.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:p.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:p.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:p.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:p.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(h.Z,{title:p.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:p.original.api_base||"-"})})]}),(null==p?void 0:null===(l=p.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==p?void 0:null===(r=p.original)||void 0===r?void 0:r.requester_ip_address})]}),D&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:E}),M>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[M," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[p.original.total_tokens," (",p.original.prompt_tokens," prompt tokens +"," ",p.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)((null===(i=p.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)(null===(d=p.original.metadata)||void 0===d?void 0:d.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,m.pw)(p.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:p.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(o=p.original.metadata)||void 0===o?void 0:o.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=p.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:p.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:p.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[p.original.duration," s."]})]}),(null===(x=p.original.metadata)||void 0===x?void 0:x.litellm_overhead_time_ms)!==void 0&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"LiteLLM Overhead:"}),(0,t.jsxs)("span",{children:[p.original.metadata.litellm_overhead_time_ms," ms"]})]})]})]})]}),(0,t.jsx)(ed,{costBreakdown:null===(u=p.original.metadata)||void 0===u?void 0:u.cost_breakdown,totalSpend:p.original.spend||0}),(0,t.jsx)(L,{show:!b&&!N}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(k,{row:p,hasMessages:b,hasResponse:N,hasError:v,errorInfo:y,getRawRequest:()=>{var e;return(null===(e=p.original)||void 0===e?void 0:e.proxy_server_request)?j(p.original.proxy_server_request):j(p.original.messages)},formattedResponse:()=>v&&y?{error:{message:y.error_message||"An error occurred",type:y.error_class||"error",code:y.error_code||"unknown",param:null}}:j(p.original.response)})}),D&&(0,t.jsx)(ea,{data:_}),w&&(0,t.jsx)(K,{data:f.vector_store_request_metadata}),v&&y&&(0,t.jsx)(S,{errorInfo:y}),p.original.request_tags&&Object.keys(p.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(p.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),p.original.metadata&&Object.keys(p.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(p.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(p.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1901],{91027:function(e,s,a){a.d(s,{Z:function(){return o}});var t=a(57437),l=a(33866),r=a(2265),n=a(9245);function i(e){let s=s=>{"disableShowNewBadge"===s.key&&e()},a=s=>{let{key:a}=s.detail;"disableShowNewBadge"===a&&e()};return window.addEventListener("storage",s),window.addEventListener(n.Qg,a),()=>{window.removeEventListener("storage",s),window.removeEventListener(n.Qg,a)}}function d(){return"true"===(0,n.le)("disableShowNewBadge")}function o(e){let{children:s}=e;return(0,r.useSyncExternalStore)(i,d)?s?(0,t.jsx)(t.Fragment,{children:s}):null:s?(0,t.jsx)(l.Z,{color:"blue",count:"New",children:s}):(0,t.jsx)(l.Z,{color:"blue",count:"New"})}},12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:o,initialValues:m={},buttonLabel:x="Filters"}=e,[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[j,f]=(0,l.useState)({}),[v,y]=(0,l.useState)({}),[b,N]=(0,l.useState)({}),[w,_]=(0,l.useState)({}),k=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){y(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);f(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),f(e=>({...e,[s.name]:[]}))}finally{y(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){y(s=>({...s,[e.name]:!0})),_(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");f(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),f(s=>({...s,[e.name]:[]}))}finally{y(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{u&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[u,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(d.Z,{className:"h-4 w-4"}),onClick:()=>h(!u),className:"flex items-center gap-2",children:x}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),o()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&k(e,a)},filterOption:!1,loading:v[a.name],options:j[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},31901:function(e,s,a){a.d(s,{I:function(){return eU},Z:function(){return eV}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),d=a(29827),o=a(19250),c=a(60493),m=a(59872),x=a(41649),u=a(78489),h=a(99981),g=a(42673);let p=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},j=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:p(s)})},f=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,g.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(u.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsx)(h.Z,{title:"$".concat(String(e.getValue()||0)," "),children:(0,t.jsx)("span",{children:(0,m.GS)(e.getValue()||0)})})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:f(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(h.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(h.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],y=e=>(0,t.jsx)(x.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),b=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:y(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(h.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(h.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,o.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),_=a(86669);function k(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:d}=e,o=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await o(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await o(JSON.stringify(d(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:i(),style:_.jF,clickToExpandNode:!0})})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:d(),style:_.jF,clickToExpandNode:!0})}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,d]=i.useState(!1),o=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),d=i.split("\n"),o="";return d.length>1&&(o=d[d.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:o,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(d(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,t.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var D=a(50665),M=a(12514),E=a(35829),T=a(84264),A=a(96761),R=a(10900),z=a(5545),O=a(30401),Z=a(78867);let I=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[d,o]=(0,i.useState)({}),x=a.reduce((e,s)=>e+(s.spend||0),0),g=a.reduce((e,s)=>e+(s.total_tokens||0),0),p=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),j=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),f=g+p+j,y=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-y.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let b=async(e,s)=>{await (0,m.vQ)(e)&&(o(e=>({...e,[s]:!0})),setTimeout(()=>{o(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(u.Z,{icon:R.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(z.ZP,{type:"text",size:"small",icon:d["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(Z.Z,{size:12}),onClick:()=>b(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(d["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,m.pw)(x,6)]})]}),(0,t.jsx)(h.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),p>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(p)})]}),j>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(j)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,m.pw)(f)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(M.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(T.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(E.Z,{children:(0,m.pw)(f)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eU,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function K(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let d=e=>new Date(1e3*e).toLocaleString(),o=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,g.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:d(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:d(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:o(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let H=e=>e>=.8?"text-green-600":"text-yellow-600";var P=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),d=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(H(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:H(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let F=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},q=e=>e?F("detected","red"):F("not detected","slate"),Y=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[d,o]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(d?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),d&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},B=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},V=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var U=e=>{var s,a,l,r,n,i,d,o,c,m;let{response:x}=e;if(!x)return null;let u=null!==(n=null!==(r=x.outputs)&&void 0!==r?r:x.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===x.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=x.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&F("text guarded ".concat(null!==(i=x.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(d=x.guardrailCoverage.textCharacters.total)&&void 0!==d?d:0),"blue"),(null===(a=x.guardrailCoverage)||void 0===a?void 0:a.images)&&F("images guarded ".concat(null!==(o=x.guardrailCoverage.images.guarded)&&void 0!==o?o:0,"/").concat(null!==(c=x.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=x.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Action:",children:F(null!==(m=x.action)&&void 0!==m?m:"N/A",h)}),x.actionReason&&(0,t.jsx)(B,{label:"Action Reason:",children:x.actionReason}),x.blockedResponse&&(0,t.jsx)(B,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:x.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Coverage:",children:g}),(0,t.jsx)(B,{label:"Usage:",children:p})]})]}),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=x.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:x.assessments.map((e,s)=>{var a,l,r,n,i,d,o,c,m,x,u,h,g,p,j,f,v,y,b,N,w,_,k,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&F("word","slate"),e.contentPolicy&&F("content","slate"),e.topicPolicy&&F("topic","slate"),e.sensitiveInformationPolicy&&F("sensitive-info","slate"),e.contextualGroundingPolicy&&F("contextual-grounding","slate"),e.automatedReasoningPolicy&&F("automated-reasoning","slate")]});return(0,t.jsxs)(Y,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&F("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(f=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==f?f:0)>0&&(0,t.jsx)(Y,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(Y,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&F(e.type,"slate")]}),q(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(o=e.contextualGroundingPolicy)||void 0===o?void 0:null===(d=o.filters)||void 0===d?void 0:d.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(y=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(Y,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&F(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(b=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(Y,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[q(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(u=e.topicPolicy)||void 0===u?void 0:null===(x=u.topics)||void 0===x?void 0:x.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&F(e.type,"slate"),q(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(Y,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(B,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&F("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(_=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==_?_:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&F("images ".concat(null!==(k=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==k?k:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(B,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(j=e.automatedReasoningPolicy)||void 0===j?void 0:null===(p=j.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(Y,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(Y,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(x,null,2)})})]})};let W=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},J=e=>{let{title:s,count:a,defaultOpen:l=!0,children:r}=e,[n,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(n?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]})}),n&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:r})]})},G=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})};var Q=e=>{let{response:s}=e;if(!s||"string"==typeof s)return"string"==typeof s&&s?(0,t.jsx)("div",{className:"bg-white rounded-lg border border-red-200 p-4",children:(0,t.jsxs)("div",{className:"text-red-800",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Error"}),(0,t.jsx)("p",{className:"text-sm",children:s})]})}):null;let a=Array.isArray(s)?s:[];if(0===a.length)return(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsx)("div",{className:"text-gray-600 text-sm",children:"No detections found"})});let l=a.filter(e=>"pattern"===e.type),r=a.filter(e=>"blocked_word"===e.type),n=a.filter(e=>"category_keyword"===e.type),i=a.filter(e=>"BLOCK"===e.action).length,d=a.filter(e=>"MASK"===e.action).length,o=a.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(G,{label:"Total Detections:",children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),(0,t.jsx)(G,{label:"Actions:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[i>0&&W("".concat(i," blocked"),"red"),d>0&&W("".concat(d," masked"),"blue"),0===i&&0===d&&W("passed","green")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(G,{label:"By Type:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.length>0&&W("".concat(l.length," patterns"),"slate"),r.length>0&&W("".concat(r.length," keywords"),"slate"),n.length>0&&W("".concat(n.length," categories"),"slate")]})})})]})}),l.length>0&&(0,t.jsx)(J,{title:"Patterns Matched",count:l.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:l.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Pattern:",children:e.pattern_name||"unknown"})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),r.length>0&&(0,t.jsx)(J,{title:"Blocked Words Detected",count:r.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:r.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.description&&(0,t.jsx)(G,{label:"Description:",children:e.description})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),n.length>0&&(0,t.jsx)(J,{title:"Category Keywords Detected",count:n.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:n.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Category:",children:e.category||"unknown"}),(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.severity&&(0,t.jsx)(G,{label:"Severity:",children:W(e.severity,"high"===e.severity?"red":"medium"===e.severity?"amber":"slate")})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),(0,t.jsx)(J,{title:"Raw Detection Data",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(a,null,2)})})]})};let $=e=>new Date(1e3*e).toLocaleString(),X=new Set(["presidio","bedrock","litellm_content_filter"]),ee=e=>{let{response:s}=e,[a,l]=(0,i.useState)(!1);return(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>l(!a),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h5",{className:"font-medium",children:"Raw Guardrail Response"})]})}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})})]})})},es=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",d=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",o="success"===d.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,u=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(h.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:$(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:$(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&u.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(P,{entities:u})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(U,{response:g})}),"litellm_content_filter"===i&&x&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(Q,{response:x})}),i&&!X.has(i)&&x&&(0,t.jsx)(ee,{response:x})]})};var ea=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),d=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),o=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(h.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),o>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[o," masked ",1===o?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(es,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},et=a(87452),el=a(88829),er=a(72208);let en=e=>null==e?"-":"$".concat((0,m.pw)(e,8)),ei=e=>null==e?"-":"".concat((100*e).toFixed(2),"%"),ed=e=>{var s;let{costBreakdown:a,totalSpend:l}=e;if(!a)return null;let r=void 0!==a.discount_percent&&0!==a.discount_percent||void 0!==a.discount_amount&&0!==a.discount_amount,n=void 0!==a.margin_percent&&0!==a.margin_percent||void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount||void 0!==a.margin_total_amount&&0!==a.margin_total_amount;return void 0!==a.input_cost||void 0!==a.output_cost||r||n?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:(0,t.jsxs)(et.Z,{children:[(0,t.jsx)(er.Z,{className:"p-4 border-b hover:bg-gray-50 transition-colors text-left",children:(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Cost Breakdown"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mr-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Total:"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:en(l)})]})]})}),(0,t.jsx)(el.Z,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2 max-w-2xl",children:[(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Input Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.input_cost)})]}),(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Output Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.output_cost)})]}),void 0!==a.tool_usage_cost&&a.tool_usage_cost>0&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Tool Usage Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.tool_usage_cost)})]})]}),(0,t.jsx)("div",{className:"pt-2 border-t border-gray-100 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex text-sm font-semibold",children:[(0,t.jsx)("span",{className:"text-gray-900 w-1/3",children:"Original LLM Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.original_cost)})]})}),(r||n)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[r&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.discount_percent&&0!==a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Discount (",ei(a.discount_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]}),void 0!==a.discount_amount&&void 0===a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Discount Amount:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]})]}),n&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.margin_percent&&0!==a.margin_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Margin (",ei(a.margin_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en((a.margin_total_amount||0)-(a.margin_fixed_amount||0))]})]}),void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Margin:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en(a.margin_fixed_amount)]})]})]})]}),(0,t.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-gray-900 w-1/3",children:"Final Calculated Cost:"}),(0,t.jsx)("span",{className:"text-sm font-bold text-gray-900",children:en(null!==(s=a.total_cost)&&void 0!==s?s:l)})]})})]})})]})}):null};var eo=a(23048),ec=a(30841),em=a(7310),ex=a.n(em),eu=a(12363);let eh={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias",ERROR_CODE:"Error Code"};var eg=a(59341),ep=a(12485),ej=a(18135),ef=a(35242),ev=a(29706),ey=a(77991),eb=a(92280);let eN="".concat("../ui/assets/","audit-logs-preview.png");function ew(e){let{userID:s,userRole:a,token:l,accessToken:d,isActive:x,premiumUser:u,allTeams:h}=e,[g,p]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),j=(0,i.useRef)(null),f=(0,i.useRef)(null),[v,y]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,_]=(0,i.useState)({}),[k,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[D,M]=(0,i.useState)(""),[E,T]=(0,i.useState)("all"),[A,R]=(0,i.useState)("all"),[z,O]=(0,i.useState)(!1),[Z,I]=(0,i.useState)(!1),K=(0,n.a)({queryKey:["all_audit_logs",d,l,a,s,g],queryFn:async()=>{if(!d||!l||!a||!s)return[];let e=r()(g).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,o.uiAuditLogsCall)(d,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!d&&!!l&&!!a&&!!s&&x,refetchInterval:5e3,refetchIntervalInBackground:!0}),H=(0,i.useCallback)(async e=>{if(d)try{let s=(await (0,o.keyListCall)(d,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[d]);(0,i.useEffect)(()=>{if(!d)return;let e=!1,s=!1;w["Team ID"]?k!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==k&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?H(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&y(1)},[w,d,H,k,C]),(0,i.useEffect)(()=>{y(1)},[k,C,g,D,E,A]),(0,i.useEffect)(()=>{function e(e){j.current&&!j.current.contains(e.target)&&O(!1),f.current&&!f.current.contains(e.target)&&I(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let P=(0,i.useMemo)(()=>K.data?K.data.filter(e=>{var s,a,t,l,r,n,i;let d=!0,o=!0,c=!0,m=!0,x=!0;if(k){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;d=r===k||n===k}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;o="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){o=!1}if(D&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(D.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}x=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return d&&o&&c&&m&&x}):[],[K.data,k,C,D,E,A]),F=P.length,q=Math.ceil(F/N)||1,Y=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return P.slice(e,s)},[P,v,N]),B=!K.data||0===K.data.length,V=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(eb.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,m.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,m.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(eb.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},d=a,o=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),d=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},o=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(d={"No fields changed":"N/A"},o={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(d,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(o,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:eN,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let U=F>0?(v-1)*N+1:0,W=Math.min(v*N,F);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:B}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:D,onChange:e=>M(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{K.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(K.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{T(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:f,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>I(!Z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),Z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{R(e.value),I(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",K.isLoading?"...":U," -"," ",K.isLoading?"...":W," of"," ",K.isLoading?"...":F," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",K.isLoading?"...":v," of"," ",K.isLoading?"...":q]}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.max(1,e-1)),disabled:K.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.min(q,e+1)),disabled:K.isLoading||v===q,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:b,data:Y,renderSubComponent:V,getRowCanExpand:()=>!0})]})]})}let e_=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ek=a(9309),eS=a(30280),eC=a(44633),eL=a(86462),eD=a(49084),eM=a(71594),eE=a(24525),eT=a(19130);function eA(e){let{keys:s,totalCount:a,isLoading:l,isFetching:r,pageIndex:n,pageSize:d,onPageChange:o}=e,[c,x]=(0,i.useState)([{id:"deleted_at",desc:!0}]),[u,g]=(0,i.useState)({pageIndex:n,pageSize:d});i.useEffect(()=>{g({pageIndex:n,pageSize:d})},[n,d]);let p=[{id:"token",accessorKey:"token",header:"Key ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[200px]",children:null!=s?s:"-"})})}},{id:"team_alias",accessorKey:"team_alias",header:"Team Alias",size:120,maxSize:180,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>(0,t.jsx)("span",{className:"block max-w-[140px]",children:(0,m.pw)(e.getValue(),4)})},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null===s?"Unlimited":"$".concat((0,m.pw)(s))})}},{id:"user_email",accessorKey:"user_email",header:"User Email",size:160,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[250px]",children:null!=s?s:"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:120,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:120,maxSize:180,cell:e=>{let s=e.row.original.created_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],j=(0,eM.b7)({data:s,columns:p,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:c,pagination:u},onSortingChange:x,onPaginationChange:e=>{let s="function"==typeof e?e(u):e;g(s),o(s.pageIndex)},getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),getPaginationRowModel:(0,eE.G_)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(a/d)}),{pageIndex:f}=j.getState().pagination,v=f*d+1,y="".concat(v," - ").concat(Math.min((f+1)*d,a));return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[l||r?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",y," of ",a," results"]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[l||r?(0,t.jsx)("span",{className:"text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",f+1," of ",j.getPageCount()]}),(0,t.jsx)("button",{onClick:()=>j.previousPage(),disabled:l||r||!j.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>j.nextPage(),disabled:l||r||!j.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eT.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:j.getCenterTotalSize()},children:[(0,t.jsx)(eT.ss,{children:j.getHeaderGroups().map(e=>(0,t.jsx)(eT.SC,{children:e.headers.map(e=>(0,t.jsx)(eT.xs,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(j.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eT.RM,{children:l||r?(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):s.length>0?j.getRowModel().rows.map(e=>(0,t.jsx)(eT.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eT.pj,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted keys found"})})})})})]})})})})]})})}function eR(){let[e,s]=(0,i.useState)(0),[a]=(0,i.useState)(50),{data:l,isPending:r,isFetching:n}=(0,eS.Tv)(e+1,a);return(0,t.jsx)(eA,{keys:(null==l?void 0:l.keys)||[],totalCount:(null==l?void 0:l.total_count)||0,isLoading:r,isFetching:n,pageIndex:e,pageSize:a,onPageChange:s})}var ez=a(47359),eO=a(21626),eZ=a(97214),eI=a(28241),eK=a(58834),eH=a(69552),eP=a(71876),eF=a(46468);function eq(e){let{teams:s,isLoading:a,isFetching:l}=e,[r,n]=(0,i.useState)([{id:"deleted_at",desc:!0}]),d=[{id:"team_alias",accessorKey:"team_alias",header:"Team Name",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"team_id",accessorKey:"team_id",header:"Team ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>{let s=e.row.original.spend;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:void 0!==s?(0,m.pw)(s,4):"-"})}},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null==s?"No limit":"$".concat((0,m.pw)(s))})}},{id:"models",accessorKey:"models",header:"Models",size:200,maxSize:300,cell:e=>{let s=e.getValue();return Array.isArray(s)&&0!==s.length?(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 max-w-[300px]",children:[s.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})},s):(0,t.jsx)(x.Z,{size:"xs",color:"blue",children:(0,t.jsx)(T.Z,{children:e.length>30?"".concat((0,eF.W0)(e).slice(0,30),"..."):(0,eF.W0)(e)})},s)),s.length>3&&(0,t.jsx)(x.Z,{size:"xs",color:"gray",children:(0,t.jsxs)(T.Z,{children:["+",s.length-3," ",s.length-3==1?"more model":"more models"]})})]}):(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})})}},{id:"organization_id",accessorKey:"organization_id",header:"Organization",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],o=(0,eM.b7)({data:s,columns:d,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:r},onSortingChange:n,getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),enableSorting:!0,manualSorting:!1});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between w-full mb-4",children:a||l?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",s.length," ",1===s.length?"team":"teams"]})}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eO.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:o.getCenterTotalSize()},children:[(0,t.jsx)(eK.Z,{children:o.getHeaderGroups().map(e=>(0,t.jsx)(eP.Z,{children:e.headers.map(e=>(0,t.jsx)(eH.Z,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(o.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eZ.Z,{children:a||l?(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading teams..."})})})}):s.length>0?o.getRowModel().rows.map(e=>(0,t.jsx)(eP.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eI.Z,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted teams found"})})})})})]})})})})]})})}function eY(){let{data:e,isPending:s,isFetching:a}=(0,ez.iN)(1,100);return(0,t.jsx)(eq,{teams:e||[],isLoading:s,isFetching:a})}var eB=a(91027);function eV(e){var s,a,l;let{accessToken:m,token:x,userRole:u,userID:h,allTeams:g,premiumUser:p}=e,[j,f]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,_]=(0,i.useState)(!1),[k,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),M=(0,i.useRef)(null),E=(0,i.useRef)(null),T=(0,i.useRef)(null),[A,R]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[z,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[Z,K]=(0,i.useState)(!1),[H,P]=(0,i.useState)(!1),[F,q]=(0,i.useState)(""),[Y,B]=(0,i.useState)(""),[V,U]=(0,i.useState)(""),[W,J]=(0,i.useState)(""),[G,Q]=(0,i.useState)(""),[$,X]=(0,i.useState)(null),[ee,es]=(0,i.useState)(null),[ea,et]=(0,i.useState)(""),[el,er]=(0,i.useState)(""),[en,ei]=(0,i.useState)(u&&C.lo.includes(u)),[ed,em]=(0,i.useState)("request logs"),[eb,eN]=(0,i.useState)(null),[ek,eS]=(0,i.useState)(null),eC=(0,d.NL)(),[eL,eD]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eL))},[eL]);let[eM,eE]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ee&&m&&X({...(await (0,o.keyInfoV1Call)(m,ee)).info,token:ee,api_key:ee})})()},[ee,m]),(0,i.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&_(!1),E.current&&!E.current.contains(e.target)&&b(!1),T.current&&!T.current.contains(e.target)&&P(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{u&&C.lo.includes(u)&&ei(!0)},[u]);let eT=(0,n.a)({queryKey:["logs","table",k,L,A,z,V,W,en?h:null,ea,G],queryFn:async()=>{if(!m||!x||!u||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=Z?r()(z).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,o.uiSpendLogsCall)(m,W||void 0,V||void 0,void 0,e,s,k,L,en?h:void 0,el,ea,G);return await N(a.data,e,m,eC),a.data=a.data.map(s=>{let a=eC.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!x&&!!u&&!!h&&"request logs"===ed,refetchInterval:!!eL&&1===k&&15e3,refetchIntervalInBackground:!0}),eA=eT.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},{filters:ez,filteredLogs:eO,allTeams:eZ,allKeyAliases:eI,handleFilterChange:eK,handleFilterReset:eH}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:d=eu.d,isCustomDate:c,setCurrentPage:m,userID:x,userRole:u}=e,h=(0,i.useMemo)(()=>({[eh.TEAM_ID]:"",[eh.KEY_HASH]:"",[eh.REQUEST_ID]:"",[eh.MODEL]:"",[eh.USER_ID]:"",[eh.END_USER]:"",[eh.STATUS]:"",[eh.KEY_ALIAS]:"",[eh.ERROR_CODE]:""}),[]),[g,p]=(0,i.useState)(h),[j,f]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),y=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,o.uiSpendLogsCall)(a,e[eh.KEY_HASH]||void 0,e[eh.TEAM_ID]||void 0,e[eh.REQUEST_ID]||void 0,i,m,s,d,e[eh.USER_ID]||void 0,e[eh.END_USER]||void 0,e[eh.STATUS]||void 0,e[eh.MODEL]||void 0,e[eh.KEY_ALIAS]||void 0,e[eh.ERROR_CODE]||void 0);n===v.current&&t.data&&f(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,d]),b=(0,i.useMemo)(()=>ex()((e,s)=>y(e,s),300),[y]);(0,i.useEffect)(()=>()=>b.cancel(),[b]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,ec.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[eh.KEY_ALIAS]||g[eh.KEY_HASH]||g[eh.REQUEST_ID]||g[eh.USER_ID]||g[eh.END_USER]||g[eh.ERROR_CODE]),[g]),_=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[eh.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[eh.TEAM_ID])),g[eh.STATUS]&&(e=e.filter(e=>"success"===g[eh.STATUS]?!e.status||"success"===e.status:e.status===g[eh.STATUS])),g[eh.MODEL]&&(e=e.filter(e=>e.model===g[eh.MODEL])),g[eh.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[eh.KEY_HASH])),g[eh.END_USER]&&(e=e.filter(e=>e.end_user===g[eh.END_USER])),g[eh.ERROR_CODE]&&(e=e.filter(e=>{let s=(e.metadata||{}).error_information;return s&&s.error_code===g[eh.ERROR_CODE]})),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),k=(0,i.useMemo)(()=>w?j&&j.data&&j.data.length>0?j:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:_,[w,j,_,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,ec.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:k,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),b(a,1)),a})},handleFilterReset:()=>{p(h),f({data:[],total:0,page:1,page_size:50,total_pages:0}),b(h,1)}}}({logs:eA,accessToken:m,startTime:A,endTime:z,pageSize:L,isCustomDate:Z,setCurrentPage:S,userID:h,userRole:u}),eP=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,o.keyListCall)(m,null,null,e,null,null,k,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,k,L]);(0,i.useEffect)(()=>{m&&(ez["Team ID"]?U(ez["Team ID"]):U(""),et(ez.Status||""),Q(ez.Model||""),er(ez["End User"]||""),ez["Key Hash"]?J(ez["Key Hash"]):ez["Key Alias"]?eP(ez["Key Alias"]):J(""))},[ez,m,eP]);let eF=(0,n.a)({queryKey:["sessionLogs",ek],queryFn:async()=>{if(!m||!ek)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,o.sessionSpendLogsCall)(m,ek);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!ek});if((0,i.useEffect)(()=>{var e;(null===(e=eT.data)||void 0===e?void 0:e.data)&&eb&&!eT.data.data.some(e=>e.request_id===eb)&&eN(null)},[null===(s=eT.data)||void 0===s?void 0:s.data,eb]),!m||!x||!u||!h)return null;let eq=eO.data.filter(e=>!j||e.request_id.includes(j)||e.model.includes(j)||e.user&&e.user.includes(j)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>es(e),onSessionClick:e=>{e&&eS(e)}}))||[],eV=(null===(l=eF.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>es(e),onSessionClick:e=>{}})))||[],eW=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=new Set;return e.forEach(e=>{let t=e.metadata||{};if("failure"===t.status&&t.error_information){let e=t.error_information.error_code;e&&(!s||e.toLowerCase().includes(s.toLowerCase()))&&a.add(e)}}),Array.from(a).map(e=>({label:e,value:e}))},eJ=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,ec.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,o.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Error Code",label:"Error Code",isSearchable:!0,searchFn:async e=>eW(eA.data,e)},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(ek&&eF.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(I,{sessionId:ek,logs:eF.data.data,onBack:()=>eS(null)})});let eG=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eQ=eG.find(e=>e.value===eM.value&&e.unit===eM.unit),e$=Z?e_(Z,A,z):null==eQ?void 0:eQ.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(ej.Z,{defaultIndex:0,onIndexChange:e=>em(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(ef.Z,{children:[(0,t.jsx)(ep.Z,{children:"Request Logs"}),(0,t.jsx)(ep.Z,{children:"Audit Logs"}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Keys ",(0,t.jsx)(eB.Z,{})]})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Teams ",(0,t.jsx)(eB.Z,{})]})})]}),(0,t.jsxs)(ey.Z,{children:[(0,t.jsxs)(ev.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:ek?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:ek}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eS(null),children:"← Back to All Logs"})]}):"Request Logs"})}),$&&ee&&$.api_key===ee?(0,t.jsx)(D.Z,{keyId:ee,keyData:$,teams:g,onClose:()=>es(null),backButtonText:"Back to Logs"}):ek?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eV,renderSubComponent:eU,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo.Z,{options:eJ,onApplyFilters:eK,onResetFilters:eH}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:j,onChange:e=>f(e.target.value)}),(0,t.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:T,children:[(0,t.jsxs)("button",{onClick:()=>P(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e$]}),H&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eG.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(e$===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),R(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eE({value:e.value,unit:e.unit}),K(!1),P(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(Z?"bg-blue-50 text-blue-600":""),onClick:()=>K(!Z),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(eg.Z,{color:"green",checked:eL,defaultChecked:!0,onChange:eD})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eT.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eT.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),Z&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{R(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:z,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eT.isLoading?"...":eO?(k-1)*L+1:0," -"," ",eT.isLoading?"...":eO?Math.min(k*L,eO.total):0," ","of ",eT.isLoading?"...":eO?eO.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eT.isLoading?"...":k," of"," ",eT.isLoading?"...":eO?eO.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eT.isLoading||1===k,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eO.total_pages||1,e+1)),disabled:eT.isLoading||k===(eO.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eL&&1===k&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eD(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eq,renderSubComponent:eU,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(ew,{userID:h,userRole:u,token:x,accessToken:m,isActive:"audit logs"===ed,premiumUser:p,allTeams:g})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eR,{})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eY,{})})]})]})})}function eU(e){var s,a,l,r,n,i,d,o,c,x,u,g;let{row:p}=e,j=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},f=p.original.metadata||{},v="failure"===f.status,y=v?f.error_information:null,b=p.original.messages&&(Array.isArray(p.original.messages)?p.original.messages.length>0:Object.keys(p.original.messages).length>0),N=p.original.response&&Object.keys(j(p.original.response)).length>0,w=f.vector_store_request_metadata&&Array.isArray(f.vector_store_request_metadata)&&f.vector_store_request_metadata.length>0,_=null===(s=p.original.metadata)||void 0===s?void 0:s.guardrail_information,C=Array.isArray(_)?_:_?[_]:[],D=C.length>0,M=C.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),E=1===C.length?null!==(g=null===(a=C[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==g?g:"-":C.length>1?"".concat(C.length," guardrails"):"-",T=(0,ek.aS)(p.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),p.original.request_id.length>64?(0,t.jsx)(h.Z,{title:p.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:p.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:p.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:p.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:p.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:p.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(h.Z,{title:p.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:p.original.api_base||"-"})})]}),(null==p?void 0:null===(l=p.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==p?void 0:null===(r=p.original)||void 0===r?void 0:r.requester_ip_address})]}),D&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:E}),M>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[M," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[p.original.total_tokens," (",p.original.prompt_tokens," prompt tokens +"," ",p.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)((null===(i=p.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)(null===(d=p.original.metadata)||void 0===d?void 0:d.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,m.pw)(p.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:p.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(o=p.original.metadata)||void 0===o?void 0:o.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=p.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:p.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:p.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[p.original.duration," s."]})]}),(null===(x=p.original.metadata)||void 0===x?void 0:x.litellm_overhead_time_ms)!==void 0&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"LiteLLM Overhead:"}),(0,t.jsxs)("span",{children:[p.original.metadata.litellm_overhead_time_ms," ms"]})]})]})]})]}),(0,t.jsx)(ed,{costBreakdown:null===(u=p.original.metadata)||void 0===u?void 0:u.cost_breakdown,totalSpend:p.original.spend||0}),(0,t.jsx)(L,{show:!b&&!N}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(k,{row:p,hasMessages:b,hasResponse:N,hasError:v,errorInfo:y,getRawRequest:()=>{var e;return(null===(e=p.original)||void 0===e?void 0:e.proxy_server_request)?j(p.original.proxy_server_request):j(p.original.messages)},formattedResponse:()=>v&&y?{error:{message:y.error_message||"An error occurred",type:y.error_class||"error",code:y.error_code||"unknown",param:null}}:j(p.original.response)})}),D&&(0,t.jsx)(ea,{data:_}),w&&(0,t.jsx)(K,{data:f.vector_store_request_metadata}),v&&y&&(0,t.jsx)(S,{errorInfo:y}),p.original.request_tags&&Object.keys(p.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(p.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),p.original.metadata&&Object.keys(p.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(p.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,t.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(p.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/292-dacc8415fb39446d.js b/litellm/proxy/_experimental/out/_next/static/chunks/292-24912f2c2c43f6b1.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/292-dacc8415fb39446d.js rename to litellm/proxy/_experimental/out/_next/static/chunks/292-24912f2c2c43f6b1.js index dc6935ad8a..b0d941bbad 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/292-dacc8415fb39446d.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/292-24912f2c2c43f6b1.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[292],{57589:function(e,s,t){t.d(s,{Z:function(){return j}});var a=t(57437),r=t(39760),l=t(44633),n=t(86462),i=t(40278),c=t(78489),o=t(99981),d=t(10968),u=t(2265),m=t(59872);let x=e=>{let{key:s,info:t}=e;return{token:s,...t}};var h=t(19250),p=t(50665),g=t(12322),j=e=>{let{topKeys:s,teams:t,showTags:j=!1,topKeysLimit:f,setTopKeysLimit:_}=e,{accessToken:y,userRole:v,userId:k,premiumUser:b}=(0,r.Z)(),[Z,N]=(0,u.useState)(!1),[w,q]=(0,u.useState)(null),[S,C]=(0,u.useState)(void 0),[T,D]=(0,u.useState)("table"),[L,E]=(0,u.useState)(new Set),A=e=>{E(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},F=async e=>{if(y)try{let s=await (0,h.keyInfoV1Call)(y,e.api_key),t=x(s);C(t),q(e.api_key),N(!0)}catch(e){console.error("Error fetching key info:",e)}},O=()=>{N(!1),q(null),C(void 0)};u.useEffect(()=>{let e=e=>{"Escape"===e.key&&Z&&O()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Z]);let M=[{header:"Key ID",accessorKey:"api_key",cell:e=>(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(o.Z,{title:e.getValue(),children:(0,a.jsx)(c.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>F(e.row.original),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{header:"Key Alias",accessorKey:"key_alias",cell:e=>e.getValue()||"-"}],U={header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return s>0&&s<.01?"<$0.01":"$".concat((0,m.pw)(s,2))}},V=j?[...M,{header:"Tags",accessorKey:"tags",cell:e=>{let s=e.getValue(),t=e.row.original.api_key,r=L.has(t);if(!s||0===s.length)return"-";let i=s.sort((e,s)=>s.usage-e.usage),c=r?i:i.slice(0,2),d=s.length>2;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[c.map((e,s)=>(0,a.jsx)(o.Z,{title:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Tag Name:"})," ",e.tag]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend:"})," ",e.usage>0&&e.usage<.01?"<$0.01":"$".concat((0,m.pw)(e.usage,2))]})]}),children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[e.tag.slice(0,7),"..."]})},s)),d&&(0,a.jsx)("button",{onClick:()=>A(t),className:"ml-1 p-1 hover:bg-gray-200 rounded-full transition-colors",title:r?"Show fewer tags":"Show all tags",children:r?(0,a.jsx)(l.Z,{className:"h-3 w-3 text-gray-500"}):(0,a.jsx)(n.Z,{className:"h-3 w-3 text-gray-500"})})]})})}},U]:[...M,U],R=s.map(e=>({...e,display_key_alias:e.key_alias&&e.key_alias.length>10?"".concat(e.key_alias.slice(0,10),"..."):e.key_alias||"-"}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(d.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:f,onChange:e=>_(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>D("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>D("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===T?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(i.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(R.length,f)},data:R,index:"display_key_alias",categories:["spend"],colors:["cyan"],yAxisWidth:120,tickGap:5,layout:"vertical",showLegend:!1,valueFormatter:e=>"$".concat((0,m.pw)(e,2)),onValueChange:e=>F(e),showTooltip:!0,customTooltip:e=>{var s,t;let r=null===(t=e.payload)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.payload;return(0,a.jsx)("div",{className:"relative z-50 p-3 bg-black/90 shadow-lg rounded-lg text-white max-w-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key Alias: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.key_alias})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key ID: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.api_key})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend: "}),(0,a.jsxs)("span",{className:"text-white font-medium",children:["$",(0,m.pw)(null==r?void 0:r.spend,2)]})]})]})})}})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(g.w,{columns:V,data:s,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})}),Z&&w&&S&&(console.log("Rendering modal with:",{isModalOpen:Z,selectedKey:w,keyData:S}),(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&O()},children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl relative w-11/12 max-w-6xl max-h-[90vh] overflow-y-auto min-h-[750px]",children:[(0,a.jsx)("button",{onClick:O,className:"absolute top-4 right-4 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":"Close",children:(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("div",{className:"p-6 h-full",children:(0,a.jsx)(p.Z,{keyId:w,onClose:O,keyData:S,teams:t})})]})}))]})}},90292:function(e,s,t){t.d(s,{Z:function(){return e9}});var a=t(57437),r=t(40278),l=t(12514),n=t(49804),i=t(14042),c=t(67101),o=t(12485),d=t(18135),u=t(35242),m=t(29706),x=t(77991),h=t(21626),p=t(97214),g=t(28241),j=t(58834),f=t(69552),_=t(71876),y=t(84264),v=t(96761),k=t(10968),b=t(51653),Z=t(2265),N=t(19250),w=t(11713),q=t(90246),S=t(20347),C=t(39760);let T=(0,q.n)("agents"),D=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:T.list({}),queryFn:async()=>await (0,N.getAgentsList)(e),enabled:!!e&&S.ZL.includes(s||"")})},L=(0,q.n)("customers"),E=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:L.list({}),queryFn:async()=>await (0,N.allEndUsersCall)(e),enabled:!!e&&S.ZL.includes(s)})};var A=t(76134),F=t(59872),O=t(16312),M=t(29299),U=t(75105),V=t(44851);let R={blue:"#3b82f6",cyan:"#06b6d4",indigo:"#6366f1",green:"#22c55e",red:"#ef4444",purple:"#8b5cf6",emerald:"#37bc7d"},z=e=>{let{active:s,payload:t,label:r}=e;if(s&&t&&t.length){let e=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),s=(e,s)=>{let t=s.substring(s.indexOf(".")+1);if(e.metrics&&t in e.metrics)return e.metrics[t]};return(0,a.jsxs)("div",{className:"w-56 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[(0,a.jsx)("p",{className:"text-tremor-content-strong",children:r}),t.map(t=>{var r;let l=null===(r=t.dataKey)||void 0===r?void 0:r.toString();if(!l||!t.payload)return null;let n=s(t.payload,l),i=l.includes("spend"),c=void 0!==n?i?"$".concat(n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})):n.toLocaleString():"N/A",o=R[t.color]||t.color;return(0,a.jsxs)("div",{className:"flex items-center justify-between space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-2 ring-white drop-shadow-md",style:{backgroundColor:o}}),(0,a.jsx)("p",{className:"font-medium text-tremor-content dark:text-dark-tremor-content",children:e(l)})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",children:c})]},l)})]})}return null},I=e=>{let{categories:s,colors:t}=e,r=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return(0,a.jsx)("div",{className:"flex items-center justify-end space-x-4",children:s.map((e,s)=>{let l=R[t[s]]||t[s];return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-4 ring-white",style:{backgroundColor:l}}),(0,a.jsx)("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:r(e)})]},e)})})};function Y(e){return e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?e/1e3+"k":e.toString()}function K(e){return 0===e?"$0":e>=1e6?"$"+e/1e6+"M":e>=1e3?"$"+e/1e3+"k":"$"+e}let $=e=>{var s,t;let{modelName:n,metrics:i,hidePromptCachingMetrics:o=!1}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:i.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:i.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:i.total_tokens.toLocaleString()}),(0,a.jsxs)(y.Z,{children:[Math.round(i.total_tokens/i.total_successful_requests)," avg per successful request"]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(i.total_spend,2)]}),(0,a.jsxs)(y.Z,{children:["$",(0,F.pw)(i.total_spend/i.total_successful_requests,3)," per successful request"]})]})]}),i.top_api_keys&&i.top_api_keys.length>0&&(0,a.jsxs)(l.Z,{className:"mt-4",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys by Spend"}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("div",{className:"grid grid-cols-1 gap-2",children:i.top_api_keys.map((e,s)=>(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium",children:e.key_alias||"".concat(e.api_key.substring(0,10),"...")}),e.team_id&&(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:["Team: ",e.team_id]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsxs)(y.Z,{className:"font-medium",children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:[e.requests.toLocaleString()," requests | ",e.tokens.toLocaleString()," tokens"]})]})]},e.api_key))})})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Requests per day"}),(0,a.jsx)(I,{categories:["metrics.api_requests"],colors:["blue"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.api_requests"],colors:["blue"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Spend per day"}),(0,a.jsx)(I,{categories:["metrics.spend"],colors:["green"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.spend"],colors:["green"],valueFormatter:e=>"$".concat((0,F.pw)(e,2,!0)),yAxisWidth:72})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:Y,stack:!0,customTooltip:z,showLegend:!1})]}),!o&&(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Prompt Caching Metrics"}),(0,a.jsx)(I,{categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"]})]}),(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)(y.Z,{children:["Cache Read: ",(null===(s=i.total_cache_read_input_tokens)||void 0===s?void 0:s.toLocaleString())||0," tokens"]}),(0,a.jsxs)(y.Z,{children:["Cache Creation: ",(null===(t=i.total_cache_creation_input_tokens)||void 0===t?void 0:t.toLocaleString())||0," tokens"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"],valueFormatter:Y,customTooltip:z,showLegend:!1})]})]})]})},P=e=>{let{modelMetrics:s,hidePromptCachingMetrics:t=!1}=e,r=Object.keys(s).sort((e,t)=>""===e?1:""===t?-1:s[t].total_spend-s[e].total_spend),n={total_requests:0,total_successful_requests:0,total_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,daily_data:{}};Object.values(s).forEach(e=>{n.total_requests+=e.total_requests,n.total_successful_requests+=e.total_successful_requests,n.total_tokens+=e.total_tokens,n.total_spend+=e.total_spend,n.total_cache_read_input_tokens+=e.total_cache_read_input_tokens||0,n.total_cache_creation_input_tokens+=e.total_cache_creation_input_tokens||0,e.daily_data.forEach(e=>{n.daily_data[e.date]||(n.daily_data[e.date]={prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,spend:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0}),n.daily_data[e.date].prompt_tokens+=e.metrics.prompt_tokens,n.daily_data[e.date].completion_tokens+=e.metrics.completion_tokens,n.daily_data[e.date].total_tokens+=e.metrics.total_tokens,n.daily_data[e.date].api_requests+=e.metrics.api_requests,n.daily_data[e.date].spend+=e.metrics.spend,n.daily_data[e.date].successful_requests+=e.metrics.successful_requests,n.daily_data[e.date].failed_requests+=e.metrics.failed_requests,n.daily_data[e.date].cache_read_input_tokens+=e.metrics.cache_read_input_tokens||0,n.daily_data[e.date].cache_creation_input_tokens+=e.metrics.cache_creation_input_tokens||0})});let i=Object.entries(n.daily_data).map(e=>{let[s,t]=e;return{date:s,metrics:t}}).sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime());return(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,a.jsx)(v.Z,{children:"Overall Usage"}),(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4 mb-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:n.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:n.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:n.total_tokens.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(n.total_spend,2)]})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens Over Time"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Requests Over Time"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:z,showLegend:!1})]})]})]}),(0,a.jsx)(V.default,{defaultActiveKey:r[0],children:r.map(e=>(0,a.jsx)(V.default.Panel,{header:(0,a.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,a.jsx)(v.Z,{children:s[e].label||"Unknown Item"}),(0,a.jsxs)("div",{className:"flex space-x-4 text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["$",(0,F.pw)(s[e].total_spend,2)]}),(0,a.jsxs)("span",{children:[s[e].total_requests.toLocaleString()," requests"]})]})]}),children:(0,a.jsx)($,{modelName:e||"Unknown Model",metrics:s[e],hidePromptCachingMetrics:t})},e))})]})},W=(e,s,t)=>{let a=e.metadata.key_alias||"key-hash-".concat(s),r=e.metadata.team_id;if(r){let e=(0,M.o)(r,t);return e?"".concat(a," (team: ").concat(e,")"):"".concat(a," (team_id: ").concat(r,")")}return a},B=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a={};return e.results.forEach(e=>{Object.entries(e.breakdown[s]||{}).forEach(r=>{let[l,n]=r;a[l]||(a[l]={label:"api_keys"===s?W(n,l,t):l,total_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0,prompt_tokens:0,completion_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,top_api_keys:[],daily_data:[]}),a[l].total_requests+=n.metrics.api_requests,a[l].prompt_tokens+=n.metrics.prompt_tokens,a[l].completion_tokens+=n.metrics.completion_tokens,a[l].total_tokens+=n.metrics.total_tokens,a[l].total_spend+=n.metrics.spend,a[l].total_successful_requests+=n.metrics.successful_requests,a[l].total_failed_requests+=n.metrics.failed_requests,a[l].total_cache_read_input_tokens+=n.metrics.cache_read_input_tokens||0,a[l].total_cache_creation_input_tokens+=n.metrics.cache_creation_input_tokens||0,a[l].daily_data.push({date:e.date,metrics:{prompt_tokens:n.metrics.prompt_tokens,completion_tokens:n.metrics.completion_tokens,total_tokens:n.metrics.total_tokens,api_requests:n.metrics.api_requests,spend:n.metrics.spend,successful_requests:n.metrics.successful_requests,failed_requests:n.metrics.failed_requests,cache_read_input_tokens:n.metrics.cache_read_input_tokens||0,cache_creation_input_tokens:n.metrics.cache_creation_input_tokens||0}})})}),"api_keys"!==s&&Object.entries(a).forEach(t=>{let[r,l]=t,n={};e.results.forEach(e=>{var t;let a=null===(t=e.breakdown[s])||void 0===t?void 0:t[r];a&&"api_key_breakdown"in a&&Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[s,t]=e;n[s]||(n[s]={api_key:s,key_alias:t.metadata.key_alias,team_id:t.metadata.team_id,spend:0,requests:0,tokens:0}),n[s].spend+=t.metrics.spend,n[s].requests+=t.metrics.api_requests,n[s].tokens+=t.metrics.total_tokens})}),a[r].top_api_keys=Object.values(n).sort((e,s)=>s.spend-e.spend).slice(0,5)}),Object.values(a).forEach(e=>{e.daily_data.sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime())}),a};var H=t(78489),G=t(94789),J=t(49566),Q=t(10032),X=t(22116),ee=t(37592),es=t(10353),et=t(9114),ea=e=>{let{isOpen:s,onClose:t,accessToken:r}=e,[l]=Q.Z.useForm(),[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(null),[d,u]=(0,Z.useState)(!1),[m,x]=(0,Z.useState)("cloudzero"),[h,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{s&&r&&g()},[s,r]);let g=async()=>{u(!0);try{let e=await fetch("/cloudzero/settings",{method:"GET",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"}});if(e.ok){let s=await e.json();o(s),l.setFieldsValue({connection_id:s.connection_id})}else if(404!==e.status){let s=await e.json();et.Z.fromBackend("Failed to load existing settings: ".concat(s.error||"Unknown error"))}}catch(e){console.error("Error loading CloudZero settings:",e),et.Z.fromBackend("Failed to load existing settings")}finally{u(!1)}},j=async e=>{if(!r){et.Z.fromBackend("No access token available");return}i(!0);try{let s={...e,timezone:"UTC"},t=await fetch(c?"/cloudzero/settings":"/cloudzero/init",{method:c?"PUT":"POST",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(t.ok)return et.Z.success(a.message||"CloudZero settings saved successfully"),o({api_key_masked:e.api_key.substring(0,4)+"****"+e.api_key.slice(-4),connection_id:e.connection_id,status:"configured"}),!0;return et.Z.fromBackend(a.error||"Failed to save CloudZero settings"),!1}catch(e){return console.error("Error saving CloudZero settings:",e),et.Z.fromBackend("Failed to save CloudZero settings"),!1}finally{i(!1)}},f=async()=>{if(!r){et.Z.fromBackend("No access token available");return}p(!0);try{let e=await fetch("/cloudzero/export",{method:"POST",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify({limit:1e5,operation:"replace_hourly"})}),s=await e.json();e.ok?(et.Z.success(s.message||"Export to CloudZero completed successfully"),t()):et.Z.fromBackend(s.error||"Failed to export to CloudZero")}catch(e){console.error("Error exporting to CloudZero:",e),et.Z.fromBackend("Failed to export to CloudZero")}finally{p(!1)}},_=async()=>{p(!0);try{et.Z.info("CSV export functionality coming soon!"),t()}catch(e){console.error("Error exporting CSV:",e),et.Z.fromBackend("Failed to export CSV")}finally{p(!1)}},v=async()=>{if("cloudzero"===m){if(!c){let e=await l.validateFields();if(!await j(e))return}await f()}else await _()},k=()=>{l.resetFields(),x("cloudzero"),o(null),t()},b=[{value:"cloudzero",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:"/cloudzero.png",alt:"CloudZero",className:"w-5 h-5",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{children:"Export to CloudZero"})]})},{value:"csv",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,a.jsx)("span",{children:"Export to CSV"})]})}];return(0,a.jsx)(X.Z,{title:"Export Data",open:s,onCancel:k,footer:null,width:600,destroyOnClose:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium mb-2 block",children:"Export Destination"}),(0,a.jsx)(ee.default,{value:m,onChange:x,options:b,className:"w-full",size:"large"})]}),"cloudzero"===m&&(0,a.jsx)("div",{children:d?(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)(es.Z,{size:"large"})}):(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsx)(G.Z,{title:"Existing CloudZero Configuration",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),color:"green",className:"mb-4",children:(0,a.jsxs)(y.Z,{children:["API Key: ",c.api_key_masked,(0,a.jsx)("br",{}),"Connection ID: ",c.connection_id]})}),!c&&(0,a.jsxs)(Q.Z,{form:l,layout:"vertical",children:[(0,a.jsx)(Q.Z.Item,{label:"CloudZero API Key",name:"api_key",rules:[{required:!0,message:"Please enter your CloudZero API key"}],children:(0,a.jsx)(J.Z,{type:"password",placeholder:"Enter your CloudZero API key"})}),(0,a.jsx)(Q.Z.Item,{label:"Connection ID",name:"connection_id",rules:[{required:!0,message:"Please enter the CloudZero connection ID"}],children:(0,a.jsx)(J.Z,{placeholder:"Enter CloudZero connection ID"})})]})]})}),"csv"===m&&(0,a.jsx)(G.Z,{title:"CSV Export",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),color:"blue",children:(0,a.jsx)(y.Z,{children:"Export your usage data as a CSV file for analysis in spreadsheet applications."})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2 pt-4",children:[(0,a.jsx)(H.Z,{variant:"secondary",onClick:k,children:"Cancel"}),(0,a.jsx)(H.Z,{onClick:v,loading:n||h,disabled:n||h,children:"cloudzero"===m?"Export to CloudZero":"Export CSV"})]})]})})},er=t(47359),el=t(50337),en=t(5545),ei=e=>{let{value:s,onChange:t}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Format"}),(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-full",options:[{value:"csv",label:"CSV (Excel, Google Sheets)"},{value:"json",label:"JSON (includes metadata)"}]})]})},ec=e=>{var s,t;let{dateRange:r,selectedFilters:l}=e;return(0,a.jsxs)("div",{className:"text-sm text-gray-500",children:[null===(s=r.from)||void 0===s?void 0:s.toLocaleDateString()," - ",null===(t=r.to)||void 0===t?void 0:t.toLocaleDateString(),l.length>0&&" \xb7 ".concat(l.length," filter").concat(l.length>1?"s":"")]})},eo=t(29967),ed=e=>{let{value:s,onChange:t,entityType:r}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Export type"}),(0,a.jsx)(eo.ZP.Group,{value:s,onChange:e=>t(e.target.value),className:"w-full",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Day-by-day breakdown"}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:["Daily metrics for each ",r]})]})]}),(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily_with_models",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsxs)("div",{className:"font-medium text-sm",children:["Day-by-day by ",r," and model"]}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Daily metrics split by model"})]})]})]})})]})},eu=t(15452),em=t.n(eu);let ex=e=>{if(!e)return null;for(let t of Object.values(e)){var s;let e=null==t?void 0:null===(s=t.metadata)||void 0===s?void 0:s.team_id;if(e)return e}return null},eh=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{Object.entries(e.breakdown.entities||{}).forEach(r=>{let[l,n]=r,i=ex(n.api_key_breakdown),c=i&&t[i]||null;a.push({Date:e.date,[s]:c||"-",["".concat(s," ID")]:i||"-","Spend ($)":(0,F.pw)(n.metrics.spend,4),Requests:n.metrics.api_requests,"Successful Requests":n.metrics.successful_requests,"Failed Requests":n.metrics.failed_requests,"Total Tokens":n.metrics.total_tokens,"Prompt Tokens":n.metrics.prompt_tokens||0,"Completion Tokens":n.metrics.completion_tokens||0})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},ep=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{let r={};Object.entries(e.breakdown.entities||{}).forEach(s=>{let[t,a]=s;r[t]||(r[t]={}),Object.entries(e.breakdown.models||{}).forEach(e=>{let[s,l]=e;Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[a,l]=e;r[t][s]||(r[t][s]={spend:0,requests:0,successful:0,failed:0,tokens:0}),r[t][s].spend+=l.metrics.spend||0,r[t][s].requests+=l.metrics.api_requests||0,r[t][s].successful+=l.metrics.successful_requests||0,r[t][s].failed+=l.metrics.failed_requests||0,r[t][s].tokens+=l.metrics.total_tokens||0})})}),Object.entries(r).forEach(r=>{var l;let[n,i]=r,c=null===(l=e.breakdown.entities)||void 0===l?void 0:l[n],o=ex(null==c?void 0:c.api_key_breakdown),d=o&&t[o]||null;Object.entries(i).forEach(t=>{let[r,l]=t;a.push({Date:e.date,[s]:d||"-",["".concat(s," ID")]:o||"-",Model:r,"Spend ($)":(0,F.pw)(l.spend,4),Requests:l.requests,Successful:l.successful,Failed:l.failed,"Total Tokens":l.tokens})})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},eg=function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(s){case"daily":default:return eh(e,t,a);case"daily_with_models":return ep(e,t,a)}},ej=(e,s,t,a,r)=>{var l,n;return{export_date:new Date().toISOString(),entity_type:e,date_range:{from:null===(l=s.from)||void 0===l?void 0:l.toISOString(),to:null===(n=s.to)||void 0===n?void 0:n.toISOString()},filters_applied:t.length>0?t:"None",export_scope:a,summary:{total_spend:r.metadata.total_spend,total_requests:r.metadata.total_api_requests,successful_requests:r.metadata.total_successful_requests,failed_requests:r.metadata.total_failed_requests,total_tokens:r.metadata.total_tokens}}},ef=function(e,s,t,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},l=eg(e,s,t,r),n=new Blob([em().unparse(l)],{type:"text/csv;charset=utf-8;"}),i=window.URL.createObjectURL(n),c=document.createElement("a");c.href=i;let o="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".csv");c.download=o,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)},e_=function(e,s,t,a,r,l){let n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},i=eg(e,s,t,n),c=new Blob([JSON.stringify({metadata:ej(a,r,l,s,e),data:i},null,2)],{type:"application/json"}),o=window.URL.createObjectURL(c),d=document.createElement("a");d.href=o;let u="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".json");d.download=u,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(o)};var ey=e=>{let{isOpen:s,onClose:t,entityType:r,spendData:l,dateRange:n,selectedFilters:i,customTitle:c}=e,[o,d]=(0,Z.useState)("csv"),[u,m]=(0,Z.useState)("daily"),[x,h]=(0,Z.useState)(!1),{data:p,isLoading:g}=(0,er.y2)(),j=r.charAt(0).toUpperCase()+r.slice(1),f=c||"Export ".concat(j," Usage"),_=(0,Z.useMemo)(()=>(0,M.O)(p),[p]),y=async e=>{let s=e||o;h(!0);try{"csv"===s?(ef(l,u,j,r,_),et.Z.success("".concat(j," usage data exported successfully as CSV"))):(e_(l,u,j,r,n,i,_),et.Z.success("".concat(j," usage data exported successfully as JSON"))),t()}catch(e){console.error("Error exporting data:",e),et.Z.fromBackend("Failed to export data")}finally{h(!1)}};return(0,a.jsx)(X.Z,{title:(0,a.jsx)("span",{className:"text-base font-semibold",children:f}),open:s,onCancel:t,footer:null,width:480,children:(0,a.jsxs)("div",{className:"space-y-5 py-2",children:[g?(0,a.jsx)(el.Z,{active:!0}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{dateRange:n,selectedFilters:i}),(0,a.jsx)(ed,{value:u,onChange:m,entityType:r}),(0,a.jsx)(ei,{value:o,onChange:d})]}),g?(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(el.Z.Button,{active:!0}),(0,a.jsx)(el.Z.Button,{active:!0})]}):(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(en.ZP,{variant:"outlined",onClick:t,disabled:x,children:"Cancel"}),(0,a.jsx)(en.ZP,{onClick:()=>y(),loading:x||g,disabled:x||g,type:"primary",children:x?"Exporting...":"Export ".concat(o.toUpperCase())})]})]})})},ev=t(19431),ek=e=>{let{dateValue:s,entityType:t,spendData:r,showFilters:l=!1,filterLabel:n,filterPlaceholder:i,selectedFilters:c=[],onFiltersChange:o,filterOptions:d=[],customTitle:u,compactLayout:m=!1,teams:x=[]}=e,[h,p]=(0,Z.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("div",{className:"grid ".concat(l&&d.length>0?"grid-cols-[1fr_auto]":"grid-cols-[auto]"," items-end gap-4"),children:[l&&d.length>0&&(0,a.jsxs)("div",{children:[n&&(0,a.jsx)(ev.x,{className:"mb-2",children:n}),(0,a.jsx)(ee.default,{mode:"multiple",style:{width:"100%"},placeholder:i,value:c,onChange:o,options:d,allowClear:!0})]}),(0,a.jsx)("div",{className:"justify-self-end",children:(0,a.jsx)(ev.z,{onClick:()=>p(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})})]})}),(0,a.jsx)(ey,{isOpen:h,onClose:()=>p(!1),entityType:t,spendData:r,dateRange:s,selectedFilters:c,customTitle:u,teams:x})]})},eb=t(42673),eZ=t(5540),eN=t(49634),ew=t(77398),eq=t.n(ew);let eS=[{label:"Today",shortLabel:"today",getValue:()=>({from:eq()().startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 7 days",shortLabel:"7d",getValue:()=>({from:eq()().subtract(7,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 30 days",shortLabel:"30d",getValue:()=>({from:eq()().subtract(30,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Month to date",shortLabel:"MTD",getValue:()=>({from:eq()().startOf("month").toDate(),to:eq()().endOf("day").toDate()})},{label:"Year to date",shortLabel:"YTD",getValue:()=>({from:eq()().startOf("year").toDate(),to:eq()().endOf("day").toDate()})}];var eC=e=>{let{value:s,onValueChange:t,label:r="Select Time Range",showTimeRange:l=!0}=e,[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(s),[d,u]=(0,Z.useState)(null),[m,x]=(0,Z.useState)(""),[h,p]=(0,Z.useState)(""),g=(0,Z.useRef)(null),j=(0,Z.useCallback)(e=>{if(!e.from||!e.to)return null;for(let s of eS){let t=s.getValue(),a=eq()(e.from).isSame(eq()(t.from),"day"),r=eq()(e.to).isSame(eq()(t.to),"day");if(a&&r)return s.shortLabel}return null},[]);(0,Z.useEffect)(()=>{u(j(s))},[s,j]);let f=(0,Z.useCallback)(()=>{if(!m||!h)return{isValid:!0,error:""};let e=eq()(m,"YYYY-MM-DD"),s=eq()(h,"YYYY-MM-DD");return e.isValid()&&s.isValid()?s.isBefore(e)?{isValid:!1,error:"End date cannot be before start date"}:{isValid:!0,error:""}:{isValid:!1,error:"Invalid date format"}},[m,h])();(0,Z.useEffect)(()=>{s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),o(s)},[s]),(0,Z.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]);let _=(0,Z.useCallback)((e,s)=>{if(!e||!s)return"Select date range";let t=e=>eq()(e).format("D MMM, HH:mm");return"".concat(t(e)," - ").concat(t(s))},[]),y=(0,Z.useCallback)(e=>{let s;if(!e.from)return e;let t={...e},a=new Date(e.from);return s=new Date(e.to?e.to:e.from),a.toDateString(),s.toDateString(),a.setHours(0,0,0,0),s.setHours(23,59,59,999),t.from=a,t.to=s,t},[]),v=e=>{let{from:s,to:t}=e.getValue();o({from:s,to:t}),u(e.shortLabel),x(eq()(s).format("YYYY-MM-DD")),p(eq()(t).format("YYYY-MM-DD"))},k=(0,Z.useCallback)(()=>{try{if(m&&h&&f.isValid){let e=eq()(m,"YYYY-MM-DD").startOf("day"),s=eq()(h,"YYYY-MM-DD").endOf("day");if(e.isValid()&&s.isValid()){let t={from:e.toDate(),to:s.toDate()};o(t);let a=j(t);u(a)}}}catch(e){console.warn("Invalid date format:",e)}},[m,h,f.isValid,j]);return(0,Z.useEffect)(()=>{k()},[k]),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,a.jsx)(ev.x,{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:r}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[(0,a.jsx)("div",{className:"w-[300px] px-3 py-2 text-sm border border-gray-300 rounded-md bg-white cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",onClick:()=>i(!n),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eZ.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-900",children:_(s.from,s.to)})]}),(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform ".concat(n?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&(0,a.jsx)("div",{className:"absolute top-full right-0 z-[9999] min-w-[600px] mt-1 bg-white border border-gray-200 rounded-lg shadow-xl",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsxs)("div",{className:"w-1/2 border-r border-gray-200",children:[(0,a.jsx)("div",{className:"p-3 border-b border-gray-200",children:(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Relative time"})}),(0,a.jsx)("div",{className:"h-[350px] overflow-y-auto",children:eS.map(e=>{let s=d===e.shortLabel;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 cursor-pointer border-b border-gray-100 transition-colors ".concat(s?"bg-blue-50 hover:bg-blue-100 border-blue-200":"hover:bg-gray-50"),onClick:()=>v(e),children:[(0,a.jsx)("span",{className:"text-sm ".concat(s?"text-blue-700 font-medium":"text-gray-700"),children:e.label}),(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded capitalize ".concat(s?"text-blue-700 bg-blue-100":"text-gray-500 bg-gray-100"),children:e.shortLabel})]},e.label)})})]}),(0,a.jsxs)("div",{className:"w-1/2 relative",children:[(0,a.jsx)("div",{className:"p-3.5 border-b border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eN.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Start and end dates"})]})}),(0,a.jsxs)("div",{className:"p-6 space-y-6 pb-20",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"Start date"}),(0,a.jsx)("input",{type:"date",value:m,onChange:e=>x(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"End date"}),(0,a.jsx)("input",{type:"date",value:h,onChange:e=>p(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),!f.isValid&&f.error&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,a.jsx)("span",{className:"text-sm text-red-700 font-medium",children:f.error})]})}),c.from&&c.to&&f.isValid&&(0,a.jsxs)("div",{className:"bg-blue-50 p-3 rounded-md space-y-1",children:[(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"From:"})," ",eq()(c.from).format("MMM D, YYYY [at] HH:mm:ss")]}),(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"To:"})," ",eq()(c.to).format("MMM D, YYYY [at] HH:mm:ss")]})]})]}),(0,a.jsx)("div",{className:"absolute bottom-4 right-4",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(ev.z,{variant:"secondary",onClick:()=>{o(s),s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),u(j(s)),i(!1)},children:"Cancel"}),(0,a.jsx)(ev.z,{onClick:()=>{c.from&&c.to&&f.isValid&&(t(c),requestIdleCallback(()=>{t(y(c))},{timeout:100}),i(!1))},disabled:!c.from||!c.to||!f.isValid,children:"Apply"})]})})]})]})})]})]})},eT=t(91323);let eD=e=>{let{isDateChanging:s=!1}=e;return(0,a.jsx)("div",{className:"flex items-center justify-center h-40",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)(eT.S,{className:"size-5"}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-gray-600 text-sm font-medium",children:s?"Processing date selection...":"Loading chart data..."}),(0,a.jsx)("span",{className:"text-gray-400 text-xs mt-1",children:s?"This will only take a moment":"Fetching your data"})]})]})})};var eL=t(35829),eE=t(97765),eA=t(99981),eF=e=>{let{accessToken:s,selectedTags:t,formatAbbreviatedNumber:l}=e,[n,i]=(0,Z.useState)({results:[],total_count:0,page:1,page_size:50,total_pages:0}),[c,k]=(0,Z.useState)(!1),[b,w]=(0,Z.useState)(1),q=async()=>{if(s){k(!0);try{let e=await (0,N.perUserAnalyticsCall)(s,b,50,t.length>0?t:void 0);i(e)}catch(e){console.error("Failed to fetch per-user data:",e)}finally{k(!1)}}};return(0,Z.useEffect)(()=>{q()},[s,t,b]),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"Per User Usage"}),(0,a.jsx)(eE.Z,{children:"Individual developer usage metrics"}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"User Details"}),(0,a.jsx)(o.Z,{children:"Usage Distribution"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"User ID"}),(0,a.jsx)(f.Z,{children:"User Email"}),(0,a.jsx)(f.Z,{children:"User Agent"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Success Generations"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Tokens"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Failed Requests"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Cost"})]})}),(0,a.jsx)(p.Z,{children:n.results.slice(0,10).map((e,s)=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{className:"font-medium",children:e.user_id})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_email||"N/A"})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_agent||"Unknown"})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.successful_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.total_tokens)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.failed_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsxs)(y.Z,{children:["$",l(e.spend,4)]})})]},s))})]}),n.results.length>10&&(0,a.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,a.jsxs)(y.Z,{className:"text-sm text-gray-500",children:["Showing 10 of ",n.total_count," results"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b>1&&w(b-1)},disabled:1===b,children:"Previous"}),(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b=n.total_pages,children:"Next"})]})]})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(v.Z,{className:"text-lg",children:"User Usage Distribution"}),(0,a.jsx)(eE.Z,{children:"Number of users by successful request frequency"})]}),(0,a.jsx)(r.Z,{data:(()=>{let e=new Map;n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)});let s=Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s}),t={"1-9 requests":{range:[1,9],agents:{}},"10-99 requests":{range:[10,99],agents:{}},"100-999 requests":{range:[100,999],agents:{}},"1K-9.9K requests":{range:[1e3,9999],agents:{}},"10K-99.9K requests":{range:[1e4,99999],agents:{}},"100K+ requests":{range:[1e5,1/0],agents:{}}};return n.results.forEach(e=>{let a=e.successful_requests,r=e.user_agent||"Unknown";s.includes(r)&&Object.entries(t).forEach(e=>{let[s,t]=e;a>=t.range[0]&&a<=t.range[1]&&(t.agents[r]||(t.agents[r]=0),t.agents[r]++)})}),Object.entries(t).map(e=>{let[t,a]=e,r={category:t};return s.forEach(e=>{r[e]=a.agents[e]||0}),r})})(),index:"category",categories:(()=>{let e=new Map;return n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)}),Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s})})(),colors:["blue","green","orange","red","purple","yellow","pink","indigo"],valueFormatter:e=>"".concat(e," users"),yAxisWidth:80,showLegend:!0,stack:!0})]})]})]})]})},eO=e=>{let{accessToken:s,userRole:t,dateValue:n,onDateChange:i}=e,[h,p]=(0,Z.useState)({results:[]}),[g,j]=(0,Z.useState)({results:[]}),[f,_]=(0,Z.useState)({results:[]}),[k,b]=(0,Z.useState)({results:[]}),[w,q]=(0,Z.useState)(""),[S,C]=(0,Z.useState)([]),[T,D]=(0,Z.useState)([]),[L,E]=(0,Z.useState)(!1),[A,F]=(0,Z.useState)(!1),[O,M]=(0,Z.useState)(!1),[U,V]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(!1),I=new Date,Y=async()=>{if(s){E(!0);try{let e=await (0,N.tagDistinctCall)(s);C(e.results.map(e=>e.tag))}catch(e){console.error("Failed to fetch available tags:",e)}finally{E(!1)}}},K=async()=>{if(s){F(!0);try{let e=await (0,N.tagDauCall)(s,I,w||void 0,T.length>0?T:void 0);p(e)}catch(e){console.error("Failed to fetch DAU data:",e)}finally{F(!1)}}},$=async()=>{if(s){M(!0);try{let e=await (0,N.tagWauCall)(s,I,w||void 0,T.length>0?T:void 0);j(e)}catch(e){console.error("Failed to fetch WAU data:",e)}finally{M(!1)}}},P=async()=>{if(s){V(!0);try{let e=await (0,N.tagMauCall)(s,I,w||void 0,T.length>0?T:void 0);_(e)}catch(e){console.error("Failed to fetch MAU data:",e)}finally{V(!1)}}},W=async()=>{if(s&&n.from&&n.to){z(!0);try{let e=await (0,N.userAgentSummaryCall)(s,n.from,n.to,T.length>0?T:void 0);b(e)}catch(e){console.error("Failed to fetch user agent summary data:",e)}finally{z(!1)}}};(0,Z.useEffect)(()=>{Y()},[s]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{K(),$(),P()},50);return()=>clearTimeout(e)},[s,w,T]),(0,Z.useEffect)(()=>{if(!n.from||!n.to)return;let e=setTimeout(()=>{W()},50);return()=>clearTimeout(e)},[s,n,T]);let B=e=>e.startsWith("User-Agent: ")?e.replace("User-Agent: ",""):e,H=e=>e.length>15?e.substring(0,15)+"...":e,G=e=>Object.entries(e.reduce((e,s)=>(e[s.tag]=(e[s.tag]||0)+s.active_users,e),{})).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).map(e=>{let[s]=e;return s}),J=G(h.results).slice(0,10),Q=G(g.results).slice(0,10),X=G(f.results).slice(0,10),es=(()=>{let e=[],s=new Date;for(let t=6;t>=0;t--){let a=new Date(s);a.setDate(a.getDate()-t);let r={date:a.toISOString().split("T")[0]};J.forEach(e=>{r[B(e)]=0}),e.push(r)}return h.results.forEach(s=>{let t=B(s.tag),a=e.find(e=>e.date===s.date);a&&(a[t]=s.active_users)}),e})(),et=(()=>{let e=[];for(let s=1;s<=7;s++){let t={week:"Week ".concat(s)};Q.forEach(e=>{t[B(e)]=0}),e.push(t)}return g.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Week (\d+)/);if(a){let r="Week ".concat(a[1]),l=e.find(e=>e.week===r);l&&(l[t]=s.active_users)}}),e})(),ea=(()=>{let e=[];for(let s=1;s<=7;s++){let t={month:"Month ".concat(s)};X.forEach(e=>{t[B(e)]=0}),e.push(t)}return f.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Month (\d+)/);if(a){let r="Month ".concat(a[1]),l=e.find(e=>e.month===r);l&&(l[t]=s.active_users)}}),e})(),er=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e>=1e8||e>=1e7||e>=1e6?(e/1e6).toFixed(s)+"M":e>=1e4?(e/1e3).toFixed(s)+"K":e>=1e3?(e/1e3).toFixed(s)+"K":e.toFixed(s)};return(0,a.jsxs)("div",{className:"space-y-6 mt-6",children:[(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v.Z,{children:"Summary by User Agent"}),(0,a.jsx)(eE.Z,{children:"Performance metrics for different user agents"})]}),(0,a.jsxs)("div",{className:"w-96",children:[(0,a.jsx)(y.Z,{className:"text-sm font-medium block mb-2",children:"Filter by User Agents"}),(0,a.jsx)(ee.default,{mode:"multiple",placeholder:"All User Agents",value:T,onChange:D,style:{width:"100%"},showSearch:!0,allowClear:!0,loading:L,optionFilterProp:"label",className:"rounded-md",maxTagCount:"responsive",children:S.map(e=>{let s=B(e),t=s.length>50?"".concat(s.substring(0,50),"..."):s;return(0,a.jsx)(ee.default.Option,{value:e,label:t,title:s,children:t},e)})})]})]}),R?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(k.results||[]).slice(0,4).map((e,s)=>{let t=B(e.tag),r=H(t);return(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(eA.Z,{title:t,placement:"top",children:(0,a.jsx)(v.Z,{className:"truncate",children:r})}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.successful_requests)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.total_tokens)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsxs)(eL.Z,{className:"text-lg",children:["$",er(e.total_spend,4)]})]})]})]},s)}),Array.from({length:Math.max(0,4-(k.results||[]).length)}).map((e,s)=>(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"No Data"}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]})]})]},"empty-".concat(s)))]})]})}),(0,a.jsx)(l.Z,{children:(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU/WAU/MAU"}),(0,a.jsx)(o.Z,{children:"Per User Usage (Last 30 Days)"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"DAU, WAU & MAU per Agent"}),(0,a.jsx)(eE.Z,{children:"Active users across different time periods"})]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU"}),(0,a.jsx)(o.Z,{children:"WAU"}),(0,a.jsx)(o.Z,{children:"MAU"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Daily Active Users - Last 7 Days"})}),A?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:es,index:"date",categories:J.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Weekly Active Users - Last 7 Weeks"})}),O?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:et,index:"week",categories:Q.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Monthly Active Users - Last 7 Months"})}),U?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:ea,index:"month",categories:X.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]})]})]})]}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eF,{accessToken:s,selectedTags:T,formatAbbreviatedNumber:er})})]})]})})]})},eM=t(47375),eU=e=>{let{endpointData:s}=e,t=s||{},n=Z.useMemo(()=>Object.entries(t).map(e=>{let[s,t]=e;return{endpoint:s,"metrics.successful_requests":t.metrics.successful_requests,"metrics.failed_requests":t.metrics.failed_requests,metrics:{successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests}}}),[t]);return(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests by Endpoint"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:n,index:"endpoint",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:z,showLegend:!1,stack:!0,yAxisWidth:60})]})},eV=t(59664),eR=function(e){let{dailyData:s,endpointData:t}=e,r=(0,Z.useMemo)(()=>(null==s?void 0:s.results)&&0!==s.results.length?function(e){let s=[],t=new Set;return e.forEach(e=>{e.breakdown.endpoints&&Object.keys(e.breakdown.endpoints).forEach(e=>t.add(e))}),e.forEach(e=>{let a={date:new Date(e.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})};t.forEach(s=>{var t;let r=null===(t=e.breakdown.endpoints)||void 0===t?void 0:t[s];a[s]=(null==r?void 0:r.metrics.api_requests)||0}),s.push(a)}),s.reverse()}(s.results):[],[s]),n=(0,Z.useMemo)(()=>0===r.length?[]:Object.keys(r[0]).filter(e=>"date"!==e),[r]);return(0,a.jsxs)(l.Z,{className:"mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)(v.Z,{children:"Endpoint Usage Trends"})}),(0,a.jsx)(eV.Z,{className:"h-80",data:r,index:"date",categories:n,colors:["blue","cyan","indigo","violet","purple","fuchsia","pink","rose","red","orange"].slice(0,n.length),valueFormatter:e=>e.toLocaleString(),showLegend:!0,showGridLines:!0,yAxisWidth:60,connectNulls:!0,curveType:"natural"})]})},ez=t(68565),eI=t(56609),eY=e=>{let{endpointData:s}=e,t=(e,s)=>0===s?0:e/s*100,r=Object.entries(s).map(e=>{let[s,a]=e;return{key:s,endpoint:s,successful_requests:a.metrics.successful_requests,failed_requests:a.metrics.failed_requests,api_requests:a.metrics.api_requests,total_tokens:a.metrics.total_tokens,spend:a.metrics.spend,successRate:t(a.metrics.successful_requests,a.metrics.api_requests)}}),l=[{title:"Endpoint",dataIndex:"endpoint",key:"endpoint",render:e=>(0,a.jsx)("span",{className:"font-medium",children:e})},{title:"Successful / Failed",key:"requests",render:(e,s)=>{let t=s.api_requests>0?s.successful_requests/s.api_requests*100:0,r=s.api_requests>0?s.failed_requests/s.api_requests*100:0,l={"0%":"#22c55e"};return t>0&&t<100&&(l["".concat(t,"%")]="#22c55e",l["".concat(t+.01,"%")]="#ef4444"),l["100%"]=r>0?"#ef4444":"#22c55e",(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"flex-1 relative",children:(0,a.jsx)(ez.Z,{percent:t+r,size:"small",strokeColor:l,showInfo:!1})}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-sm min-w-[100px]",children:[(0,a.jsx)("span",{className:"text-green-600 font-medium",children:s.successful_requests.toLocaleString()}),(0,a.jsx)("span",{className:"text-gray-400",children:"/"}),(0,a.jsx)("span",{className:"text-red-600 font-medium",children:s.failed_requests.toLocaleString()})]})]})}},{title:"Total Request",dataIndex:"api_requests",key:"api_requests",render:e=>e.toLocaleString()},{title:"Success Rate",dataIndex:"successRate",key:"successRate",render:e=>{let s=e.toFixed(2);return(0,a.jsxs)("span",{className:e>=95?"text-green-600 font-medium":e>=80?"text-yellow-600 font-medium":"text-red-600 font-medium",children:[s,"%"]})}},{title:"Total Tokens",dataIndex:"total_tokens",key:"total_tokens",render:e=>e.toLocaleString()},{title:"Spend",dataIndex:"spend",key:"spend",render:e=>"$".concat((0,F.pw)(e,2))}];return(0,a.jsx)(eI.Z,{columns:l,dataSource:r,pagination:!1})},eK=e=>{let{userSpendData:s}=e,t=(0,Z.useMemo)(()=>{let e={};return(null==s?void 0:s.results)&&s.results.forEach(s=>{Object.entries(s.breakdown.endpoints||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:a.metadata||{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),e},[s]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(eY,{endpointData:t}),(0,a.jsx)(eU,{endpointData:t}),(0,a.jsx)(eR,{dailyData:s,endpointData:t})]})},e$=t(49282),eP=t(57589),eW=t(12322);function eB(e){let{topModels:s,topModelsLimit:t,setTopModelsLimit:l}=e,[n,i]=(0,Z.useState)("table"),c=s.slice(0,t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:t,onChange:e=>l(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>i("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>i("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===n?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(r.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(c.length,t)},data:c,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:e=>"$".concat((0,F.pw)(e,2)),layout:"vertical",yAxisWidth:200,tickGap:5,showLegend:!1})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(eW.w,{columns:[{header:"Model",accessorKey:"key",cell:e=>e.getValue()||"-"},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return"$".concat((0,F.pw)(s,2))}},{header:"Successful",accessorKey:"successful_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-green-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Failed",accessorKey:"failed_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-red-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Tokens",accessorKey:"tokens",cell:e=>{var s;return(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0}}],data:c,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})})]})}var eH=e=>{let{accessToken:s,entityType:t,entityId:k,entityList:b,dateValue:w}=e,[q,S]=(0,Z.useState)({results:[],metadata:{total_spend:0,total_api_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0}}),{teams:C}=(0,e$.Z)(),T=B(q,"models",C||[]),D=B(q,"api_keys",C||[]),[L,E]=(0,Z.useState)([]),[A,O]=(0,Z.useState)(5),[M,U]=(0,Z.useState)(5),V=async()=>{if(!s||!w.from||!w.to)return;let e=new Date(w.from),a=new Date(w.to);if("tag"===t)S(await (0,N.tagDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("team"===t)S(await (0,N.teamDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("organization"===t)S(await (0,N.organizationDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("customer"===t)S(await (0,N.customerDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("agent"===t)S(await (0,N.agentDailyActivityCall)(s,e,a,1,L.length>0?L:null));else throw Error("Invalid entity type")};(0,Z.useEffect)(()=>{V()},[s,w,k,L]);let R=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={provider:t,spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend,e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens}catch(e){console.error("Error processing provider ".concat(t,": ").concat(e))}})}),Object.values(e).filter(e=>e.spend>0).sort((e,s)=>s.spend-e.spend)},z=(e,s)=>{if(b){let s=b.find(s=>s.value===e);if(s)return s.label}return(null==s?void 0:s.team_alias)?s.team_alias:e},I=e=>0===L.length?e:e.filter(e=>L.includes(e.metadata.id)),Y=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.entities||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{alias:z(t,a.metadata),id:t}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.total_tokens+=a.metrics.total_tokens})}),I(Object.values(e).sort((e,s)=>s.metrics.spend-e.metrics.spend))},$=t.charAt(0).toUpperCase()+t.slice(1);return(0,a.jsxs)("div",{style:{width:"100%"},className:"relative",children:[(0,a.jsx)(ek,{dateValue:w,entityType:t,spendData:q,showFilters:null!==b&&b.length>0,filterLabel:"Filter by ".concat(t),filterPlaceholder:"Select ".concat(t," to filter..."),selectedFilters:L,onFiltersChange:E,filterOptions:(()=>{if(b)return b})()||void 0,teams:C||[]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"agent"===t?"Request / Token Consumption":"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)(v.Z,{children:[$," Spend Overview"]}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Spend"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)(q.metadata.total_spend,2)]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_api_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:q.metadata.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:q.metadata.total_failed_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_tokens.toLocaleString()})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),(0,a.jsx)(r.Z,{data:[...q.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload,l=Object.keys(r.breakdown.entities||{}).length;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Total Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Tokens: ",r.metrics.total_tokens]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total ",$,"s: ",l]}),(0,a.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,a.jsxs)("p",{className:"font-semibold",children:["Spend by ",$,":"]}),Object.entries(r.breakdown.entities||{}).sort((e,s)=>{let[,t]=e,[,a]=s,r=t.metrics.spend;return a.metrics.spend-r}).slice(0,5).map(e=>{let[s,t]=e;return(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[z(s,t.metadata),": $",(0,F.pw)(t.metrics.spend,2)]},s)}),l>5&&(0,a.jsxs)("p",{className:"text-sm text-gray-500 italic",children:["...and ",l-5," more"]})]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsxs)(v.Z,{children:["Spend Per ",$]}),(0,a.jsx)(eE.Z,{className:"text-xs",children:"Showing Top 5 by Spend"}),(0,a.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["Get Started by Tracking cost per ",$," "]}),(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/enterprise#spend-tracking",className:"text-blue-500 hover:text-blue-700 ml-1",children:"here"})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-6",children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(r.Z,{className:"mt-4 h-52",data:Y().slice(0,5).map(e=>({...e,metadata:{...e.metadata,alias_display:e.metadata.alias&&e.metadata.alias.length>15?"".concat(e.metadata.alias.slice(0,15),"..."):e.metadata.alias}})),index:"metadata.alias_display",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",showLegend:!1,yAxisWidth:150,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.metadata.alias}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,4)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.metrics.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.metrics.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens.toLocaleString()]})]})}})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)("div",{className:"h-52 overflow-y-auto",children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:$}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:Y().filter(e=>e.metrics.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:e.metadata.alias}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.metrics.spend,4)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.metrics.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.metrics.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.metrics.total_tokens.toLocaleString()})]},e.metadata.id))})]})})})]})]})})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:(()=>{console.log("debugTags",{spendData:q});let e={};return q.results.forEach(s=>{let{breakdown:t}=s,{entities:a}=t;console.log("debugTags",{entities:a});let r=Object.keys(a).reduce((e,s)=>{let{api_key_breakdown:t}=a[s];return Object.keys(t).forEach(a=>{let r={tag:s,usage:t[a].metrics.spend};e[a]?e[a].push(r):e[a]=[r]}),e},{});console.log("debugTags",{tagDictionary:r}),Object.entries(s.breakdown.api_keys||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:a.metadata.team_id||null,tags:r[t]||[]}},console.log("debugTags",{keySpend:e})),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||"-",spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,A)})(),teams:null,showTags:"tag"===t,topKeysLimit:A,setTopKeysLimit:O})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"agent"===t?"Top Agents":"Top Models"}),(0,a.jsx)(eB,{topModels:(()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.models||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend}catch(e){console.error("Error adding spend for ".concat(t,": ").concat(e,", got metrics: ").concat(JSON.stringify(a)))}e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,...t}}).sort((e,s)=>s.spend-e.spend).slice(0,M)})(),topModelsLimit:M,setTopModelsLimit:U})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsx)(v.Z,{children:"Provider Usage"}),(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:R(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan","blue","indigo","violet","purple"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:R().map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:T,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:D,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:q})})]})]})]})},eG=t(64739),eJ=t(37527),eQ=t(41361),eX=t(40312),e0=t(71891),e1=t(69993),e2=t(48231),e4=t(9775),e5=t(33866);let e6=[{value:"global",label:"Global Usage",showForAdmin:"Global Usage",showForNonAdmin:"Your Usage",description:"View usage across all resources",descriptionForAdmin:"View usage across all resources",descriptionForNonAdmin:"View your usage",icon:(0,a.jsx)(eG.Z,{style:{fontSize:"16px"}})},{value:"organization",label:"Organization Usage",showForAdmin:"Organization Usage",showForNonAdmin:"Your Organization Usage",description:"View organization-level usage",descriptionForAdmin:"View usage across all organizations",descriptionForNonAdmin:"View your organization's usage",icon:(0,a.jsx)(eJ.Z,{style:{fontSize:"16px"}})},{value:"team",label:"Team Usage",description:"View usage by team",icon:(0,a.jsx)(eQ.Z,{style:{fontSize:"16px"}})},{value:"customer",label:"Customer Usage",description:"View usage by customer accounts",icon:(0,a.jsx)(eX.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"tag",label:"Tag Usage",description:"View usage grouped by tags",icon:(0,a.jsx)(e0.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"agent",label:"Agent Usage (A2A)",description:"View usage by AI agents",icon:(0,a.jsx)(e1.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"user-agent-activity",label:"User Agent Activity",description:"View detailed user agent activity logs",icon:(0,a.jsx)(e2.Z,{style:{fontSize:"16px"}}),adminOnly:!0}],e3=e=>{let{value:s,onChange:t,isAdmin:r,title:l="Usage View",description:n="Select the usage data you want to view","data-id":i}=e,c=e6.filter(e=>!e.adminOnly||!!r).map(e=>{let s=e.label,t=e.description;return e.showForAdmin&&e.showForNonAdmin&&(s=r?e.showForAdmin:e.showForNonAdmin),e.descriptionForAdmin&&e.descriptionForNonAdmin&&(t=r?e.descriptionForAdmin:e.descriptionForNonAdmin),{value:e.value,label:s,description:t,icon:e.icon,badgeText:e.badgeText}});return(0,a.jsx)("div",{className:"w-full","data-id":i,children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-4",children:[(0,a.jsxs)("div",{className:"flex items-stretch gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"flex-shrink-0 flex items-center",children:(0,a.jsx)(e4.Z,{style:{fontSize:"32px"}})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-0.5 leading-tight",children:l}),(0,a.jsx)("p",{className:"text-xs text-gray-600 leading-tight",children:n})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-54 sm:w-64 md:w-72",size:"large",options:c.map(e=>({value:e.value,label:e.label})),optionRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:s.icon}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900",children:s.label}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-0.5",children:s.description})]}),s.badgeText&&(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)(e5.Z,{color:"blue",count:s.badgeText})})]}):e.label},labelRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{children:s.icon}),(0,a.jsx)("span",{className:"text-sm",children:s.label})]}):e.label}})})]})})};var e9=e=>{var s,t,w,q,T,L,M,U,V,R,z;let{teams:I,organizations:Y}=e,{accessToken:$,userRole:W,userId:H,premiumUser:G}=(0,C.Z)(),[J,Q]=(0,Z.useState)({results:[],metadata:{}}),[X,ee]=(0,Z.useState)(!1),[es,et]=(0,Z.useState)(!1),er=(0,Z.useMemo)(()=>new Date(Date.now()-6048e5),[]),el=(0,Z.useMemo)(()=>new Date,[]),[en,ei]=(0,Z.useState)({from:er,to:el}),[ec,eo]=(0,Z.useState)([]),{data:ed=[]}=E(),{data:eu}=D(),{data:em}=(0,A.x)();console.log("currentUser: ".concat(JSON.stringify(em))),console.log("currentUser max budget: ".concat(null==em?void 0:em.max_budget));let[ex,eh]=(0,Z.useState)("groups"),[ep,eg]=(0,Z.useState)(!1),[ej,ef]=(0,Z.useState)(!1),[e_,ev]=(0,Z.useState)(!0),[ek,eZ]=(0,Z.useState)(!0),[eN,ew]=(0,Z.useState)("global"),[eq,eS]=(0,Z.useState)(!0),[eT,eL]=(0,Z.useState)(5),[eE,eA]=(0,Z.useState)(5),eF=async()=>{$&&eo(Object.values(await (0,N.tagListCall)($)).map(e=>({label:e.name,value:e.name})))};(0,Z.useEffect)(()=>{eF()},[$]);let eU=(null===(s=J.metadata)||void 0===s?void 0:s.total_spend)||0,eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.models||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},eR=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.model_groups||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},ez=()=>{let e={};return J.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{provider:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}})},eI=(0,Z.useCallback)(async()=>{if(!$||!en.from||!en.to)return;ee(!0);let e=new Date(en.from),s=new Date(en.to);try{try{let t=await (0,N.userDailyActivityAggregatedCall)($,e,s);Q(t);return}catch(e){}let t=await (0,N.userDailyActivityCall)($,e,s);if(t.metadata.total_pages<=1){Q(t);return}let a=[...t.results],r={...t.metadata};for(let l=2;l<=t.metadata.total_pages;l++){let t=await (0,N.userDailyActivityCall)($,e,s,l);a.push(...t.results),t.metadata&&(r.total_spend+=t.metadata.total_spend||0,r.total_api_requests+=t.metadata.total_api_requests||0,r.total_successful_requests+=t.metadata.total_successful_requests||0,r.total_failed_requests+=t.metadata.total_failed_requests||0,r.total_tokens+=t.metadata.total_tokens||0)}Q({results:a,metadata:r})}catch(e){console.error("Error fetching user spend data:",e)}finally{ee(!1),et(!1)}},[$,en.from,en.to]),eY=(0,Z.useCallback)(e=>{et(!0),ee(!0),ei(e)},[]);(0,Z.useEffect)(()=>{if(!en.from||!en.to)return;let e=setTimeout(()=>{eI()},50);return()=>clearTimeout(e)},[eI]);let e$=B(J,"models",I),eW=B(J,"api_keys",I),eB=B(J,"mcp_servers",I);return(0,a.jsxs)("div",{style:{width:"100%"},className:"p-8 relative",children:[(0,a.jsx)("div",{className:"flex items-end justify-between gap-6 mb-6",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-end justify-between gap-6 mb-4 w-full",children:[(0,a.jsx)(e3,{value:eN,onChange:e=>ew(e),isAdmin:S.ZL.includes(W||"")}),(0,a.jsx)(eC,{value:en,onValueChange:eY})]}),"global"===eN&&(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"MCP Server Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsx)(O.z,{onClick:()=>ef(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsxs)(n.Z,{numColSpan:2,children:[(0,a.jsxs)(y.Z,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend"," ",en.from&&en.to&&(0,a.jsxs)(a.Fragment,{children:[en.from.toLocaleDateString("en-US",{month:"short",day:"numeric",year:en.from.getFullYear()!==en.to.getFullYear()?"numeric":void 0})," - ",en.to.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),(0,a.jsx)(eM.Z,{userSpend:eU,selectedTeam:null,userMaxBudget:(null==em?void 0:em.max_budget)||null})]}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Usage Metrics"}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(w=J.metadata)||void 0===w?void 0:null===(t=w.total_api_requests)||void 0===t?void 0:t.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:(null===(T=J.metadata)||void 0===T?void 0:null===(q=T.total_successful_requests)||void 0===q?void 0:q.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:(null===(M=J.metadata)||void 0===M?void 0:null===(L=M.total_failed_requests)||void 0===L?void 0:L.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(V=J.metadata)||void 0===V?void 0:null===(U=V.total_tokens)||void 0===U?void 0:U.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Average Cost per Request"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)((eU||0)/((null===(R=J.metadata)||void 0===R?void 0:R.total_api_requests)||1),4)]})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)(r.Z,{data:[...J.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.api_keys||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:null,tags:a.metadata.tags||[]}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests,s[t].metrics.failed_requests+=a.metrics.failed_requests,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),console.log("debugTags",{keySpend:s,userSpendData:J}),Object.entries(s).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||[],spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,e)}(eT),teams:null,topKeysLimit:eT,setTopKeysLimit:eL})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"groups"===ex?"Top Public Model Names":"Top Litellm Models"}),(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:eE,onChange:e=>eA(e)}),(0,a.jsxs)("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("groups"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("groups"),children:"Public Model Name"}),(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("individual"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("individual"),children:"Litellm Model Name"})]})]}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(()=>{let e="groups"===ex?eR(eE):eV(eE);return(0,a.jsx)(r.Z,{className:"mt-4",style:{height:52*Math.min(e.length,eE)},data:e,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",yAxisWidth:200,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.key}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.tokens.toLocaleString()]})]})}})})()})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(v.Z,{children:"Spend by Provider"})}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:ez(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:ez().filter(e=>e.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:e$})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eW})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eB})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:J})})]})]}),"organization"===eN&&(0,a.jsxs)(a.Fragment,{children:[e_&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Organization usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>ev(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"organization",userID:H,userRole:W,dateValue:en,entityList:(null==Y?void 0:Y.map(e=>({label:e.organization_alias,value:e.organization_id})))||null,premiumUser:G})]}),"team"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"team",userID:H,userRole:W,entityList:(null==I?void 0:I.map(e=>({label:e.team_alias,value:e.team_id})))||null,premiumUser:G,dateValue:en}),"customer"===eN&&(0,a.jsxs)(a.Fragment,{children:[ek&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Customer usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eZ(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"customer",userID:H,userRole:W,entityList:(null==ed?void 0:ed.map(e=>({label:e.alias||e.user_id,value:e.user_id})))||null,premiumUser:G,dateValue:en})]}),"tag"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"tag",userID:H,userRole:W,entityList:ec,premiumUser:G,dateValue:en}),"agent"===eN&&(0,a.jsxs)(a.Fragment,{children:[eq&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Agent usage (A2A) is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eS(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"agent",userID:H,userRole:W,entityList:(null==eu?void 0:null===(z=eu.agents)||void 0===z?void 0:z.map(e=>({label:e.agent_name,value:e.agent_id})))||null,premiumUser:G,dateValue:en})," "]}),"user-agent-activity"===eN&&(0,a.jsx)(eO,{accessToken:$,userRole:W,dateValue:en})]})}),(0,a.jsx)(ea,{isOpen:ep,onClose:()=>eg(!1),accessToken:$}),(0,a.jsx)(ey,{isOpen:ej,onClose:()=>ef(!1),entityType:"team",spendData:{results:J.results,metadata:J.metadata},dateRange:en,selectedFilters:[],customTitle:"Export Usage Data"})]})}},91323:function(e,s,t){t.d(s,{S:function(){return n}});var a=t(57437),r=t(2265),l=t(10012);function n(e){var s,t;let{className:n="",...i}=e,c=(0,r.useId)();return s=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),s=e.find(e=>{var s;return(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))===c}),t=e.find(e=>{var s;return e.effect instanceof KeyframeEffect&&(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))!==c});s&&t&&(s.currentTime=t.currentTime)},t=[c],(0,r.useLayoutEffect)(s,t),(0,a.jsxs)("svg",{"data-spinner-id":c,className:(0,l.cx)("pointer-events-none size-12 animate-spin text-current",n),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}},47375:function(e,s,t){var a=t(57437),r=t(2265),l=t(19250),n=t(59872),i=t(39760);s.Z=e=>{let{userSpend:s,userMaxBudget:t,selectedTeam:c}=e,{accessToken:o,userRole:d,userId:u}=(0,i.Z)(),[m,x]=(0,r.useState)(null!==s?s:0),[h,p]=(0,r.useState)(c?Number((0,n.pw)(c.max_budget,4)):null);(0,r.useEffect)(()=>{if(c){if("Default Team"===c.team_alias)p(t);else{let e=!1;if(c.team_memberships)for(let s of c.team_memberships)s.user_id===u&&"max_budget"in s.litellm_budget_table&&null!==s.litellm_budget_table.max_budget&&(p(s.litellm_budget_table.max_budget),e=!0);e||p(c.max_budget)}}else p(t)},[c,t]);let[g,j]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(!o||!u||!d)return};(async()=>{try{if(null===u||null===d)return;if(null!==o){let e=(await (0,l.modelAvailableCall)(o,u,d)).data.map(e=>e.id);console.log("available_model_names:",e),j(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[d,o,u]),(0,r.useEffect)(()=>{null!==s&&x(s)},[s]);let f=[];c&&c.models&&(f=c.models),f&&f.includes("all-proxy-models")?(console.log("user models:",g),f=g):f&&f.includes("all-team-models")?f=c.models:f&&0===f.length&&(f=g);let _=null!==h?"$".concat((0,n.pw)(Number(h),4)," limit"):"No limit",y=void 0!==m?(0,n.pw)(m,4):null;return console.log("spend in view user spend: ".concat(m)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{className:"flex justify-between gap-x-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total Spend"}),(0,a.jsxs)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:["$",y]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Max Budget"}),(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:_})]})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[292],{57589:function(e,s,t){t.d(s,{Z:function(){return j}});var a=t(57437),r=t(39760),l=t(44633),n=t(86462),i=t(40278),c=t(78489),o=t(99981),d=t(10968),u=t(2265),m=t(59872);let x=e=>{let{key:s,info:t}=e;return{token:s,...t}};var h=t(19250),p=t(50665),g=t(60493),j=e=>{let{topKeys:s,teams:t,showTags:j=!1,topKeysLimit:f,setTopKeysLimit:_}=e,{accessToken:y,userRole:v,userId:k,premiumUser:b}=(0,r.Z)(),[Z,N]=(0,u.useState)(!1),[w,q]=(0,u.useState)(null),[S,C]=(0,u.useState)(void 0),[T,D]=(0,u.useState)("table"),[L,E]=(0,u.useState)(new Set),A=e=>{E(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},F=async e=>{if(y)try{let s=await (0,h.keyInfoV1Call)(y,e.api_key),t=x(s);C(t),q(e.api_key),N(!0)}catch(e){console.error("Error fetching key info:",e)}},O=()=>{N(!1),q(null),C(void 0)};u.useEffect(()=>{let e=e=>{"Escape"===e.key&&Z&&O()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Z]);let M=[{header:"Key ID",accessorKey:"api_key",cell:e=>(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(o.Z,{title:e.getValue(),children:(0,a.jsx)(c.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>F(e.row.original),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{header:"Key Alias",accessorKey:"key_alias",cell:e=>e.getValue()||"-"}],U={header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return s>0&&s<.01?"<$0.01":"$".concat((0,m.pw)(s,2))}},V=j?[...M,{header:"Tags",accessorKey:"tags",cell:e=>{let s=e.getValue(),t=e.row.original.api_key,r=L.has(t);if(!s||0===s.length)return"-";let i=s.sort((e,s)=>s.usage-e.usage),c=r?i:i.slice(0,2),d=s.length>2;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[c.map((e,s)=>(0,a.jsx)(o.Z,{title:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Tag Name:"})," ",e.tag]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend:"})," ",e.usage>0&&e.usage<.01?"<$0.01":"$".concat((0,m.pw)(e.usage,2))]})]}),children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[e.tag.slice(0,7),"..."]})},s)),d&&(0,a.jsx)("button",{onClick:()=>A(t),className:"ml-1 p-1 hover:bg-gray-200 rounded-full transition-colors",title:r?"Show fewer tags":"Show all tags",children:r?(0,a.jsx)(l.Z,{className:"h-3 w-3 text-gray-500"}):(0,a.jsx)(n.Z,{className:"h-3 w-3 text-gray-500"})})]})})}},U]:[...M,U],R=s.map(e=>({...e,display_key_alias:e.key_alias&&e.key_alias.length>10?"".concat(e.key_alias.slice(0,10),"..."):e.key_alias||"-"}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(d.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:f,onChange:e=>_(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>D("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>D("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===T?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(i.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(R.length,f)},data:R,index:"display_key_alias",categories:["spend"],colors:["cyan"],yAxisWidth:120,tickGap:5,layout:"vertical",showLegend:!1,valueFormatter:e=>"$".concat((0,m.pw)(e,2)),onValueChange:e=>F(e),showTooltip:!0,customTooltip:e=>{var s,t;let r=null===(t=e.payload)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.payload;return(0,a.jsx)("div",{className:"relative z-50 p-3 bg-black/90 shadow-lg rounded-lg text-white max-w-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key Alias: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.key_alias})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key ID: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.api_key})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend: "}),(0,a.jsxs)("span",{className:"text-white font-medium",children:["$",(0,m.pw)(null==r?void 0:r.spend,2)]})]})]})})}})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(g.w,{columns:V,data:s,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})}),Z&&w&&S&&(console.log("Rendering modal with:",{isModalOpen:Z,selectedKey:w,keyData:S}),(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&O()},children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl relative w-11/12 max-w-6xl max-h-[90vh] overflow-y-auto min-h-[750px]",children:[(0,a.jsx)("button",{onClick:O,className:"absolute top-4 right-4 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":"Close",children:(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("div",{className:"p-6 h-full",children:(0,a.jsx)(p.Z,{keyId:w,onClose:O,keyData:S,teams:t})})]})}))]})}},90292:function(e,s,t){t.d(s,{Z:function(){return e9}});var a=t(57437),r=t(40278),l=t(12514),n=t(49804),i=t(14042),c=t(67101),o=t(12485),d=t(18135),u=t(35242),m=t(29706),x=t(77991),h=t(21626),p=t(97214),g=t(28241),j=t(58834),f=t(69552),_=t(71876),y=t(84264),v=t(96761),k=t(10968),b=t(51653),Z=t(2265),N=t(19250),w=t(11713),q=t(90246),S=t(20347),C=t(39760);let T=(0,q.n)("agents"),D=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:T.list({}),queryFn:async()=>await (0,N.getAgentsList)(e),enabled:!!e&&S.ZL.includes(s||"")})},L=(0,q.n)("customers"),E=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:L.list({}),queryFn:async()=>await (0,N.allEndUsersCall)(e),enabled:!!e&&S.ZL.includes(s)})};var A=t(76134),F=t(59872),O=t(16312),M=t(29299),U=t(75105),V=t(44851);let R={blue:"#3b82f6",cyan:"#06b6d4",indigo:"#6366f1",green:"#22c55e",red:"#ef4444",purple:"#8b5cf6",emerald:"#37bc7d"},z=e=>{let{active:s,payload:t,label:r}=e;if(s&&t&&t.length){let e=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),s=(e,s)=>{let t=s.substring(s.indexOf(".")+1);if(e.metrics&&t in e.metrics)return e.metrics[t]};return(0,a.jsxs)("div",{className:"w-56 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[(0,a.jsx)("p",{className:"text-tremor-content-strong",children:r}),t.map(t=>{var r;let l=null===(r=t.dataKey)||void 0===r?void 0:r.toString();if(!l||!t.payload)return null;let n=s(t.payload,l),i=l.includes("spend"),c=void 0!==n?i?"$".concat(n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})):n.toLocaleString():"N/A",o=R[t.color]||t.color;return(0,a.jsxs)("div",{className:"flex items-center justify-between space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-2 ring-white drop-shadow-md",style:{backgroundColor:o}}),(0,a.jsx)("p",{className:"font-medium text-tremor-content dark:text-dark-tremor-content",children:e(l)})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",children:c})]},l)})]})}return null},I=e=>{let{categories:s,colors:t}=e,r=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return(0,a.jsx)("div",{className:"flex items-center justify-end space-x-4",children:s.map((e,s)=>{let l=R[t[s]]||t[s];return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-4 ring-white",style:{backgroundColor:l}}),(0,a.jsx)("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:r(e)})]},e)})})};function Y(e){return e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?e/1e3+"k":e.toString()}function K(e){return 0===e?"$0":e>=1e6?"$"+e/1e6+"M":e>=1e3?"$"+e/1e3+"k":"$"+e}let $=e=>{var s,t;let{modelName:n,metrics:i,hidePromptCachingMetrics:o=!1}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:i.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:i.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:i.total_tokens.toLocaleString()}),(0,a.jsxs)(y.Z,{children:[Math.round(i.total_tokens/i.total_successful_requests)," avg per successful request"]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(i.total_spend,2)]}),(0,a.jsxs)(y.Z,{children:["$",(0,F.pw)(i.total_spend/i.total_successful_requests,3)," per successful request"]})]})]}),i.top_api_keys&&i.top_api_keys.length>0&&(0,a.jsxs)(l.Z,{className:"mt-4",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys by Spend"}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("div",{className:"grid grid-cols-1 gap-2",children:i.top_api_keys.map((e,s)=>(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium",children:e.key_alias||"".concat(e.api_key.substring(0,10),"...")}),e.team_id&&(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:["Team: ",e.team_id]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsxs)(y.Z,{className:"font-medium",children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:[e.requests.toLocaleString()," requests | ",e.tokens.toLocaleString()," tokens"]})]})]},e.api_key))})})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Requests per day"}),(0,a.jsx)(I,{categories:["metrics.api_requests"],colors:["blue"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.api_requests"],colors:["blue"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Spend per day"}),(0,a.jsx)(I,{categories:["metrics.spend"],colors:["green"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.spend"],colors:["green"],valueFormatter:e=>"$".concat((0,F.pw)(e,2,!0)),yAxisWidth:72})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:Y,stack:!0,customTooltip:z,showLegend:!1})]}),!o&&(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Prompt Caching Metrics"}),(0,a.jsx)(I,{categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"]})]}),(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)(y.Z,{children:["Cache Read: ",(null===(s=i.total_cache_read_input_tokens)||void 0===s?void 0:s.toLocaleString())||0," tokens"]}),(0,a.jsxs)(y.Z,{children:["Cache Creation: ",(null===(t=i.total_cache_creation_input_tokens)||void 0===t?void 0:t.toLocaleString())||0," tokens"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"],valueFormatter:Y,customTooltip:z,showLegend:!1})]})]})]})},P=e=>{let{modelMetrics:s,hidePromptCachingMetrics:t=!1}=e,r=Object.keys(s).sort((e,t)=>""===e?1:""===t?-1:s[t].total_spend-s[e].total_spend),n={total_requests:0,total_successful_requests:0,total_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,daily_data:{}};Object.values(s).forEach(e=>{n.total_requests+=e.total_requests,n.total_successful_requests+=e.total_successful_requests,n.total_tokens+=e.total_tokens,n.total_spend+=e.total_spend,n.total_cache_read_input_tokens+=e.total_cache_read_input_tokens||0,n.total_cache_creation_input_tokens+=e.total_cache_creation_input_tokens||0,e.daily_data.forEach(e=>{n.daily_data[e.date]||(n.daily_data[e.date]={prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,spend:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0}),n.daily_data[e.date].prompt_tokens+=e.metrics.prompt_tokens,n.daily_data[e.date].completion_tokens+=e.metrics.completion_tokens,n.daily_data[e.date].total_tokens+=e.metrics.total_tokens,n.daily_data[e.date].api_requests+=e.metrics.api_requests,n.daily_data[e.date].spend+=e.metrics.spend,n.daily_data[e.date].successful_requests+=e.metrics.successful_requests,n.daily_data[e.date].failed_requests+=e.metrics.failed_requests,n.daily_data[e.date].cache_read_input_tokens+=e.metrics.cache_read_input_tokens||0,n.daily_data[e.date].cache_creation_input_tokens+=e.metrics.cache_creation_input_tokens||0})});let i=Object.entries(n.daily_data).map(e=>{let[s,t]=e;return{date:s,metrics:t}}).sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime());return(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,a.jsx)(v.Z,{children:"Overall Usage"}),(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4 mb-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:n.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:n.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:n.total_tokens.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(n.total_spend,2)]})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens Over Time"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:z,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Requests Over Time"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:z,showLegend:!1})]})]})]}),(0,a.jsx)(V.default,{defaultActiveKey:r[0],children:r.map(e=>(0,a.jsx)(V.default.Panel,{header:(0,a.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,a.jsx)(v.Z,{children:s[e].label||"Unknown Item"}),(0,a.jsxs)("div",{className:"flex space-x-4 text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["$",(0,F.pw)(s[e].total_spend,2)]}),(0,a.jsxs)("span",{children:[s[e].total_requests.toLocaleString()," requests"]})]})]}),children:(0,a.jsx)($,{modelName:e||"Unknown Model",metrics:s[e],hidePromptCachingMetrics:t})},e))})]})},W=(e,s,t)=>{let a=e.metadata.key_alias||"key-hash-".concat(s),r=e.metadata.team_id;if(r){let e=(0,M.o)(r,t);return e?"".concat(a," (team: ").concat(e,")"):"".concat(a," (team_id: ").concat(r,")")}return a},B=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a={};return e.results.forEach(e=>{Object.entries(e.breakdown[s]||{}).forEach(r=>{let[l,n]=r;a[l]||(a[l]={label:"api_keys"===s?W(n,l,t):l,total_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0,prompt_tokens:0,completion_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,top_api_keys:[],daily_data:[]}),a[l].total_requests+=n.metrics.api_requests,a[l].prompt_tokens+=n.metrics.prompt_tokens,a[l].completion_tokens+=n.metrics.completion_tokens,a[l].total_tokens+=n.metrics.total_tokens,a[l].total_spend+=n.metrics.spend,a[l].total_successful_requests+=n.metrics.successful_requests,a[l].total_failed_requests+=n.metrics.failed_requests,a[l].total_cache_read_input_tokens+=n.metrics.cache_read_input_tokens||0,a[l].total_cache_creation_input_tokens+=n.metrics.cache_creation_input_tokens||0,a[l].daily_data.push({date:e.date,metrics:{prompt_tokens:n.metrics.prompt_tokens,completion_tokens:n.metrics.completion_tokens,total_tokens:n.metrics.total_tokens,api_requests:n.metrics.api_requests,spend:n.metrics.spend,successful_requests:n.metrics.successful_requests,failed_requests:n.metrics.failed_requests,cache_read_input_tokens:n.metrics.cache_read_input_tokens||0,cache_creation_input_tokens:n.metrics.cache_creation_input_tokens||0}})})}),"api_keys"!==s&&Object.entries(a).forEach(t=>{let[r,l]=t,n={};e.results.forEach(e=>{var t;let a=null===(t=e.breakdown[s])||void 0===t?void 0:t[r];a&&"api_key_breakdown"in a&&Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[s,t]=e;n[s]||(n[s]={api_key:s,key_alias:t.metadata.key_alias,team_id:t.metadata.team_id,spend:0,requests:0,tokens:0}),n[s].spend+=t.metrics.spend,n[s].requests+=t.metrics.api_requests,n[s].tokens+=t.metrics.total_tokens})}),a[r].top_api_keys=Object.values(n).sort((e,s)=>s.spend-e.spend).slice(0,5)}),Object.values(a).forEach(e=>{e.daily_data.sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime())}),a};var H=t(78489),G=t(94789),J=t(49566),Q=t(10032),X=t(22116),ee=t(37592),es=t(10353),et=t(9114),ea=e=>{let{isOpen:s,onClose:t,accessToken:r}=e,[l]=Q.Z.useForm(),[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(null),[d,u]=(0,Z.useState)(!1),[m,x]=(0,Z.useState)("cloudzero"),[h,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{s&&r&&g()},[s,r]);let g=async()=>{u(!0);try{let e=await fetch("/cloudzero/settings",{method:"GET",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"}});if(e.ok){let s=await e.json();o(s),l.setFieldsValue({connection_id:s.connection_id})}else if(404!==e.status){let s=await e.json();et.Z.fromBackend("Failed to load existing settings: ".concat(s.error||"Unknown error"))}}catch(e){console.error("Error loading CloudZero settings:",e),et.Z.fromBackend("Failed to load existing settings")}finally{u(!1)}},j=async e=>{if(!r){et.Z.fromBackend("No access token available");return}i(!0);try{let s={...e,timezone:"UTC"},t=await fetch(c?"/cloudzero/settings":"/cloudzero/init",{method:c?"PUT":"POST",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(t.ok)return et.Z.success(a.message||"CloudZero settings saved successfully"),o({api_key_masked:e.api_key.substring(0,4)+"****"+e.api_key.slice(-4),connection_id:e.connection_id,status:"configured"}),!0;return et.Z.fromBackend(a.error||"Failed to save CloudZero settings"),!1}catch(e){return console.error("Error saving CloudZero settings:",e),et.Z.fromBackend("Failed to save CloudZero settings"),!1}finally{i(!1)}},f=async()=>{if(!r){et.Z.fromBackend("No access token available");return}p(!0);try{let e=await fetch("/cloudzero/export",{method:"POST",headers:{[(0,N.getGlobalLitellmHeaderName)()]:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify({limit:1e5,operation:"replace_hourly"})}),s=await e.json();e.ok?(et.Z.success(s.message||"Export to CloudZero completed successfully"),t()):et.Z.fromBackend(s.error||"Failed to export to CloudZero")}catch(e){console.error("Error exporting to CloudZero:",e),et.Z.fromBackend("Failed to export to CloudZero")}finally{p(!1)}},_=async()=>{p(!0);try{et.Z.info("CSV export functionality coming soon!"),t()}catch(e){console.error("Error exporting CSV:",e),et.Z.fromBackend("Failed to export CSV")}finally{p(!1)}},v=async()=>{if("cloudzero"===m){if(!c){let e=await l.validateFields();if(!await j(e))return}await f()}else await _()},k=()=>{l.resetFields(),x("cloudzero"),o(null),t()},b=[{value:"cloudzero",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:"/cloudzero.png",alt:"CloudZero",className:"w-5 h-5",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{children:"Export to CloudZero"})]})},{value:"csv",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,a.jsx)("span",{children:"Export to CSV"})]})}];return(0,a.jsx)(X.Z,{title:"Export Data",open:s,onCancel:k,footer:null,width:600,destroyOnClose:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium mb-2 block",children:"Export Destination"}),(0,a.jsx)(ee.default,{value:m,onChange:x,options:b,className:"w-full",size:"large"})]}),"cloudzero"===m&&(0,a.jsx)("div",{children:d?(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)(es.Z,{size:"large"})}):(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsx)(G.Z,{title:"Existing CloudZero Configuration",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),color:"green",className:"mb-4",children:(0,a.jsxs)(y.Z,{children:["API Key: ",c.api_key_masked,(0,a.jsx)("br",{}),"Connection ID: ",c.connection_id]})}),!c&&(0,a.jsxs)(Q.Z,{form:l,layout:"vertical",children:[(0,a.jsx)(Q.Z.Item,{label:"CloudZero API Key",name:"api_key",rules:[{required:!0,message:"Please enter your CloudZero API key"}],children:(0,a.jsx)(J.Z,{type:"password",placeholder:"Enter your CloudZero API key"})}),(0,a.jsx)(Q.Z.Item,{label:"Connection ID",name:"connection_id",rules:[{required:!0,message:"Please enter the CloudZero connection ID"}],children:(0,a.jsx)(J.Z,{placeholder:"Enter CloudZero connection ID"})})]})]})}),"csv"===m&&(0,a.jsx)(G.Z,{title:"CSV Export",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),color:"blue",children:(0,a.jsx)(y.Z,{children:"Export your usage data as a CSV file for analysis in spreadsheet applications."})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2 pt-4",children:[(0,a.jsx)(H.Z,{variant:"secondary",onClick:k,children:"Cancel"}),(0,a.jsx)(H.Z,{onClick:v,loading:n||h,disabled:n||h,children:"cloudzero"===m?"Export to CloudZero":"Export CSV"})]})]})})},er=t(47359),el=t(50337),en=t(5545),ei=e=>{let{value:s,onChange:t}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Format"}),(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-full",options:[{value:"csv",label:"CSV (Excel, Google Sheets)"},{value:"json",label:"JSON (includes metadata)"}]})]})},ec=e=>{var s,t;let{dateRange:r,selectedFilters:l}=e;return(0,a.jsxs)("div",{className:"text-sm text-gray-500",children:[null===(s=r.from)||void 0===s?void 0:s.toLocaleDateString()," - ",null===(t=r.to)||void 0===t?void 0:t.toLocaleDateString(),l.length>0&&" \xb7 ".concat(l.length," filter").concat(l.length>1?"s":"")]})},eo=t(29967),ed=e=>{let{value:s,onChange:t,entityType:r}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Export type"}),(0,a.jsx)(eo.ZP.Group,{value:s,onChange:e=>t(e.target.value),className:"w-full",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Day-by-day breakdown"}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:["Daily metrics for each ",r]})]})]}),(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily_with_models",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsxs)("div",{className:"font-medium text-sm",children:["Day-by-day by ",r," and model"]}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Daily metrics split by model"})]})]})]})})]})},eu=t(15452),em=t.n(eu);let ex=e=>{if(!e)return null;for(let t of Object.values(e)){var s;let e=null==t?void 0:null===(s=t.metadata)||void 0===s?void 0:s.team_id;if(e)return e}return null},eh=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{Object.entries(e.breakdown.entities||{}).forEach(r=>{let[l,n]=r,i=ex(n.api_key_breakdown),c=i&&t[i]||null;a.push({Date:e.date,[s]:c||"-",["".concat(s," ID")]:i||"-","Spend ($)":(0,F.pw)(n.metrics.spend,4),Requests:n.metrics.api_requests,"Successful Requests":n.metrics.successful_requests,"Failed Requests":n.metrics.failed_requests,"Total Tokens":n.metrics.total_tokens,"Prompt Tokens":n.metrics.prompt_tokens||0,"Completion Tokens":n.metrics.completion_tokens||0})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},ep=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{let r={};Object.entries(e.breakdown.entities||{}).forEach(s=>{let[t,a]=s;r[t]||(r[t]={}),Object.entries(e.breakdown.models||{}).forEach(e=>{let[s,l]=e;Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[a,l]=e;r[t][s]||(r[t][s]={spend:0,requests:0,successful:0,failed:0,tokens:0}),r[t][s].spend+=l.metrics.spend||0,r[t][s].requests+=l.metrics.api_requests||0,r[t][s].successful+=l.metrics.successful_requests||0,r[t][s].failed+=l.metrics.failed_requests||0,r[t][s].tokens+=l.metrics.total_tokens||0})})}),Object.entries(r).forEach(r=>{var l;let[n,i]=r,c=null===(l=e.breakdown.entities)||void 0===l?void 0:l[n],o=ex(null==c?void 0:c.api_key_breakdown),d=o&&t[o]||null;Object.entries(i).forEach(t=>{let[r,l]=t;a.push({Date:e.date,[s]:d||"-",["".concat(s," ID")]:o||"-",Model:r,"Spend ($)":(0,F.pw)(l.spend,4),Requests:l.requests,Successful:l.successful,Failed:l.failed,"Total Tokens":l.tokens})})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},eg=function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(s){case"daily":default:return eh(e,t,a);case"daily_with_models":return ep(e,t,a)}},ej=(e,s,t,a,r)=>{var l,n;return{export_date:new Date().toISOString(),entity_type:e,date_range:{from:null===(l=s.from)||void 0===l?void 0:l.toISOString(),to:null===(n=s.to)||void 0===n?void 0:n.toISOString()},filters_applied:t.length>0?t:"None",export_scope:a,summary:{total_spend:r.metadata.total_spend,total_requests:r.metadata.total_api_requests,successful_requests:r.metadata.total_successful_requests,failed_requests:r.metadata.total_failed_requests,total_tokens:r.metadata.total_tokens}}},ef=function(e,s,t,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},l=eg(e,s,t,r),n=new Blob([em().unparse(l)],{type:"text/csv;charset=utf-8;"}),i=window.URL.createObjectURL(n),c=document.createElement("a");c.href=i;let o="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".csv");c.download=o,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)},e_=function(e,s,t,a,r,l){let n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},i=eg(e,s,t,n),c=new Blob([JSON.stringify({metadata:ej(a,r,l,s,e),data:i},null,2)],{type:"application/json"}),o=window.URL.createObjectURL(c),d=document.createElement("a");d.href=o;let u="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".json");d.download=u,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(o)};var ey=e=>{let{isOpen:s,onClose:t,entityType:r,spendData:l,dateRange:n,selectedFilters:i,customTitle:c}=e,[o,d]=(0,Z.useState)("csv"),[u,m]=(0,Z.useState)("daily"),[x,h]=(0,Z.useState)(!1),{data:p,isLoading:g}=(0,er.y2)(),j=r.charAt(0).toUpperCase()+r.slice(1),f=c||"Export ".concat(j," Usage"),_=(0,Z.useMemo)(()=>(0,M.O)(p),[p]),y=async e=>{let s=e||o;h(!0);try{"csv"===s?(ef(l,u,j,r,_),et.Z.success("".concat(j," usage data exported successfully as CSV"))):(e_(l,u,j,r,n,i,_),et.Z.success("".concat(j," usage data exported successfully as JSON"))),t()}catch(e){console.error("Error exporting data:",e),et.Z.fromBackend("Failed to export data")}finally{h(!1)}};return(0,a.jsx)(X.Z,{title:(0,a.jsx)("span",{className:"text-base font-semibold",children:f}),open:s,onCancel:t,footer:null,width:480,children:(0,a.jsxs)("div",{className:"space-y-5 py-2",children:[g?(0,a.jsx)(el.Z,{active:!0}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{dateRange:n,selectedFilters:i}),(0,a.jsx)(ed,{value:u,onChange:m,entityType:r}),(0,a.jsx)(ei,{value:o,onChange:d})]}),g?(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(el.Z.Button,{active:!0}),(0,a.jsx)(el.Z.Button,{active:!0})]}):(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(en.ZP,{variant:"outlined",onClick:t,disabled:x,children:"Cancel"}),(0,a.jsx)(en.ZP,{onClick:()=>y(),loading:x||g,disabled:x||g,type:"primary",children:x?"Exporting...":"Export ".concat(o.toUpperCase())})]})]})})},ev=t(19431),ek=e=>{let{dateValue:s,entityType:t,spendData:r,showFilters:l=!1,filterLabel:n,filterPlaceholder:i,selectedFilters:c=[],onFiltersChange:o,filterOptions:d=[],customTitle:u,compactLayout:m=!1,teams:x=[]}=e,[h,p]=(0,Z.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("div",{className:"grid ".concat(l&&d.length>0?"grid-cols-[1fr_auto]":"grid-cols-[auto]"," items-end gap-4"),children:[l&&d.length>0&&(0,a.jsxs)("div",{children:[n&&(0,a.jsx)(ev.x,{className:"mb-2",children:n}),(0,a.jsx)(ee.default,{mode:"multiple",style:{width:"100%"},placeholder:i,value:c,onChange:o,options:d,allowClear:!0})]}),(0,a.jsx)("div",{className:"justify-self-end",children:(0,a.jsx)(ev.z,{onClick:()=>p(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})})]})}),(0,a.jsx)(ey,{isOpen:h,onClose:()=>p(!1),entityType:t,spendData:r,dateRange:s,selectedFilters:c,customTitle:u,teams:x})]})},eb=t(42673),eZ=t(5540),eN=t(49634),ew=t(77398),eq=t.n(ew);let eS=[{label:"Today",shortLabel:"today",getValue:()=>({from:eq()().startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 7 days",shortLabel:"7d",getValue:()=>({from:eq()().subtract(7,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 30 days",shortLabel:"30d",getValue:()=>({from:eq()().subtract(30,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Month to date",shortLabel:"MTD",getValue:()=>({from:eq()().startOf("month").toDate(),to:eq()().endOf("day").toDate()})},{label:"Year to date",shortLabel:"YTD",getValue:()=>({from:eq()().startOf("year").toDate(),to:eq()().endOf("day").toDate()})}];var eC=e=>{let{value:s,onValueChange:t,label:r="Select Time Range",showTimeRange:l=!0}=e,[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(s),[d,u]=(0,Z.useState)(null),[m,x]=(0,Z.useState)(""),[h,p]=(0,Z.useState)(""),g=(0,Z.useRef)(null),j=(0,Z.useCallback)(e=>{if(!e.from||!e.to)return null;for(let s of eS){let t=s.getValue(),a=eq()(e.from).isSame(eq()(t.from),"day"),r=eq()(e.to).isSame(eq()(t.to),"day");if(a&&r)return s.shortLabel}return null},[]);(0,Z.useEffect)(()=>{u(j(s))},[s,j]);let f=(0,Z.useCallback)(()=>{if(!m||!h)return{isValid:!0,error:""};let e=eq()(m,"YYYY-MM-DD"),s=eq()(h,"YYYY-MM-DD");return e.isValid()&&s.isValid()?s.isBefore(e)?{isValid:!1,error:"End date cannot be before start date"}:{isValid:!0,error:""}:{isValid:!1,error:"Invalid date format"}},[m,h])();(0,Z.useEffect)(()=>{s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),o(s)},[s]),(0,Z.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]);let _=(0,Z.useCallback)((e,s)=>{if(!e||!s)return"Select date range";let t=e=>eq()(e).format("D MMM, HH:mm");return"".concat(t(e)," - ").concat(t(s))},[]),y=(0,Z.useCallback)(e=>{let s;if(!e.from)return e;let t={...e},a=new Date(e.from);return s=new Date(e.to?e.to:e.from),a.toDateString(),s.toDateString(),a.setHours(0,0,0,0),s.setHours(23,59,59,999),t.from=a,t.to=s,t},[]),v=e=>{let{from:s,to:t}=e.getValue();o({from:s,to:t}),u(e.shortLabel),x(eq()(s).format("YYYY-MM-DD")),p(eq()(t).format("YYYY-MM-DD"))},k=(0,Z.useCallback)(()=>{try{if(m&&h&&f.isValid){let e=eq()(m,"YYYY-MM-DD").startOf("day"),s=eq()(h,"YYYY-MM-DD").endOf("day");if(e.isValid()&&s.isValid()){let t={from:e.toDate(),to:s.toDate()};o(t);let a=j(t);u(a)}}}catch(e){console.warn("Invalid date format:",e)}},[m,h,f.isValid,j]);return(0,Z.useEffect)(()=>{k()},[k]),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,a.jsx)(ev.x,{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:r}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[(0,a.jsx)("div",{className:"w-[300px] px-3 py-2 text-sm border border-gray-300 rounded-md bg-white cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",onClick:()=>i(!n),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eZ.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-900",children:_(s.from,s.to)})]}),(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform ".concat(n?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&(0,a.jsx)("div",{className:"absolute top-full right-0 z-[9999] min-w-[600px] mt-1 bg-white border border-gray-200 rounded-lg shadow-xl",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsxs)("div",{className:"w-1/2 border-r border-gray-200",children:[(0,a.jsx)("div",{className:"p-3 border-b border-gray-200",children:(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Relative time"})}),(0,a.jsx)("div",{className:"h-[350px] overflow-y-auto",children:eS.map(e=>{let s=d===e.shortLabel;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 cursor-pointer border-b border-gray-100 transition-colors ".concat(s?"bg-blue-50 hover:bg-blue-100 border-blue-200":"hover:bg-gray-50"),onClick:()=>v(e),children:[(0,a.jsx)("span",{className:"text-sm ".concat(s?"text-blue-700 font-medium":"text-gray-700"),children:e.label}),(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded capitalize ".concat(s?"text-blue-700 bg-blue-100":"text-gray-500 bg-gray-100"),children:e.shortLabel})]},e.label)})})]}),(0,a.jsxs)("div",{className:"w-1/2 relative",children:[(0,a.jsx)("div",{className:"p-3.5 border-b border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eN.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Start and end dates"})]})}),(0,a.jsxs)("div",{className:"p-6 space-y-6 pb-20",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"Start date"}),(0,a.jsx)("input",{type:"date",value:m,onChange:e=>x(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"End date"}),(0,a.jsx)("input",{type:"date",value:h,onChange:e=>p(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),!f.isValid&&f.error&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,a.jsx)("span",{className:"text-sm text-red-700 font-medium",children:f.error})]})}),c.from&&c.to&&f.isValid&&(0,a.jsxs)("div",{className:"bg-blue-50 p-3 rounded-md space-y-1",children:[(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"From:"})," ",eq()(c.from).format("MMM D, YYYY [at] HH:mm:ss")]}),(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"To:"})," ",eq()(c.to).format("MMM D, YYYY [at] HH:mm:ss")]})]})]}),(0,a.jsx)("div",{className:"absolute bottom-4 right-4",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(ev.z,{variant:"secondary",onClick:()=>{o(s),s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),u(j(s)),i(!1)},children:"Cancel"}),(0,a.jsx)(ev.z,{onClick:()=>{c.from&&c.to&&f.isValid&&(t(c),requestIdleCallback(()=>{t(y(c))},{timeout:100}),i(!1))},disabled:!c.from||!c.to||!f.isValid,children:"Apply"})]})})]})]})})]})]})},eT=t(91323);let eD=e=>{let{isDateChanging:s=!1}=e;return(0,a.jsx)("div",{className:"flex items-center justify-center h-40",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)(eT.S,{className:"size-5"}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-gray-600 text-sm font-medium",children:s?"Processing date selection...":"Loading chart data..."}),(0,a.jsx)("span",{className:"text-gray-400 text-xs mt-1",children:s?"This will only take a moment":"Fetching your data"})]})]})})};var eL=t(35829),eE=t(97765),eA=t(99981),eF=e=>{let{accessToken:s,selectedTags:t,formatAbbreviatedNumber:l}=e,[n,i]=(0,Z.useState)({results:[],total_count:0,page:1,page_size:50,total_pages:0}),[c,k]=(0,Z.useState)(!1),[b,w]=(0,Z.useState)(1),q=async()=>{if(s){k(!0);try{let e=await (0,N.perUserAnalyticsCall)(s,b,50,t.length>0?t:void 0);i(e)}catch(e){console.error("Failed to fetch per-user data:",e)}finally{k(!1)}}};return(0,Z.useEffect)(()=>{q()},[s,t,b]),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"Per User Usage"}),(0,a.jsx)(eE.Z,{children:"Individual developer usage metrics"}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"User Details"}),(0,a.jsx)(o.Z,{children:"Usage Distribution"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"User ID"}),(0,a.jsx)(f.Z,{children:"User Email"}),(0,a.jsx)(f.Z,{children:"User Agent"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Success Generations"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Tokens"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Failed Requests"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Cost"})]})}),(0,a.jsx)(p.Z,{children:n.results.slice(0,10).map((e,s)=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{className:"font-medium",children:e.user_id})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_email||"N/A"})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_agent||"Unknown"})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.successful_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.total_tokens)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.failed_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsxs)(y.Z,{children:["$",l(e.spend,4)]})})]},s))})]}),n.results.length>10&&(0,a.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,a.jsxs)(y.Z,{className:"text-sm text-gray-500",children:["Showing 10 of ",n.total_count," results"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b>1&&w(b-1)},disabled:1===b,children:"Previous"}),(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b=n.total_pages,children:"Next"})]})]})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(v.Z,{className:"text-lg",children:"User Usage Distribution"}),(0,a.jsx)(eE.Z,{children:"Number of users by successful request frequency"})]}),(0,a.jsx)(r.Z,{data:(()=>{let e=new Map;n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)});let s=Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s}),t={"1-9 requests":{range:[1,9],agents:{}},"10-99 requests":{range:[10,99],agents:{}},"100-999 requests":{range:[100,999],agents:{}},"1K-9.9K requests":{range:[1e3,9999],agents:{}},"10K-99.9K requests":{range:[1e4,99999],agents:{}},"100K+ requests":{range:[1e5,1/0],agents:{}}};return n.results.forEach(e=>{let a=e.successful_requests,r=e.user_agent||"Unknown";s.includes(r)&&Object.entries(t).forEach(e=>{let[s,t]=e;a>=t.range[0]&&a<=t.range[1]&&(t.agents[r]||(t.agents[r]=0),t.agents[r]++)})}),Object.entries(t).map(e=>{let[t,a]=e,r={category:t};return s.forEach(e=>{r[e]=a.agents[e]||0}),r})})(),index:"category",categories:(()=>{let e=new Map;return n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)}),Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s})})(),colors:["blue","green","orange","red","purple","yellow","pink","indigo"],valueFormatter:e=>"".concat(e," users"),yAxisWidth:80,showLegend:!0,stack:!0})]})]})]})]})},eO=e=>{let{accessToken:s,userRole:t,dateValue:n,onDateChange:i}=e,[h,p]=(0,Z.useState)({results:[]}),[g,j]=(0,Z.useState)({results:[]}),[f,_]=(0,Z.useState)({results:[]}),[k,b]=(0,Z.useState)({results:[]}),[w,q]=(0,Z.useState)(""),[S,C]=(0,Z.useState)([]),[T,D]=(0,Z.useState)([]),[L,E]=(0,Z.useState)(!1),[A,F]=(0,Z.useState)(!1),[O,M]=(0,Z.useState)(!1),[U,V]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(!1),I=new Date,Y=async()=>{if(s){E(!0);try{let e=await (0,N.tagDistinctCall)(s);C(e.results.map(e=>e.tag))}catch(e){console.error("Failed to fetch available tags:",e)}finally{E(!1)}}},K=async()=>{if(s){F(!0);try{let e=await (0,N.tagDauCall)(s,I,w||void 0,T.length>0?T:void 0);p(e)}catch(e){console.error("Failed to fetch DAU data:",e)}finally{F(!1)}}},$=async()=>{if(s){M(!0);try{let e=await (0,N.tagWauCall)(s,I,w||void 0,T.length>0?T:void 0);j(e)}catch(e){console.error("Failed to fetch WAU data:",e)}finally{M(!1)}}},P=async()=>{if(s){V(!0);try{let e=await (0,N.tagMauCall)(s,I,w||void 0,T.length>0?T:void 0);_(e)}catch(e){console.error("Failed to fetch MAU data:",e)}finally{V(!1)}}},W=async()=>{if(s&&n.from&&n.to){z(!0);try{let e=await (0,N.userAgentSummaryCall)(s,n.from,n.to,T.length>0?T:void 0);b(e)}catch(e){console.error("Failed to fetch user agent summary data:",e)}finally{z(!1)}}};(0,Z.useEffect)(()=>{Y()},[s]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{K(),$(),P()},50);return()=>clearTimeout(e)},[s,w,T]),(0,Z.useEffect)(()=>{if(!n.from||!n.to)return;let e=setTimeout(()=>{W()},50);return()=>clearTimeout(e)},[s,n,T]);let B=e=>e.startsWith("User-Agent: ")?e.replace("User-Agent: ",""):e,H=e=>e.length>15?e.substring(0,15)+"...":e,G=e=>Object.entries(e.reduce((e,s)=>(e[s.tag]=(e[s.tag]||0)+s.active_users,e),{})).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).map(e=>{let[s]=e;return s}),J=G(h.results).slice(0,10),Q=G(g.results).slice(0,10),X=G(f.results).slice(0,10),es=(()=>{let e=[],s=new Date;for(let t=6;t>=0;t--){let a=new Date(s);a.setDate(a.getDate()-t);let r={date:a.toISOString().split("T")[0]};J.forEach(e=>{r[B(e)]=0}),e.push(r)}return h.results.forEach(s=>{let t=B(s.tag),a=e.find(e=>e.date===s.date);a&&(a[t]=s.active_users)}),e})(),et=(()=>{let e=[];for(let s=1;s<=7;s++){let t={week:"Week ".concat(s)};Q.forEach(e=>{t[B(e)]=0}),e.push(t)}return g.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Week (\d+)/);if(a){let r="Week ".concat(a[1]),l=e.find(e=>e.week===r);l&&(l[t]=s.active_users)}}),e})(),ea=(()=>{let e=[];for(let s=1;s<=7;s++){let t={month:"Month ".concat(s)};X.forEach(e=>{t[B(e)]=0}),e.push(t)}return f.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Month (\d+)/);if(a){let r="Month ".concat(a[1]),l=e.find(e=>e.month===r);l&&(l[t]=s.active_users)}}),e})(),er=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e>=1e8||e>=1e7||e>=1e6?(e/1e6).toFixed(s)+"M":e>=1e4?(e/1e3).toFixed(s)+"K":e>=1e3?(e/1e3).toFixed(s)+"K":e.toFixed(s)};return(0,a.jsxs)("div",{className:"space-y-6 mt-6",children:[(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v.Z,{children:"Summary by User Agent"}),(0,a.jsx)(eE.Z,{children:"Performance metrics for different user agents"})]}),(0,a.jsxs)("div",{className:"w-96",children:[(0,a.jsx)(y.Z,{className:"text-sm font-medium block mb-2",children:"Filter by User Agents"}),(0,a.jsx)(ee.default,{mode:"multiple",placeholder:"All User Agents",value:T,onChange:D,style:{width:"100%"},showSearch:!0,allowClear:!0,loading:L,optionFilterProp:"label",className:"rounded-md",maxTagCount:"responsive",children:S.map(e=>{let s=B(e),t=s.length>50?"".concat(s.substring(0,50),"..."):s;return(0,a.jsx)(ee.default.Option,{value:e,label:t,title:s,children:t},e)})})]})]}),R?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(k.results||[]).slice(0,4).map((e,s)=>{let t=B(e.tag),r=H(t);return(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(eA.Z,{title:t,placement:"top",children:(0,a.jsx)(v.Z,{className:"truncate",children:r})}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.successful_requests)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.total_tokens)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsxs)(eL.Z,{className:"text-lg",children:["$",er(e.total_spend,4)]})]})]})]},s)}),Array.from({length:Math.max(0,4-(k.results||[]).length)}).map((e,s)=>(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"No Data"}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]})]})]},"empty-".concat(s)))]})]})}),(0,a.jsx)(l.Z,{children:(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU/WAU/MAU"}),(0,a.jsx)(o.Z,{children:"Per User Usage (Last 30 Days)"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"DAU, WAU & MAU per Agent"}),(0,a.jsx)(eE.Z,{children:"Active users across different time periods"})]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU"}),(0,a.jsx)(o.Z,{children:"WAU"}),(0,a.jsx)(o.Z,{children:"MAU"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Daily Active Users - Last 7 Days"})}),A?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:es,index:"date",categories:J.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Weekly Active Users - Last 7 Weeks"})}),O?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:et,index:"week",categories:Q.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Monthly Active Users - Last 7 Months"})}),U?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:ea,index:"month",categories:X.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]})]})]})]}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eF,{accessToken:s,selectedTags:T,formatAbbreviatedNumber:er})})]})]})})]})},eM=t(47375),eU=e=>{let{endpointData:s}=e,t=s||{},n=Z.useMemo(()=>Object.entries(t).map(e=>{let[s,t]=e;return{endpoint:s,"metrics.successful_requests":t.metrics.successful_requests,"metrics.failed_requests":t.metrics.failed_requests,metrics:{successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests}}}),[t]);return(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests by Endpoint"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:n,index:"endpoint",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:z,showLegend:!1,stack:!0,yAxisWidth:60})]})},eV=t(59664),eR=function(e){let{dailyData:s,endpointData:t}=e,r=(0,Z.useMemo)(()=>(null==s?void 0:s.results)&&0!==s.results.length?function(e){let s=[],t=new Set;return e.forEach(e=>{e.breakdown.endpoints&&Object.keys(e.breakdown.endpoints).forEach(e=>t.add(e))}),e.forEach(e=>{let a={date:new Date(e.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})};t.forEach(s=>{var t;let r=null===(t=e.breakdown.endpoints)||void 0===t?void 0:t[s];a[s]=(null==r?void 0:r.metrics.api_requests)||0}),s.push(a)}),s.reverse()}(s.results):[],[s]),n=(0,Z.useMemo)(()=>0===r.length?[]:Object.keys(r[0]).filter(e=>"date"!==e),[r]);return(0,a.jsxs)(l.Z,{className:"mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)(v.Z,{children:"Endpoint Usage Trends"})}),(0,a.jsx)(eV.Z,{className:"h-80",data:r,index:"date",categories:n,colors:["blue","cyan","indigo","violet","purple","fuchsia","pink","rose","red","orange"].slice(0,n.length),valueFormatter:e=>e.toLocaleString(),showLegend:!0,showGridLines:!0,yAxisWidth:60,connectNulls:!0,curveType:"natural"})]})},ez=t(68565),eI=t(56609),eY=e=>{let{endpointData:s}=e,t=(e,s)=>0===s?0:e/s*100,r=Object.entries(s).map(e=>{let[s,a]=e;return{key:s,endpoint:s,successful_requests:a.metrics.successful_requests,failed_requests:a.metrics.failed_requests,api_requests:a.metrics.api_requests,total_tokens:a.metrics.total_tokens,spend:a.metrics.spend,successRate:t(a.metrics.successful_requests,a.metrics.api_requests)}}),l=[{title:"Endpoint",dataIndex:"endpoint",key:"endpoint",render:e=>(0,a.jsx)("span",{className:"font-medium",children:e})},{title:"Successful / Failed",key:"requests",render:(e,s)=>{let t=s.api_requests>0?s.successful_requests/s.api_requests*100:0,r=s.api_requests>0?s.failed_requests/s.api_requests*100:0,l={"0%":"#22c55e"};return t>0&&t<100&&(l["".concat(t,"%")]="#22c55e",l["".concat(t+.01,"%")]="#ef4444"),l["100%"]=r>0?"#ef4444":"#22c55e",(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"flex-1 relative",children:(0,a.jsx)(ez.Z,{percent:t+r,size:"small",strokeColor:l,showInfo:!1})}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-sm min-w-[100px]",children:[(0,a.jsx)("span",{className:"text-green-600 font-medium",children:s.successful_requests.toLocaleString()}),(0,a.jsx)("span",{className:"text-gray-400",children:"/"}),(0,a.jsx)("span",{className:"text-red-600 font-medium",children:s.failed_requests.toLocaleString()})]})]})}},{title:"Total Request",dataIndex:"api_requests",key:"api_requests",render:e=>e.toLocaleString()},{title:"Success Rate",dataIndex:"successRate",key:"successRate",render:e=>{let s=e.toFixed(2);return(0,a.jsxs)("span",{className:e>=95?"text-green-600 font-medium":e>=80?"text-yellow-600 font-medium":"text-red-600 font-medium",children:[s,"%"]})}},{title:"Total Tokens",dataIndex:"total_tokens",key:"total_tokens",render:e=>e.toLocaleString()},{title:"Spend",dataIndex:"spend",key:"spend",render:e=>"$".concat((0,F.pw)(e,2))}];return(0,a.jsx)(eI.Z,{columns:l,dataSource:r,pagination:!1})},eK=e=>{let{userSpendData:s}=e,t=(0,Z.useMemo)(()=>{let e={};return(null==s?void 0:s.results)&&s.results.forEach(s=>{Object.entries(s.breakdown.endpoints||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:a.metadata||{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),e},[s]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(eY,{endpointData:t}),(0,a.jsx)(eU,{endpointData:t}),(0,a.jsx)(eR,{dailyData:s,endpointData:t})]})},e$=t(49282),eP=t(57589),eW=t(60493);function eB(e){let{topModels:s,topModelsLimit:t,setTopModelsLimit:l}=e,[n,i]=(0,Z.useState)("table"),c=s.slice(0,t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:t,onChange:e=>l(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>i("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>i("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===n?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(r.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(c.length,t)},data:c,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:e=>"$".concat((0,F.pw)(e,2)),layout:"vertical",yAxisWidth:200,tickGap:5,showLegend:!1})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(eW.w,{columns:[{header:"Model",accessorKey:"key",cell:e=>e.getValue()||"-"},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return"$".concat((0,F.pw)(s,2))}},{header:"Successful",accessorKey:"successful_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-green-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Failed",accessorKey:"failed_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-red-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Tokens",accessorKey:"tokens",cell:e=>{var s;return(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0}}],data:c,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})})]})}var eH=e=>{let{accessToken:s,entityType:t,entityId:k,entityList:b,dateValue:w}=e,[q,S]=(0,Z.useState)({results:[],metadata:{total_spend:0,total_api_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0}}),{teams:C}=(0,e$.Z)(),T=B(q,"models",C||[]),D=B(q,"api_keys",C||[]),[L,E]=(0,Z.useState)([]),[A,O]=(0,Z.useState)(5),[M,U]=(0,Z.useState)(5),V=async()=>{if(!s||!w.from||!w.to)return;let e=new Date(w.from),a=new Date(w.to);if("tag"===t)S(await (0,N.tagDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("team"===t)S(await (0,N.teamDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("organization"===t)S(await (0,N.organizationDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("customer"===t)S(await (0,N.customerDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("agent"===t)S(await (0,N.agentDailyActivityCall)(s,e,a,1,L.length>0?L:null));else throw Error("Invalid entity type")};(0,Z.useEffect)(()=>{V()},[s,w,k,L]);let R=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={provider:t,spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend,e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens}catch(e){console.error("Error processing provider ".concat(t,": ").concat(e))}})}),Object.values(e).filter(e=>e.spend>0).sort((e,s)=>s.spend-e.spend)},z=(e,s)=>{if(b){let s=b.find(s=>s.value===e);if(s)return s.label}return(null==s?void 0:s.team_alias)?s.team_alias:e},I=e=>0===L.length?e:e.filter(e=>L.includes(e.metadata.id)),Y=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.entities||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{alias:z(t,a.metadata),id:t}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.total_tokens+=a.metrics.total_tokens})}),I(Object.values(e).sort((e,s)=>s.metrics.spend-e.metrics.spend))},$=t.charAt(0).toUpperCase()+t.slice(1);return(0,a.jsxs)("div",{style:{width:"100%"},className:"relative",children:[(0,a.jsx)(ek,{dateValue:w,entityType:t,spendData:q,showFilters:null!==b&&b.length>0,filterLabel:"Filter by ".concat(t),filterPlaceholder:"Select ".concat(t," to filter..."),selectedFilters:L,onFiltersChange:E,filterOptions:(()=>{if(b)return b})()||void 0,teams:C||[]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"agent"===t?"Request / Token Consumption":"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)(v.Z,{children:[$," Spend Overview"]}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Spend"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)(q.metadata.total_spend,2)]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_api_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:q.metadata.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:q.metadata.total_failed_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_tokens.toLocaleString()})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),(0,a.jsx)(r.Z,{data:[...q.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload,l=Object.keys(r.breakdown.entities||{}).length;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Total Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Tokens: ",r.metrics.total_tokens]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total ",$,"s: ",l]}),(0,a.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,a.jsxs)("p",{className:"font-semibold",children:["Spend by ",$,":"]}),Object.entries(r.breakdown.entities||{}).sort((e,s)=>{let[,t]=e,[,a]=s,r=t.metrics.spend;return a.metrics.spend-r}).slice(0,5).map(e=>{let[s,t]=e;return(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[z(s,t.metadata),": $",(0,F.pw)(t.metrics.spend,2)]},s)}),l>5&&(0,a.jsxs)("p",{className:"text-sm text-gray-500 italic",children:["...and ",l-5," more"]})]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsxs)(v.Z,{children:["Spend Per ",$]}),(0,a.jsx)(eE.Z,{className:"text-xs",children:"Showing Top 5 by Spend"}),(0,a.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["Get Started by Tracking cost per ",$," "]}),(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/enterprise#spend-tracking",className:"text-blue-500 hover:text-blue-700 ml-1",children:"here"})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-6",children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(r.Z,{className:"mt-4 h-52",data:Y().slice(0,5).map(e=>({...e,metadata:{...e.metadata,alias_display:e.metadata.alias&&e.metadata.alias.length>15?"".concat(e.metadata.alias.slice(0,15),"..."):e.metadata.alias}})),index:"metadata.alias_display",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",showLegend:!1,yAxisWidth:150,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.metadata.alias}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,4)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.metrics.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.metrics.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens.toLocaleString()]})]})}})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)("div",{className:"h-52 overflow-y-auto",children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:$}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:Y().filter(e=>e.metrics.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:e.metadata.alias}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.metrics.spend,4)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.metrics.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.metrics.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.metrics.total_tokens.toLocaleString()})]},e.metadata.id))})]})})})]})]})})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:(()=>{console.log("debugTags",{spendData:q});let e={};return q.results.forEach(s=>{let{breakdown:t}=s,{entities:a}=t;console.log("debugTags",{entities:a});let r=Object.keys(a).reduce((e,s)=>{let{api_key_breakdown:t}=a[s];return Object.keys(t).forEach(a=>{let r={tag:s,usage:t[a].metrics.spend};e[a]?e[a].push(r):e[a]=[r]}),e},{});console.log("debugTags",{tagDictionary:r}),Object.entries(s.breakdown.api_keys||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:a.metadata.team_id||null,tags:r[t]||[]}},console.log("debugTags",{keySpend:e})),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||"-",spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,A)})(),teams:null,showTags:"tag"===t,topKeysLimit:A,setTopKeysLimit:O})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"agent"===t?"Top Agents":"Top Models"}),(0,a.jsx)(eB,{topModels:(()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.models||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend}catch(e){console.error("Error adding spend for ".concat(t,": ").concat(e,", got metrics: ").concat(JSON.stringify(a)))}e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,...t}}).sort((e,s)=>s.spend-e.spend).slice(0,M)})(),topModelsLimit:M,setTopModelsLimit:U})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsx)(v.Z,{children:"Provider Usage"}),(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:R(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan","blue","indigo","violet","purple"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:R().map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:T,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:D,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:q})})]})]})]})},eG=t(64739),eJ=t(37527),eQ=t(41361),eX=t(40312),e0=t(71891),e1=t(69993),e2=t(48231),e4=t(9775),e5=t(33866);let e6=[{value:"global",label:"Global Usage",showForAdmin:"Global Usage",showForNonAdmin:"Your Usage",description:"View usage across all resources",descriptionForAdmin:"View usage across all resources",descriptionForNonAdmin:"View your usage",icon:(0,a.jsx)(eG.Z,{style:{fontSize:"16px"}})},{value:"organization",label:"Organization Usage",showForAdmin:"Organization Usage",showForNonAdmin:"Your Organization Usage",description:"View organization-level usage",descriptionForAdmin:"View usage across all organizations",descriptionForNonAdmin:"View your organization's usage",icon:(0,a.jsx)(eJ.Z,{style:{fontSize:"16px"}})},{value:"team",label:"Team Usage",description:"View usage by team",icon:(0,a.jsx)(eQ.Z,{style:{fontSize:"16px"}})},{value:"customer",label:"Customer Usage",description:"View usage by customer accounts",icon:(0,a.jsx)(eX.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"tag",label:"Tag Usage",description:"View usage grouped by tags",icon:(0,a.jsx)(e0.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"agent",label:"Agent Usage (A2A)",description:"View usage by AI agents",icon:(0,a.jsx)(e1.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"user-agent-activity",label:"User Agent Activity",description:"View detailed user agent activity logs",icon:(0,a.jsx)(e2.Z,{style:{fontSize:"16px"}}),adminOnly:!0}],e3=e=>{let{value:s,onChange:t,isAdmin:r,title:l="Usage View",description:n="Select the usage data you want to view","data-id":i}=e,c=e6.filter(e=>!e.adminOnly||!!r).map(e=>{let s=e.label,t=e.description;return e.showForAdmin&&e.showForNonAdmin&&(s=r?e.showForAdmin:e.showForNonAdmin),e.descriptionForAdmin&&e.descriptionForNonAdmin&&(t=r?e.descriptionForAdmin:e.descriptionForNonAdmin),{value:e.value,label:s,description:t,icon:e.icon,badgeText:e.badgeText}});return(0,a.jsx)("div",{className:"w-full","data-id":i,children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-4",children:[(0,a.jsxs)("div",{className:"flex items-stretch gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"flex-shrink-0 flex items-center",children:(0,a.jsx)(e4.Z,{style:{fontSize:"32px"}})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-0.5 leading-tight",children:l}),(0,a.jsx)("p",{className:"text-xs text-gray-600 leading-tight",children:n})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-54 sm:w-64 md:w-72",size:"large",options:c.map(e=>({value:e.value,label:e.label})),optionRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:s.icon}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900",children:s.label}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-0.5",children:s.description})]}),s.badgeText&&(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)(e5.Z,{color:"blue",count:s.badgeText})})]}):e.label},labelRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{children:s.icon}),(0,a.jsx)("span",{className:"text-sm",children:s.label})]}):e.label}})})]})})};var e9=e=>{var s,t,w,q,T,L,M,U,V,R,z;let{teams:I,organizations:Y}=e,{accessToken:$,userRole:W,userId:H,premiumUser:G}=(0,C.Z)(),[J,Q]=(0,Z.useState)({results:[],metadata:{}}),[X,ee]=(0,Z.useState)(!1),[es,et]=(0,Z.useState)(!1),er=(0,Z.useMemo)(()=>new Date(Date.now()-6048e5),[]),el=(0,Z.useMemo)(()=>new Date,[]),[en,ei]=(0,Z.useState)({from:er,to:el}),[ec,eo]=(0,Z.useState)([]),{data:ed=[]}=E(),{data:eu}=D(),{data:em}=(0,A.x)();console.log("currentUser: ".concat(JSON.stringify(em))),console.log("currentUser max budget: ".concat(null==em?void 0:em.max_budget));let[ex,eh]=(0,Z.useState)("groups"),[ep,eg]=(0,Z.useState)(!1),[ej,ef]=(0,Z.useState)(!1),[e_,ev]=(0,Z.useState)(!0),[ek,eZ]=(0,Z.useState)(!0),[eN,ew]=(0,Z.useState)("global"),[eq,eS]=(0,Z.useState)(!0),[eT,eL]=(0,Z.useState)(5),[eE,eA]=(0,Z.useState)(5),eF=async()=>{$&&eo(Object.values(await (0,N.tagListCall)($)).map(e=>({label:e.name,value:e.name})))};(0,Z.useEffect)(()=>{eF()},[$]);let eU=(null===(s=J.metadata)||void 0===s?void 0:s.total_spend)||0,eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.models||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},eR=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.model_groups||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},ez=()=>{let e={};return J.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{provider:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}})},eI=(0,Z.useCallback)(async()=>{if(!$||!en.from||!en.to)return;ee(!0);let e=new Date(en.from),s=new Date(en.to);try{try{let t=await (0,N.userDailyActivityAggregatedCall)($,e,s);Q(t);return}catch(e){}let t=await (0,N.userDailyActivityCall)($,e,s);if(t.metadata.total_pages<=1){Q(t);return}let a=[...t.results],r={...t.metadata};for(let l=2;l<=t.metadata.total_pages;l++){let t=await (0,N.userDailyActivityCall)($,e,s,l);a.push(...t.results),t.metadata&&(r.total_spend+=t.metadata.total_spend||0,r.total_api_requests+=t.metadata.total_api_requests||0,r.total_successful_requests+=t.metadata.total_successful_requests||0,r.total_failed_requests+=t.metadata.total_failed_requests||0,r.total_tokens+=t.metadata.total_tokens||0)}Q({results:a,metadata:r})}catch(e){console.error("Error fetching user spend data:",e)}finally{ee(!1),et(!1)}},[$,en.from,en.to]),eY=(0,Z.useCallback)(e=>{et(!0),ee(!0),ei(e)},[]);(0,Z.useEffect)(()=>{if(!en.from||!en.to)return;let e=setTimeout(()=>{eI()},50);return()=>clearTimeout(e)},[eI]);let e$=B(J,"models",I),eW=B(J,"api_keys",I),eB=B(J,"mcp_servers",I);return(0,a.jsxs)("div",{style:{width:"100%"},className:"p-8 relative",children:[(0,a.jsx)("div",{className:"flex items-end justify-between gap-6 mb-6",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-end justify-between gap-6 mb-4 w-full",children:[(0,a.jsx)(e3,{value:eN,onChange:e=>ew(e),isAdmin:S.ZL.includes(W||"")}),(0,a.jsx)(eC,{value:en,onValueChange:eY})]}),"global"===eN&&(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"MCP Server Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsx)(O.z,{onClick:()=>ef(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsxs)(n.Z,{numColSpan:2,children:[(0,a.jsxs)(y.Z,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend"," ",en.from&&en.to&&(0,a.jsxs)(a.Fragment,{children:[en.from.toLocaleDateString("en-US",{month:"short",day:"numeric",year:en.from.getFullYear()!==en.to.getFullYear()?"numeric":void 0})," - ",en.to.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),(0,a.jsx)(eM.Z,{userSpend:eU,selectedTeam:null,userMaxBudget:(null==em?void 0:em.max_budget)||null})]}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Usage Metrics"}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(w=J.metadata)||void 0===w?void 0:null===(t=w.total_api_requests)||void 0===t?void 0:t.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:(null===(T=J.metadata)||void 0===T?void 0:null===(q=T.total_successful_requests)||void 0===q?void 0:q.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:(null===(M=J.metadata)||void 0===M?void 0:null===(L=M.total_failed_requests)||void 0===L?void 0:L.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(V=J.metadata)||void 0===V?void 0:null===(U=V.total_tokens)||void 0===U?void 0:U.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Average Cost per Request"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)((eU||0)/((null===(R=J.metadata)||void 0===R?void 0:R.total_api_requests)||1),4)]})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)(r.Z,{data:[...J.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.api_keys||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:null,tags:a.metadata.tags||[]}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests,s[t].metrics.failed_requests+=a.metrics.failed_requests,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),console.log("debugTags",{keySpend:s,userSpendData:J}),Object.entries(s).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||[],spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,e)}(eT),teams:null,topKeysLimit:eT,setTopKeysLimit:eL})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"groups"===ex?"Top Public Model Names":"Top Litellm Models"}),(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:eE,onChange:e=>eA(e)}),(0,a.jsxs)("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("groups"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("groups"),children:"Public Model Name"}),(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("individual"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("individual"),children:"Litellm Model Name"})]})]}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(()=>{let e="groups"===ex?eR(eE):eV(eE);return(0,a.jsx)(r.Z,{className:"mt-4",style:{height:52*Math.min(e.length,eE)},data:e,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",yAxisWidth:200,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.key}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.tokens.toLocaleString()]})]})}})})()})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(v.Z,{children:"Spend by Provider"})}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:ez(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:ez().filter(e=>e.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:e$})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eW})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eB})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:J})})]})]}),"organization"===eN&&(0,a.jsxs)(a.Fragment,{children:[e_&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Organization usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>ev(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"organization",userID:H,userRole:W,dateValue:en,entityList:(null==Y?void 0:Y.map(e=>({label:e.organization_alias,value:e.organization_id})))||null,premiumUser:G})]}),"team"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"team",userID:H,userRole:W,entityList:(null==I?void 0:I.map(e=>({label:e.team_alias,value:e.team_id})))||null,premiumUser:G,dateValue:en}),"customer"===eN&&(0,a.jsxs)(a.Fragment,{children:[ek&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Customer usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eZ(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"customer",userID:H,userRole:W,entityList:(null==ed?void 0:ed.map(e=>({label:e.alias||e.user_id,value:e.user_id})))||null,premiumUser:G,dateValue:en})]}),"tag"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"tag",userID:H,userRole:W,entityList:ec,premiumUser:G,dateValue:en}),"agent"===eN&&(0,a.jsxs)(a.Fragment,{children:[eq&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Agent usage (A2A) is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eS(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"agent",userID:H,userRole:W,entityList:(null==eu?void 0:null===(z=eu.agents)||void 0===z?void 0:z.map(e=>({label:e.agent_name,value:e.agent_id})))||null,premiumUser:G,dateValue:en})," "]}),"user-agent-activity"===eN&&(0,a.jsx)(eO,{accessToken:$,userRole:W,dateValue:en})]})}),(0,a.jsx)(ea,{isOpen:ep,onClose:()=>eg(!1),accessToken:$}),(0,a.jsx)(ey,{isOpen:ej,onClose:()=>ef(!1),entityType:"team",spendData:{results:J.results,metadata:J.metadata},dateRange:en,selectedFilters:[],customTitle:"Export Usage Data"})]})}},91323:function(e,s,t){t.d(s,{S:function(){return n}});var a=t(57437),r=t(2265),l=t(10012);function n(e){var s,t;let{className:n="",...i}=e,c=(0,r.useId)();return s=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),s=e.find(e=>{var s;return(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))===c}),t=e.find(e=>{var s;return e.effect instanceof KeyframeEffect&&(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))!==c});s&&t&&(s.currentTime=t.currentTime)},t=[c],(0,r.useLayoutEffect)(s,t),(0,a.jsxs)("svg",{"data-spinner-id":c,className:(0,l.cx)("pointer-events-none size-12 animate-spin text-current",n),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}},47375:function(e,s,t){var a=t(57437),r=t(2265),l=t(19250),n=t(59872),i=t(39760);s.Z=e=>{let{userSpend:s,userMaxBudget:t,selectedTeam:c}=e,{accessToken:o,userRole:d,userId:u}=(0,i.Z)(),[m,x]=(0,r.useState)(null!==s?s:0),[h,p]=(0,r.useState)(c?Number((0,n.pw)(c.max_budget,4)):null);(0,r.useEffect)(()=>{if(c){if("Default Team"===c.team_alias)p(t);else{let e=!1;if(c.team_memberships)for(let s of c.team_memberships)s.user_id===u&&"max_budget"in s.litellm_budget_table&&null!==s.litellm_budget_table.max_budget&&(p(s.litellm_budget_table.max_budget),e=!0);e||p(c.max_budget)}}else p(t)},[c,t]);let[g,j]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(!o||!u||!d)return};(async()=>{try{if(null===u||null===d)return;if(null!==o){let e=(await (0,l.modelAvailableCall)(o,u,d)).data.map(e=>e.id);console.log("available_model_names:",e),j(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[d,o,u]),(0,r.useEffect)(()=>{null!==s&&x(s)},[s]);let f=[];c&&c.models&&(f=c.models),f&&f.includes("all-proxy-models")?(console.log("user models:",g),f=g):f&&f.includes("all-team-models")?f=c.models:f&&0===f.length&&(f=g);let _=null!==h?"$".concat((0,n.pw)(Number(h),4)," limit"):"No limit",y=void 0!==m?(0,n.pw)(m,4):null;return console.log("spend in view user spend: ".concat(m)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{className:"flex justify-between gap-x-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total Spend"}),(0,a.jsxs)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:["$",y]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Max Budget"}),(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:_})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4470-ac0eea211b805b56.js b/litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/4470-ac0eea211b805b56.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js index 79c3b8f2b4..5b0b3033d0 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4470-ac0eea211b805b56.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4470],{83669:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},38434:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},8881:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},3632:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41649:function(e,t,n){n.d(t,{Z:function(){return p}});var a=n(5853),o=n(2265),c=n(47187),r=n(7084),l=n(26898),i=n(13241),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),p=o.forwardRef((e,t)=>{let{color:n,icon:p,size:g=r.u8.SM,tooltip:f,className:h,children:b}=e,v=(0,a._T)(e,["color","icon","size","tooltip","className","children"]),x=p||null,{tooltipProps:y,getReferenceProps:k}=(0,c.l)();return o.createElement("span",Object.assign({ref:(0,s.lq)([t,y.refs.setReference]),className:(0,i.q)(u("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",n?(0,i.q)((0,s.bM)(n,l.K.background).bgColor,(0,s.bM)(n,l.K.iconText).textColor,(0,s.bM)(n,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),d[g].paddingX,d[g].paddingY,d[g].fontSize,h)},k,v),o.createElement(c.Z,Object.assign({text:f},y)),x?o.createElement(x,{className:(0,i.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",m[g].height,m[g].width)}):null,o.createElement("span",{className:(0,i.q)(u("text"),"whitespace-nowrap")},b))});p.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var a=n(5853),o=n(2265);let c=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var l=n(13241),i=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=o.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:p,onValueChange:g,onChange:f}=e,h=(0,a._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),b=(0,o.useRef)(null),[v,x]=o.useState(!1),y=o.useCallback(()=>{x(!0)},[]),k=o.useCallback(()=>{x(!1)},[]),[w,C]=o.useState(!1),E=o.useCallback(()=>{C(!0)},[]),S=o.useCallback(()=>{C(!1)},[]);return o.createElement(s.Z,Object.assign({type:"number",ref:(0,i.lq)([b,t]),disabled:p,makeInputClassName:(0,i.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=b.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&S()},onChange:e=>{p||(null==g||g(parseFloat(e.target.value)),null==f||f(e))},stepper:u?o.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepDown(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(r,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepUp(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(c,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(96398),c=n(44140),r=n(2265),l=n(13241),i=n(1153);let s=(0,i.fn)("Textarea"),d=r.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:m="Type...",error:u=!1,errorMessage:p,disabled:g=!1,className:f,onChange:h,onValueChange:b,autoHeight:v=!1}=e,x=(0,a._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,k]=(0,c.Z)(d,n),w=(0,r.useRef)(null),C=(0,o.Uh)(y);return(0,r.useEffect)(()=>{let e=w.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,w,y]),r.createElement(r.Fragment,null,r.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:y,placeholder:m,disabled:g,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,o.um)(C,g,u),g?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",f),"data-testid":"text-area",onChange:e=>{null==h||h(e),k(e.target.value),null==b||b(e.target.value)}},x)),u&&p?r.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},p):null)});d.displayName="Textarea"},67101:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(13241),c=n(1153),r=n(2265),l=n(9496);let i=(0,c.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=r.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:c,numItemsMd:d,numItemsLg:m,children:u,className:p}=e,g=(0,a._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(n,l._m),h=s(c,l.LH),b=s(d,l.l5),v=s(m,l.N4),x=(0,o.q)(f,h,b,v);return r.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",x,p)},g),u)});d.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return r},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return a},_w:function(){return d},l5:function(){return c}});let a={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},r={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},l={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},44140:function(e,t,n){n.d(t,{Z:function(){return o}});var a=n(2265);let o=(e,t)=>{let n=void 0!==t,[o,c]=(0,a.useState)(e);return[n?t:o,e=>{n||c(e)}]}},44851:function(e,t,n){n.d(t,{default:function(){return X}});var a=n(2265),o=n(77565),c=n(36760),r=n.n(c),l=n(1119),i=n(83145),s=n(26365),d=n(41154),m=n(50506),u=n(32559),p=n(6989),g=n(45287),f=n(31686),h=n(11993),b=n(66632),v=n(95814),x=a.forwardRef(function(e,t){var n=e.prefixCls,o=e.forceRender,c=e.className,l=e.style,i=e.children,d=e.isActive,m=e.role,u=e.classNames,p=e.styles,g=a.useState(d||o),f=(0,s.Z)(g,2),b=f[0],v=f[1];return(a.useEffect(function(){(o||d)&&v(!0)},[o,d]),b)?a.createElement("div",{ref:t,className:r()("".concat(n,"-content"),(0,h.Z)((0,h.Z)({},"".concat(n,"-content-active"),d),"".concat(n,"-content-inactive"),!d),c),style:l,role:m},a.createElement("div",{className:r()("".concat(n,"-content-box"),null==u?void 0:u.body),style:null==p?void 0:p.body},i)):null});x.displayName="PanelContent";var y=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],k=a.forwardRef(function(e,t){var n=e.showArrow,o=e.headerClass,c=e.isActive,i=e.onItemClick,s=e.forceRender,d=e.className,m=e.classNames,u=void 0===m?{}:m,g=e.styles,k=void 0===g?{}:g,w=e.prefixCls,C=e.collapsible,E=e.accordion,S=e.panelKey,N=e.extra,Z=e.header,I=e.expandIcon,M=e.openMotion,O=e.destroyInactivePanel,j=e.children,z=(0,p.Z)(e,y),B="disabled"===C,R=(0,h.Z)((0,h.Z)((0,h.Z)({onClick:function(){null==i||i(S)},onKeyDown:function(e){("Enter"===e.key||e.keyCode===v.Z.ENTER||e.which===v.Z.ENTER)&&(null==i||i(S))},role:E?"tab":"button"},"aria-expanded",c),"aria-disabled",B),"tabIndex",B?-1:0),L="function"==typeof I?I(e):a.createElement("i",{className:"arrow"}),P=L&&a.createElement("div",(0,l.Z)({className:"".concat(w,"-expand-icon")},["header","icon"].includes(C)?R:{}),L),H=r()("".concat(w,"-item"),(0,h.Z)((0,h.Z)({},"".concat(w,"-item-active"),c),"".concat(w,"-item-disabled"),B),d),T=r()(o,"".concat(w,"-header"),(0,h.Z)({},"".concat(w,"-collapsible-").concat(C),!!C),u.header),A=(0,f.Z)({className:T,style:k.header},["header","icon"].includes(C)?{}:R);return a.createElement("div",(0,l.Z)({},z,{ref:t,className:H}),a.createElement("div",A,(void 0===n||n)&&P,a.createElement("span",(0,l.Z)({className:"".concat(w,"-header-text")},"header"===C?R:{}),Z),null!=N&&"boolean"!=typeof N&&a.createElement("div",{className:"".concat(w,"-extra")},N)),a.createElement(b.ZP,(0,l.Z)({visible:c,leavedClassName:"".concat(w,"-content-hidden")},M,{forceRender:s,removeOnLeave:O}),function(e,t){var n=e.className,o=e.style;return a.createElement(x,{ref:t,prefixCls:w,className:n,classNames:u,style:o,styles:k,isActive:c,forceRender:s,role:E?"tabpanel":void 0},j)}))}),w=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],C=function(e,t){var n=t.prefixCls,o=t.accordion,c=t.collapsible,r=t.destroyInactivePanel,i=t.onItemClick,s=t.activeKey,d=t.openMotion,m=t.expandIcon;return e.map(function(e,t){var u=e.children,g=e.label,f=e.key,h=e.collapsible,b=e.onItemClick,v=e.destroyInactivePanel,x=(0,p.Z)(e,w),y=String(null!=f?f:t),C=null!=h?h:c,E=!1;return E=o?s[0]===y:s.indexOf(y)>-1,a.createElement(k,(0,l.Z)({},x,{prefixCls:n,key:y,panelKey:y,isActive:E,accordion:o,openMotion:d,expandIcon:m,header:g,collapsible:C,onItemClick:function(e){"disabled"!==C&&(i(e),null==b||b(e))},destroyInactivePanel:null!=v?v:r}),u)})},E=function(e,t,n){if(!e)return null;var o=n.prefixCls,c=n.accordion,r=n.collapsible,l=n.destroyInactivePanel,i=n.onItemClick,s=n.activeKey,d=n.openMotion,m=n.expandIcon,u=e.key||String(t),p=e.props,g=p.header,f=p.headerClass,h=p.destroyInactivePanel,b=p.collapsible,v=p.onItemClick,x=!1;x=c?s[0]===u:s.indexOf(u)>-1;var y=null!=b?b:r,k={key:u,panelKey:u,header:g,headerClass:f,isActive:x,prefixCls:o,destroyInactivePanel:null!=h?h:l,openMotion:d,accordion:c,children:e.props.children,onItemClick:function(e){"disabled"!==y&&(i(e),null==v||v(e))},expandIcon:m,collapsible:y};return"string"==typeof e.type?e:(Object.keys(k).forEach(function(e){void 0===k[e]&&delete k[e]}),a.cloneElement(e,k))},S=n(18242);function N(e){var t=e;if(!Array.isArray(t)){var n=(0,d.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var Z=Object.assign(a.forwardRef(function(e,t){var n,o=e.prefixCls,c=void 0===o?"rc-collapse":o,d=e.destroyInactivePanel,p=e.style,f=e.accordion,h=e.className,b=e.children,v=e.collapsible,x=e.openMotion,y=e.expandIcon,k=e.activeKey,w=e.defaultActiveKey,Z=e.onChange,I=e.items,M=r()(c,h),O=(0,m.Z)([],{value:k,onChange:function(e){return null==Z?void 0:Z(e)},defaultValue:w,postState:N}),j=(0,s.Z)(O,2),z=j[0],B=j[1];(0,u.ZP)(!b,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var R=(n={prefixCls:c,accordion:f,openMotion:x,expandIcon:y,collapsible:v,destroyInactivePanel:void 0!==d&&d,onItemClick:function(e){return B(function(){return f?z[0]===e?[]:[e]:z.indexOf(e)>-1?z.filter(function(t){return t!==e}):[].concat((0,i.Z)(z),[e])})},activeKey:z},Array.isArray(I)?C(I,n):(0,g.Z)(b).map(function(e,t){return E(e,t,n)}));return a.createElement("div",(0,l.Z)({ref:t,className:M,style:p,role:f?"tablist":void 0},(0,S.Z)(e,{aria:!0,data:!0})),R)}),{Panel:k});Z.Panel;var I=n(18694),M=n(68710),O=n(19722),j=n(71744),z=n(33759);let B=a.forwardRef((e,t)=>{let{getPrefixCls:n}=a.useContext(j.E_),{prefixCls:o,className:c,showArrow:l=!0}=e,i=n("collapse",o),s=r()({["".concat(i,"-no-arrow")]:!l},c);return a.createElement(Z.Panel,Object.assign({ref:t},e,{prefixCls:i,className:s}))});var R=n(93463),L=n(12918),P=n(63074),H=n(99320),T=n(71140);let A=e=>{let{componentCls:t,contentBg:n,padding:a,headerBg:o,headerPadding:c,collapseHeaderPaddingSM:r,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:i,lineWidth:s,lineType:d,colorBorder:m,colorText:u,colorTextHeading:p,colorTextDisabled:g,fontSizeLG:f,lineHeight:h,lineHeightLG:b,marginSM:v,paddingSM:x,paddingLG:y,paddingXS:k,motionDurationSlow:w,fontSizeIcon:C,contentPadding:E,fontHeight:S,fontHeightLG:N}=e,Z="".concat((0,R.bf)(s)," ").concat(d," ").concat(m);return{[t]:Object.assign(Object.assign({},(0,L.Wf)(e)),{backgroundColor:o,border:Z,borderRadius:i,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:Z,"&:first-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"".concat((0,R.bf)(i)," ").concat((0,R.bf)(i)," 0 0")}},"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["> ".concat(t,"-header")]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:c,color:p,lineHeight:h,cursor:"pointer",transition:"all ".concat(w,", visibility 0s")},(0,L.Qy)(e)),{["> ".concat(t,"-header-text")]:{flex:"auto"},["".concat(t,"-expand-icon")]:{height:S,display:"flex",alignItems:"center",paddingInlineEnd:v},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,L.Ro)()),{fontSize:C,transition:"transform ".concat(w),svg:{transition:"transform ".concat(w)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}}),["".concat(t,"-collapsible-header")]:{cursor:"default",["".concat(t,"-header-text")]:{flex:"none",cursor:"pointer"},["".concat(t,"-expand-icon")]:{cursor:"pointer"}},["".concat(t,"-collapsible-icon")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:u,backgroundColor:n,borderTop:Z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:r,paddingInlineStart:k,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(x).sub(k).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:f,lineHeight:b,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:a,["> ".concat(t,"-expand-icon")]:{height:N,marginInlineStart:e.calc(y).sub(a).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:y}}},["".concat(t,"-item:last-child")]:{borderBottom:0,["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:g,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:v}}}}})}},V=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},W=e=>{let{componentCls:t,headerBg:n,borderlessContentPadding:a,borderlessContentBg:o,colorBorder:c}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(c)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:o,borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{padding:a}}}},q=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var K=(0,H.I$)("Collapse",e=>{let t=(0,T.IX)(e,{collapseHeaderPaddingSM:"".concat((0,R.bf)(e.paddingXS)," ").concat((0,R.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,R.bf)(e.padding)," ").concat((0,R.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[A(t),W(t),q(t),V(t),(0,P.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer,borderlessContentPadding:"".concat(e.paddingXXS,"px 16px ").concat(e.padding,"px"),borderlessContentBg:"transparent"})),X=Object.assign(a.forwardRef((e,t)=>{let{getPrefixCls:n,direction:c,expandIcon:l,className:i,style:s}=(0,j.dj)("collapse"),{prefixCls:d,className:m,rootClassName:u,style:p,bordered:f=!0,ghost:h,size:b,expandIconPosition:v="start",children:x,destroyInactivePanel:y,destroyOnHidden:k,expandIcon:w}=e,C=(0,z.Z)(e=>{var t;return null!==(t=null!=b?b:e)&&void 0!==t?t:"middle"}),E=n("collapse",d),S=n(),[N,B,R]=K(E),L=a.useMemo(()=>"left"===v?"start":"right"===v?"end":v,[v]),P=null!=w?w:l,H=a.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof P?P(e):a.createElement(o.Z,{rotate:e.isActive?"rtl"===c?-90:90:void 0,"aria-label":e.isActive?"expanded":"collapsed"});return(0,O.Tm)(t,()=>{var e;return{className:r()(null===(e=t.props)||void 0===e?void 0:e.className,"".concat(E,"-arrow"))}})},[P,E,c]),T=r()("".concat(E,"-icon-position-").concat(L),{["".concat(E,"-borderless")]:!f,["".concat(E,"-rtl")]:"rtl"===c,["".concat(E,"-ghost")]:!!h,["".concat(E,"-").concat(C)]:"middle"!==C},i,m,u,B,R),A=a.useMemo(()=>Object.assign(Object.assign({},(0,M.Z)(S)),{motionAppear:!1,leavedClassName:"".concat(E,"-content-hidden")}),[S,E]),V=a.useMemo(()=>x?(0,g.Z)(x).map((e,t)=>{var n,a;let o=e.props;if(null==o?void 0:o.disabled){let c=null!==(n=e.key)&&void 0!==n?n:String(t),r=Object.assign(Object.assign({},(0,I.Z)(e.props,["disabled"])),{key:c,collapsible:null!==(a=o.collapsible)&&void 0!==a?a:"disabled"});return(0,O.Tm)(e,r)}return e}):null,[x]);return N(a.createElement(Z,Object.assign({ref:t,openMotion:A},(0,I.Z)(e,["rootClassName"]),{expandIcon:H,prefixCls:E,className:T,style:Object.assign(Object.assign({},s),p),destroyInactivePanel:null!=k?k:y}),V))}),{Panel:B})},35631:function(e,t,n){n.d(t,{Z:function(){return j}});var a=n(83145),o=n(2265),c=n(36760),r=n.n(c),l=n(53253),i=n(6543),s=n(71744),d=n(91086),m=n(33759),u=n(77774),p=n(28617),g=n(40049),f=n(10353);let h=o.createContext({});h.Consumer;var b=n(19722),v=n(54998),x=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n};let y=o.forwardRef((e,t)=>{let n;let{prefixCls:a,children:c,actions:l,extra:i,styles:d,className:m,classNames:u,colStyle:p}=e,g=x(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:f,itemLayout:y}=(0,o.useContext)(h),{getPrefixCls:k,list:w}=(0,o.useContext)(s.E_),C=e=>{var t,n;return r()(null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.classNames)||void 0===n?void 0:n[e],null==u?void 0:u[e])},E=e=>{var t,n;return Object.assign(Object.assign({},null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.styles)||void 0===n?void 0:n[e]),null==d?void 0:d[e])},S=k("list",a),N=l&&l.length>0&&o.createElement("ul",{className:r()("".concat(S,"-item-action"),C("actions")),key:"actions",style:E("actions")},l.map((e,t)=>o.createElement("li",{key:"".concat(S,"-item-action-").concat(t)},e,t!==l.length-1&&o.createElement("em",{className:"".concat(S,"-item-action-split")})))),Z=o.createElement(f?"div":"li",Object.assign({},g,f?{}:{ref:t},{className:r()("".concat(S,"-item"),{["".concat(S,"-item-no-flex")]:!("vertical"===y?!!i:(n=!1,o.Children.forEach(c,e=>{"string"==typeof e&&(n=!0)}),!(n&&o.Children.count(c)>1)))},m)}),"vertical"===y&&i?[o.createElement("div",{className:"".concat(S,"-item-main"),key:"content"},c,N),o.createElement("div",{className:r()("".concat(S,"-item-extra"),C("extra")),key:"extra",style:E("extra")},i)]:[c,N,(0,b.Tm)(i,{key:"extra"})]);return f?o.createElement(v.Z,{ref:t,flex:1,style:p},Z):Z});y.Meta=e=>{var{prefixCls:t,className:n,avatar:a,title:c,description:l}=e,i=x(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,o.useContext)(s.E_),m=d("list",t),u=r()("".concat(m,"-item-meta"),n),p=o.createElement("div",{className:"".concat(m,"-item-meta-content")},c&&o.createElement("h4",{className:"".concat(m,"-item-meta-title")},c),l&&o.createElement("div",{className:"".concat(m,"-item-meta-description")},l));return o.createElement("div",Object.assign({},i,{className:u}),a&&o.createElement("div",{className:"".concat(m,"-item-meta-avatar")},a),(c||l)&&p)};var k=n(93463),w=n(12918),C=n(99320),E=n(71140);let S=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:a,margin:o,itemPaddingSM:c,itemPaddingLG:r,marginLG:l,borderRadiusLG:i}=e,s=(0,k.bf)(e.calc(i).sub(e.lineWidth).equal());return{[t]:{border:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:i,["".concat(n,"-header")]:{borderRadius:"".concat(s," ").concat(s," 0 0")},["".concat(n,"-footer")]:{borderRadius:"0 0 ".concat(s," ").concat(s)},["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:a},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(o)," ").concat((0,k.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:c}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:r}}}},N=e=>{let{componentCls:t,screenSM:n,screenMD:a,marginLG:o,marginSM:c,margin:r}=e;return{["@media screen and (max-width:".concat(a,"px)")]:{[t]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:o}}}},["@media screen and (max-width: ".concat(n,"px)")]:{[t]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:c}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(r))}}}}}},Z=e=>{let{componentCls:t,antCls:n,controlHeight:a,minHeight:o,paddingSM:c,marginLG:r,padding:l,itemPadding:i,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:m,paddingXS:u,margin:p,colorText:g,colorTextDescription:f,motionDurationSlow:h,lineWidth:b,headerBg:v,footerBg:x,emptyTextPadding:y,metaMarginBottom:C,avatarMarginRight:E,titleMarginBottom:S,descriptionFontSize:N}=e;return{[t]:Object.assign(Object.assign({},(0,w.Wf)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},["".concat(t,"-header")]:{background:v},["".concat(t,"-footer")]:{background:x},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:c},["".concat(t,"-pagination")]:{marginBlockStart:r,["".concat(n,"-pagination-options")]:{textAlign:"start"}},["".concat(t,"-spin")]:{minHeight:o,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:i,color:g,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:g},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(e.marginXXS)," 0"),color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:g,transition:"all ".concat(h),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:f,fontSize:N,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(u)),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:b,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,k.bf)(l)," 0"),color:f,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:y,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:r},["".concat(t,"-item-meta")]:{marginBlockEnd:C,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:S,color:g,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:a},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:m},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var I=(0,C.I$)("List",e=>{let t=(0,E.IX)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[Z(t),S(t),N(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(e.paddingContentVerticalSM)," ").concat((0,k.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(e.paddingContentVerticalLG)," ").concat((0,k.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),M=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n};let O=o.forwardRef(function(e,t){let{pagination:n=!1,prefixCls:c,bordered:b=!1,split:v=!0,className:x,rootClassName:y,style:k,children:w,itemLayout:C,loadMore:E,grid:S,dataSource:N=[],size:Z,header:O,footer:j,loading:z=!1,rowKey:B,renderItem:R,locale:L}=e,P=M(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),H=n&&"object"==typeof n?n:{},[T,A]=o.useState(H.defaultCurrent||1),[V,W]=o.useState(H.defaultPageSize||10),{getPrefixCls:q,direction:K,className:X,style:_}=(0,s.dj)("list"),{renderEmpty:D}=o.useContext(s.E_),G=e=>(t,a)=>{var o;A(t),W(a),n&&(null===(o=null==n?void 0:n[e])||void 0===o||o.call(n,t,a))},U=G("onChange"),Y=G("onShowSizeChange"),F=!!(E||n||j),J=q("list",c),[$,Q,ee]=I(J),et=z;"boolean"==typeof et&&(et={spinning:et});let en=!!(null==et?void 0:et.spinning),ea=(0,m.Z)(Z),eo="";switch(ea){case"large":eo="lg";break;case"small":eo="sm"}let ec=r()(J,{["".concat(J,"-vertical")]:"vertical"===C,["".concat(J,"-").concat(eo)]:eo,["".concat(J,"-split")]:v,["".concat(J,"-bordered")]:b,["".concat(J,"-loading")]:en,["".concat(J,"-grid")]:!!S,["".concat(J,"-something-after-last-item")]:F,["".concat(J,"-rtl")]:"rtl"===K},X,x,y,Q,ee),er=(0,l.Z)({current:1,total:0,position:"bottom"},{total:N.length,current:T,pageSize:V},n||{}),el=Math.ceil(er.total/er.pageSize);er.current=Math.min(er.current,el);let ei=n&&o.createElement("div",{className:r()("".concat(J,"-pagination"))},o.createElement(g.Z,Object.assign({align:"end"},er,{onChange:U,onShowSizeChange:Y}))),es=(0,a.Z)(N);n&&N.length>(er.current-1)*er.pageSize&&(es=(0,a.Z)(N).splice((er.current-1)*er.pageSize,er.pageSize));let ed=Object.keys(S||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),em=(0,p.Z)(ed),eu=o.useMemo(()=>{for(let e=0;e{if(!S)return;let e=eu&&S[eu]?S[eu]:S.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[JSON.stringify(S),eu]),eg=en&&o.createElement("div",{style:{minHeight:53}});if(es.length>0){let e=es.map((e,t)=>{let n;return R?((n="function"==typeof B?B(e):B?e[B]:e.key)||(n="list-item-".concat(t)),o.createElement(o.Fragment,{key:n},R(e,t))):null});eg=S?o.createElement(u.Z,{gutter:S.gutter},o.Children.map(e,e=>o.createElement("div",{key:null==e?void 0:e.key,style:ep},e))):o.createElement("ul",{className:"".concat(J,"-items")},e)}else w||en||(eg=o.createElement("div",{className:"".concat(J,"-empty-text")},(null==L?void 0:L.emptyText)||(null==D?void 0:D("List"))||o.createElement(d.Z,{componentName:"List"})));let ef=er.position,eh=o.useMemo(()=>({grid:S,itemLayout:C}),[JSON.stringify(S),C]);return $(o.createElement(h.Provider,{value:eh},o.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},_),k),className:ec},P),("top"===ef||"both"===ef)&&ei,O&&o.createElement("div",{className:"".concat(J,"-header")},O),o.createElement(f.Z,Object.assign({},et),eg,w),j&&o.createElement("div",{className:"".concat(J,"-footer")},j),E||("bottom"===ef||"both"===ef)&&ei)))});O.Item=y;var j=O},30401:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},77331:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=o},86462:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=o},44633:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=o},74998:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});t.Z=o}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4470],{83669:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},38434:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},8881:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},3632:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41649:function(e,t,n){n.d(t,{Z:function(){return p}});var a=n(5853),o=n(2265),c=n(47187),r=n(7084),l=n(26898),i=n(13241),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),p=o.forwardRef((e,t)=>{let{color:n,icon:p,size:g=r.u8.SM,tooltip:f,className:h,children:b}=e,v=(0,a._T)(e,["color","icon","size","tooltip","className","children"]),x=p||null,{tooltipProps:y,getReferenceProps:k}=(0,c.l)();return o.createElement("span",Object.assign({ref:(0,s.lq)([t,y.refs.setReference]),className:(0,i.q)(u("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",n?(0,i.q)((0,s.bM)(n,l.K.background).bgColor,(0,s.bM)(n,l.K.iconText).textColor,(0,s.bM)(n,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),d[g].paddingX,d[g].paddingY,d[g].fontSize,h)},k,v),o.createElement(c.Z,Object.assign({text:f},y)),x?o.createElement(x,{className:(0,i.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",m[g].height,m[g].width)}):null,o.createElement("span",{className:(0,i.q)(u("text"),"whitespace-nowrap")},b))});p.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var a=n(5853),o=n(2265);let c=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var l=n(13241),i=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=o.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:p,onValueChange:g,onChange:f}=e,h=(0,a._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),b=(0,o.useRef)(null),[v,x]=o.useState(!1),y=o.useCallback(()=>{x(!0)},[]),k=o.useCallback(()=>{x(!1)},[]),[w,C]=o.useState(!1),E=o.useCallback(()=>{C(!0)},[]),S=o.useCallback(()=>{C(!1)},[]);return o.createElement(s.Z,Object.assign({type:"number",ref:(0,i.lq)([b,t]),disabled:p,makeInputClassName:(0,i.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=b.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&S()},onChange:e=>{p||(null==g||g(parseFloat(e.target.value)),null==f||f(e))},stepper:u?o.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepDown(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(r,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepUp(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(c,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(96398),c=n(44140),r=n(2265),l=n(13241),i=n(1153);let s=(0,i.fn)("Textarea"),d=r.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:m="Type...",error:u=!1,errorMessage:p,disabled:g=!1,className:f,onChange:h,onValueChange:b,autoHeight:v=!1}=e,x=(0,a._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,k]=(0,c.Z)(d,n),w=(0,r.useRef)(null),C=(0,o.Uh)(y);return(0,r.useEffect)(()=>{let e=w.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,w,y]),r.createElement(r.Fragment,null,r.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:y,placeholder:m,disabled:g,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,o.um)(C,g,u),g?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",f),"data-testid":"text-area",onChange:e=>{null==h||h(e),k(e.target.value),null==b||b(e.target.value)}},x)),u&&p?r.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},p):null)});d.displayName="Textarea"},67101:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(13241),c=n(1153),r=n(2265),l=n(9496);let i=(0,c.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=r.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:c,numItemsMd:d,numItemsLg:m,children:u,className:p}=e,g=(0,a._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(n,l._m),h=s(c,l.LH),b=s(d,l.l5),v=s(m,l.N4),x=(0,o.q)(f,h,b,v);return r.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",x,p)},g),u)});d.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return r},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return a},_w:function(){return d},l5:function(){return c}});let a={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},c={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},r={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},l={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},44140:function(e,t,n){n.d(t,{Z:function(){return o}});var a=n(2265);let o=(e,t)=>{let n=void 0!==t,[o,c]=(0,a.useState)(e);return[n?t:o,e=>{n||c(e)}]}},44851:function(e,t,n){n.d(t,{default:function(){return X}});var a=n(2265),o=n(77565),c=n(36760),r=n.n(c),l=n(1119),i=n(83145),s=n(26365),d=n(41154),m=n(50506),u=n(32559),p=n(6989),g=n(45287),f=n(31686),h=n(11993),b=n(66632),v=n(95814),x=a.forwardRef(function(e,t){var n=e.prefixCls,o=e.forceRender,c=e.className,l=e.style,i=e.children,d=e.isActive,m=e.role,u=e.classNames,p=e.styles,g=a.useState(d||o),f=(0,s.Z)(g,2),b=f[0],v=f[1];return(a.useEffect(function(){(o||d)&&v(!0)},[o,d]),b)?a.createElement("div",{ref:t,className:r()("".concat(n,"-content"),(0,h.Z)((0,h.Z)({},"".concat(n,"-content-active"),d),"".concat(n,"-content-inactive"),!d),c),style:l,role:m},a.createElement("div",{className:r()("".concat(n,"-content-box"),null==u?void 0:u.body),style:null==p?void 0:p.body},i)):null});x.displayName="PanelContent";var y=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],k=a.forwardRef(function(e,t){var n=e.showArrow,o=e.headerClass,c=e.isActive,i=e.onItemClick,s=e.forceRender,d=e.className,m=e.classNames,u=void 0===m?{}:m,g=e.styles,k=void 0===g?{}:g,w=e.prefixCls,C=e.collapsible,E=e.accordion,S=e.panelKey,N=e.extra,Z=e.header,I=e.expandIcon,M=e.openMotion,O=e.destroyInactivePanel,j=e.children,z=(0,p.Z)(e,y),B="disabled"===C,R=(0,h.Z)((0,h.Z)((0,h.Z)({onClick:function(){null==i||i(S)},onKeyDown:function(e){("Enter"===e.key||e.keyCode===v.Z.ENTER||e.which===v.Z.ENTER)&&(null==i||i(S))},role:E?"tab":"button"},"aria-expanded",c),"aria-disabled",B),"tabIndex",B?-1:0),L="function"==typeof I?I(e):a.createElement("i",{className:"arrow"}),P=L&&a.createElement("div",(0,l.Z)({className:"".concat(w,"-expand-icon")},["header","icon"].includes(C)?R:{}),L),H=r()("".concat(w,"-item"),(0,h.Z)((0,h.Z)({},"".concat(w,"-item-active"),c),"".concat(w,"-item-disabled"),B),d),T=r()(o,"".concat(w,"-header"),(0,h.Z)({},"".concat(w,"-collapsible-").concat(C),!!C),u.header),A=(0,f.Z)({className:T,style:k.header},["header","icon"].includes(C)?{}:R);return a.createElement("div",(0,l.Z)({},z,{ref:t,className:H}),a.createElement("div",A,(void 0===n||n)&&P,a.createElement("span",(0,l.Z)({className:"".concat(w,"-header-text")},"header"===C?R:{}),Z),null!=N&&"boolean"!=typeof N&&a.createElement("div",{className:"".concat(w,"-extra")},N)),a.createElement(b.ZP,(0,l.Z)({visible:c,leavedClassName:"".concat(w,"-content-hidden")},M,{forceRender:s,removeOnLeave:O}),function(e,t){var n=e.className,o=e.style;return a.createElement(x,{ref:t,prefixCls:w,className:n,classNames:u,style:o,styles:k,isActive:c,forceRender:s,role:E?"tabpanel":void 0},j)}))}),w=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],C=function(e,t){var n=t.prefixCls,o=t.accordion,c=t.collapsible,r=t.destroyInactivePanel,i=t.onItemClick,s=t.activeKey,d=t.openMotion,m=t.expandIcon;return e.map(function(e,t){var u=e.children,g=e.label,f=e.key,h=e.collapsible,b=e.onItemClick,v=e.destroyInactivePanel,x=(0,p.Z)(e,w),y=String(null!=f?f:t),C=null!=h?h:c,E=!1;return E=o?s[0]===y:s.indexOf(y)>-1,a.createElement(k,(0,l.Z)({},x,{prefixCls:n,key:y,panelKey:y,isActive:E,accordion:o,openMotion:d,expandIcon:m,header:g,collapsible:C,onItemClick:function(e){"disabled"!==C&&(i(e),null==b||b(e))},destroyInactivePanel:null!=v?v:r}),u)})},E=function(e,t,n){if(!e)return null;var o=n.prefixCls,c=n.accordion,r=n.collapsible,l=n.destroyInactivePanel,i=n.onItemClick,s=n.activeKey,d=n.openMotion,m=n.expandIcon,u=e.key||String(t),p=e.props,g=p.header,f=p.headerClass,h=p.destroyInactivePanel,b=p.collapsible,v=p.onItemClick,x=!1;x=c?s[0]===u:s.indexOf(u)>-1;var y=null!=b?b:r,k={key:u,panelKey:u,header:g,headerClass:f,isActive:x,prefixCls:o,destroyInactivePanel:null!=h?h:l,openMotion:d,accordion:c,children:e.props.children,onItemClick:function(e){"disabled"!==y&&(i(e),null==v||v(e))},expandIcon:m,collapsible:y};return"string"==typeof e.type?e:(Object.keys(k).forEach(function(e){void 0===k[e]&&delete k[e]}),a.cloneElement(e,k))},S=n(18242);function N(e){var t=e;if(!Array.isArray(t)){var n=(0,d.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var Z=Object.assign(a.forwardRef(function(e,t){var n,o=e.prefixCls,c=void 0===o?"rc-collapse":o,d=e.destroyInactivePanel,p=e.style,f=e.accordion,h=e.className,b=e.children,v=e.collapsible,x=e.openMotion,y=e.expandIcon,k=e.activeKey,w=e.defaultActiveKey,Z=e.onChange,I=e.items,M=r()(c,h),O=(0,m.Z)([],{value:k,onChange:function(e){return null==Z?void 0:Z(e)},defaultValue:w,postState:N}),j=(0,s.Z)(O,2),z=j[0],B=j[1];(0,u.ZP)(!b,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var R=(n={prefixCls:c,accordion:f,openMotion:x,expandIcon:y,collapsible:v,destroyInactivePanel:void 0!==d&&d,onItemClick:function(e){return B(function(){return f?z[0]===e?[]:[e]:z.indexOf(e)>-1?z.filter(function(t){return t!==e}):[].concat((0,i.Z)(z),[e])})},activeKey:z},Array.isArray(I)?C(I,n):(0,g.Z)(b).map(function(e,t){return E(e,t,n)}));return a.createElement("div",(0,l.Z)({ref:t,className:M,style:p,role:f?"tablist":void 0},(0,S.Z)(e,{aria:!0,data:!0})),R)}),{Panel:k});Z.Panel;var I=n(18694),M=n(68710),O=n(19722),j=n(71744),z=n(33759);let B=a.forwardRef((e,t)=>{let{getPrefixCls:n}=a.useContext(j.E_),{prefixCls:o,className:c,showArrow:l=!0}=e,i=n("collapse",o),s=r()({["".concat(i,"-no-arrow")]:!l},c);return a.createElement(Z.Panel,Object.assign({ref:t},e,{prefixCls:i,className:s}))});var R=n(93463),L=n(12918),P=n(63074),H=n(99320),T=n(71140);let A=e=>{let{componentCls:t,contentBg:n,padding:a,headerBg:o,headerPadding:c,collapseHeaderPaddingSM:r,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:i,lineWidth:s,lineType:d,colorBorder:m,colorText:u,colorTextHeading:p,colorTextDisabled:g,fontSizeLG:f,lineHeight:h,lineHeightLG:b,marginSM:v,paddingSM:x,paddingLG:y,paddingXS:k,motionDurationSlow:w,fontSizeIcon:C,contentPadding:E,fontHeight:S,fontHeightLG:N}=e,Z="".concat((0,R.bf)(s)," ").concat(d," ").concat(m);return{[t]:Object.assign(Object.assign({},(0,L.Wf)(e)),{backgroundColor:o,border:Z,borderRadius:i,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:Z,"&:first-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"".concat((0,R.bf)(i)," ").concat((0,R.bf)(i)," 0 0")}},"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["> ".concat(t,"-header")]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:c,color:p,lineHeight:h,cursor:"pointer",transition:"all ".concat(w,", visibility 0s")},(0,L.Qy)(e)),{["> ".concat(t,"-header-text")]:{flex:"auto"},["".concat(t,"-expand-icon")]:{height:S,display:"flex",alignItems:"center",paddingInlineEnd:v},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,L.Ro)()),{fontSize:C,transition:"transform ".concat(w),svg:{transition:"transform ".concat(w)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}}),["".concat(t,"-collapsible-header")]:{cursor:"default",["".concat(t,"-header-text")]:{flex:"none",cursor:"pointer"},["".concat(t,"-expand-icon")]:{cursor:"pointer"}},["".concat(t,"-collapsible-icon")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:u,backgroundColor:n,borderTop:Z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:r,paddingInlineStart:k,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(x).sub(k).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:f,lineHeight:b,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:a,["> ".concat(t,"-expand-icon")]:{height:N,marginInlineStart:e.calc(y).sub(a).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:y}}},["".concat(t,"-item:last-child")]:{borderBottom:0,["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:g,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:v}}}}})}},V=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},W=e=>{let{componentCls:t,headerBg:n,borderlessContentPadding:a,borderlessContentBg:o,colorBorder:c}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(c)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:o,borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{padding:a}}}},q=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var K=(0,H.I$)("Collapse",e=>{let t=(0,T.IX)(e,{collapseHeaderPaddingSM:"".concat((0,R.bf)(e.paddingXS)," ").concat((0,R.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,R.bf)(e.padding)," ").concat((0,R.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[A(t),W(t),q(t),V(t),(0,P.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer,borderlessContentPadding:"".concat(e.paddingXXS,"px 16px ").concat(e.padding,"px"),borderlessContentBg:"transparent"})),X=Object.assign(a.forwardRef((e,t)=>{let{getPrefixCls:n,direction:c,expandIcon:l,className:i,style:s}=(0,j.dj)("collapse"),{prefixCls:d,className:m,rootClassName:u,style:p,bordered:f=!0,ghost:h,size:b,expandIconPosition:v="start",children:x,destroyInactivePanel:y,destroyOnHidden:k,expandIcon:w}=e,C=(0,z.Z)(e=>{var t;return null!==(t=null!=b?b:e)&&void 0!==t?t:"middle"}),E=n("collapse",d),S=n(),[N,B,R]=K(E),L=a.useMemo(()=>"left"===v?"start":"right"===v?"end":v,[v]),P=null!=w?w:l,H=a.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof P?P(e):a.createElement(o.Z,{rotate:e.isActive?"rtl"===c?-90:90:void 0,"aria-label":e.isActive?"expanded":"collapsed"});return(0,O.Tm)(t,()=>{var e;return{className:r()(null===(e=t.props)||void 0===e?void 0:e.className,"".concat(E,"-arrow"))}})},[P,E,c]),T=r()("".concat(E,"-icon-position-").concat(L),{["".concat(E,"-borderless")]:!f,["".concat(E,"-rtl")]:"rtl"===c,["".concat(E,"-ghost")]:!!h,["".concat(E,"-").concat(C)]:"middle"!==C},i,m,u,B,R),A=a.useMemo(()=>Object.assign(Object.assign({},(0,M.Z)(S)),{motionAppear:!1,leavedClassName:"".concat(E,"-content-hidden")}),[S,E]),V=a.useMemo(()=>x?(0,g.Z)(x).map((e,t)=>{var n,a;let o=e.props;if(null==o?void 0:o.disabled){let c=null!==(n=e.key)&&void 0!==n?n:String(t),r=Object.assign(Object.assign({},(0,I.Z)(e.props,["disabled"])),{key:c,collapsible:null!==(a=o.collapsible)&&void 0!==a?a:"disabled"});return(0,O.Tm)(e,r)}return e}):null,[x]);return N(a.createElement(Z,Object.assign({ref:t,openMotion:A},(0,I.Z)(e,["rootClassName"]),{expandIcon:H,prefixCls:E,className:T,style:Object.assign(Object.assign({},s),p),destroyInactivePanel:null!=k?k:y}),V))}),{Panel:B})},35631:function(e,t,n){n.d(t,{Z:function(){return j}});var a=n(83145),o=n(2265),c=n(36760),r=n.n(c),l=n(53253),i=n(6543),s=n(71744),d=n(91086),m=n(33759),u=n(77774),p=n(28617),g=n(40049),f=n(10353);let h=o.createContext({});h.Consumer;var b=n(19722),v=n(54998),x=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n};let y=o.forwardRef((e,t)=>{let n;let{prefixCls:a,children:c,actions:l,extra:i,styles:d,className:m,classNames:u,colStyle:p}=e,g=x(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:f,itemLayout:y}=(0,o.useContext)(h),{getPrefixCls:k,list:w}=(0,o.useContext)(s.E_),C=e=>{var t,n;return r()(null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.classNames)||void 0===n?void 0:n[e],null==u?void 0:u[e])},E=e=>{var t,n;return Object.assign(Object.assign({},null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.styles)||void 0===n?void 0:n[e]),null==d?void 0:d[e])},S=k("list",a),N=l&&l.length>0&&o.createElement("ul",{className:r()("".concat(S,"-item-action"),C("actions")),key:"actions",style:E("actions")},l.map((e,t)=>o.createElement("li",{key:"".concat(S,"-item-action-").concat(t)},e,t!==l.length-1&&o.createElement("em",{className:"".concat(S,"-item-action-split")})))),Z=o.createElement(f?"div":"li",Object.assign({},g,f?{}:{ref:t},{className:r()("".concat(S,"-item"),{["".concat(S,"-item-no-flex")]:!("vertical"===y?!!i:(n=!1,o.Children.forEach(c,e=>{"string"==typeof e&&(n=!0)}),!(n&&o.Children.count(c)>1)))},m)}),"vertical"===y&&i?[o.createElement("div",{className:"".concat(S,"-item-main"),key:"content"},c,N),o.createElement("div",{className:r()("".concat(S,"-item-extra"),C("extra")),key:"extra",style:E("extra")},i)]:[c,N,(0,b.Tm)(i,{key:"extra"})]);return f?o.createElement(v.Z,{ref:t,flex:1,style:p},Z):Z});y.Meta=e=>{var{prefixCls:t,className:n,avatar:a,title:c,description:l}=e,i=x(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,o.useContext)(s.E_),m=d("list",t),u=r()("".concat(m,"-item-meta"),n),p=o.createElement("div",{className:"".concat(m,"-item-meta-content")},c&&o.createElement("h4",{className:"".concat(m,"-item-meta-title")},c),l&&o.createElement("div",{className:"".concat(m,"-item-meta-description")},l));return o.createElement("div",Object.assign({},i,{className:u}),a&&o.createElement("div",{className:"".concat(m,"-item-meta-avatar")},a),(c||l)&&p)};var k=n(93463),w=n(12918),C=n(99320),E=n(71140);let S=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:a,margin:o,itemPaddingSM:c,itemPaddingLG:r,marginLG:l,borderRadiusLG:i}=e,s=(0,k.bf)(e.calc(i).sub(e.lineWidth).equal());return{[t]:{border:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:i,["".concat(n,"-header")]:{borderRadius:"".concat(s," ").concat(s," 0 0")},["".concat(n,"-footer")]:{borderRadius:"0 0 ".concat(s," ").concat(s)},["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:a},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(o)," ").concat((0,k.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:c}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:r}}}},N=e=>{let{componentCls:t,screenSM:n,screenMD:a,marginLG:o,marginSM:c,margin:r}=e;return{["@media screen and (max-width:".concat(a,"px)")]:{[t]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:o}}}},["@media screen and (max-width: ".concat(n,"px)")]:{[t]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:c}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(r))}}}}}},Z=e=>{let{componentCls:t,antCls:n,controlHeight:a,minHeight:o,paddingSM:c,marginLG:r,padding:l,itemPadding:i,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:m,paddingXS:u,margin:p,colorText:g,colorTextDescription:f,motionDurationSlow:h,lineWidth:b,headerBg:v,footerBg:x,emptyTextPadding:y,metaMarginBottom:C,avatarMarginRight:E,titleMarginBottom:S,descriptionFontSize:N}=e;return{[t]:Object.assign(Object.assign({},(0,w.Wf)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},["".concat(t,"-header")]:{background:v},["".concat(t,"-footer")]:{background:x},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:c},["".concat(t,"-pagination")]:{marginBlockStart:r,["".concat(n,"-pagination-options")]:{textAlign:"start"}},["".concat(t,"-spin")]:{minHeight:o,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:i,color:g,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:g},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(e.marginXXS)," 0"),color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:g,transition:"all ".concat(h),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:f,fontSize:N,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(u)),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:b,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,k.bf)(l)," 0"),color:f,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:y,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:r},["".concat(t,"-item-meta")]:{marginBlockEnd:C,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:S,color:g,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:a},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:m},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var I=(0,C.I$)("List",e=>{let t=(0,E.IX)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[Z(t),S(t),N(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(e.paddingContentVerticalSM)," ").concat((0,k.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(e.paddingContentVerticalLG)," ").concat((0,k.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),M=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n};let O=o.forwardRef(function(e,t){let{pagination:n=!1,prefixCls:c,bordered:b=!1,split:v=!0,className:x,rootClassName:y,style:k,children:w,itemLayout:C,loadMore:E,grid:S,dataSource:N=[],size:Z,header:O,footer:j,loading:z=!1,rowKey:B,renderItem:R,locale:L}=e,P=M(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),H=n&&"object"==typeof n?n:{},[T,A]=o.useState(H.defaultCurrent||1),[V,W]=o.useState(H.defaultPageSize||10),{getPrefixCls:q,direction:K,className:X,style:_}=(0,s.dj)("list"),{renderEmpty:D}=o.useContext(s.E_),G=e=>(t,a)=>{var o;A(t),W(a),n&&(null===(o=null==n?void 0:n[e])||void 0===o||o.call(n,t,a))},U=G("onChange"),Y=G("onShowSizeChange"),F=!!(E||n||j),J=q("list",c),[$,Q,ee]=I(J),et=z;"boolean"==typeof et&&(et={spinning:et});let en=!!(null==et?void 0:et.spinning),ea=(0,m.Z)(Z),eo="";switch(ea){case"large":eo="lg";break;case"small":eo="sm"}let ec=r()(J,{["".concat(J,"-vertical")]:"vertical"===C,["".concat(J,"-").concat(eo)]:eo,["".concat(J,"-split")]:v,["".concat(J,"-bordered")]:b,["".concat(J,"-loading")]:en,["".concat(J,"-grid")]:!!S,["".concat(J,"-something-after-last-item")]:F,["".concat(J,"-rtl")]:"rtl"===K},X,x,y,Q,ee),er=(0,l.Z)({current:1,total:0,position:"bottom"},{total:N.length,current:T,pageSize:V},n||{}),el=Math.ceil(er.total/er.pageSize);er.current=Math.min(er.current,el);let ei=n&&o.createElement("div",{className:r()("".concat(J,"-pagination"))},o.createElement(g.Z,Object.assign({align:"end"},er,{onChange:U,onShowSizeChange:Y}))),es=(0,a.Z)(N);n&&N.length>(er.current-1)*er.pageSize&&(es=(0,a.Z)(N).splice((er.current-1)*er.pageSize,er.pageSize));let ed=Object.keys(S||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),em=(0,p.Z)(ed),eu=o.useMemo(()=>{for(let e=0;e{if(!S)return;let e=eu&&S[eu]?S[eu]:S.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[JSON.stringify(S),eu]),eg=en&&o.createElement("div",{style:{minHeight:53}});if(es.length>0){let e=es.map((e,t)=>{let n;return R?((n="function"==typeof B?B(e):B?e[B]:e.key)||(n="list-item-".concat(t)),o.createElement(o.Fragment,{key:n},R(e,t))):null});eg=S?o.createElement(u.Z,{gutter:S.gutter},o.Children.map(e,e=>o.createElement("div",{key:null==e?void 0:e.key,style:ep},e))):o.createElement("ul",{className:"".concat(J,"-items")},e)}else w||en||(eg=o.createElement("div",{className:"".concat(J,"-empty-text")},(null==L?void 0:L.emptyText)||(null==D?void 0:D("List"))||o.createElement(d.Z,{componentName:"List"})));let ef=er.position,eh=o.useMemo(()=>({grid:S,itemLayout:C}),[JSON.stringify(S),C]);return $(o.createElement(h.Provider,{value:eh},o.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},_),k),className:ec},P),("top"===ef||"both"===ef)&&ei,O&&o.createElement("div",{className:"".concat(J,"-header")},O),o.createElement(f.Z,Object.assign({},et),eg,w),j&&o.createElement("div",{className:"".concat(J,"-footer")},j),E||("bottom"===ef||"both"===ef)&&ei)))});O.Item=y;var j=O},30401:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},10900:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=o},86462:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=o},44633:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=o},74998:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});t.Z=o}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4693-48fff138905963c5.js b/litellm/proxy/_experimental/out/_next/static/chunks/4693-13b55d4ebcb3b315.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/4693-48fff138905963c5.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4693-13b55d4ebcb3b315.js index 6a02d51e2e..c774e4a172 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4693-48fff138905963c5.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4693-13b55d4ebcb3b315.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4693],{29271:function(e,t,r){r.d(t,{Z:function(){return c}});var o=r(1119),n=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},l=r(55015),c=n.forwardRef(function(e,t){return n.createElement(l.Z,(0,o.Z)({},e,{ref:t,icon:a}))})},41649:function(e,t,r){r.d(t,{Z:function(){return g}});var o=r(5853),n=r(2265),a=r(47187),l=r(7084),c=r(26898),i=r(13241),d=r(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},b=(0,d.fn)("Badge"),g=n.forwardRef((e,t)=>{let{color:r,icon:g,size:p=l.u8.SM,tooltip:h,className:f,children:m}=e,k=(0,o._T)(e,["color","icon","size","tooltip","className","children"]),v=g||null,{tooltipProps:x,getReferenceProps:C}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,d.lq)([t,x.refs.setReference]),className:(0,i.q)(b("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,i.q)((0,d.bM)(r,c.K.background).bgColor,(0,d.bM)(r,c.K.iconText).textColor,(0,d.bM)(r,c.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),s[p].paddingX,s[p].paddingY,s[p].fontSize,f)},C,k),n.createElement(a.Z,Object.assign({text:h},x)),v?n.createElement(v,{className:(0,i.q)(b("icon"),"shrink-0 -ml-1 mr-1.5",u[p].height,u[p].width)}):null,n.createElement("span",{className:(0,i.q)(b("text"),"whitespace-nowrap")},m))});g.displayName="Badge"},47323:function(e,t,r){r.d(t,{Z:function(){return h}});var o=r(5853),n=r(2265),a=r(47187),l=r(7084),c=r(13241),i=r(1153),d=r(26898);let s={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},u={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},b={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},g=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,i.bM)(t,d.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,c.q)((0,i.bM)(t,d.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,i.fn)("Icon"),h=n.forwardRef((e,t)=>{let{icon:r,variant:d="simple",tooltip:h,size:f=l.u8.SM,color:m,className:k}=e,v=(0,o._T)(e,["icon","variant","tooltip","size","color","className"]),x=g(d,m),{tooltipProps:C,getReferenceProps:w}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,i.lq)([t,C.refs.setReference]),className:(0,c.q)(p("root"),"inline-flex shrink-0 items-center justify-center",x.bgColor,x.textColor,x.borderColor,x.ringColor,b[d].rounded,b[d].border,b[d].shadow,b[d].ring,s[f].paddingX,s[f].paddingY,k)},w,v),n.createElement(a.Z,Object.assign({text:h},C)),n.createElement(r,{className:(0,c.q)(p("icon"),"shrink-0",u[f].height,u[f].width)}))});h.displayName="Icon"},16853:function(e,t,r){r.d(t,{Z:function(){return s}});var o=r(5853),n=r(96398),a=r(44140),l=r(2265),c=r(13241),i=r(1153);let d=(0,i.fn)("Textarea"),s=l.forwardRef((e,t)=>{let{value:r,defaultValue:s="",placeholder:u="Type...",error:b=!1,errorMessage:g,disabled:p=!1,className:h,onChange:f,onValueChange:m,autoHeight:k=!1}=e,v=(0,o._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[x,C]=(0,a.Z)(s,r),w=(0,l.useRef)(null),y=(0,n.Uh)(x);return(0,l.useEffect)(()=>{let e=w.current;if(k&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[k,w,x]),l.createElement(l.Fragment,null,l.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:x,placeholder:u,disabled:p,className:(0,c.q)(d("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,n.um)(y,p,b),p?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",h),"data-testid":"text-area",onChange:e=>{null==f||f(e),C(e.target.value),null==m||m(e.target.value)}},v)),b&&g?l.createElement("p",{className:(0,c.q)(d("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});s.displayName="Textarea"},44140:function(e,t,r){r.d(t,{Z:function(){return n}});var o=r(2265);let n=(e,t)=>{let r=void 0!==t,[n,a]=(0,o.useState)(e);return[r?t:n,e=>{r||a(e)}]}},66531:function(e,t,r){r.d(t,{Z:function(){return a}});var o=r(2265),n=r(53346);function a(e){let t=o.useRef(null),r=()=>{n.Z.cancel(t.current),t.current=null};return[()=>{r(),t.current=(0,n.Z)(()=>{t.current=null})},o=>{t.current&&(o.stopPropagation(),r()),null==e||e(o)}]}},23496:function(e,t,r){r.d(t,{Z:function(){return m}});var o=r(2265),n=r(36760),a=r.n(n),l=r(71744),c=r(33759),i=r(93463),d=r(12918),s=r(99320),u=r(71140);let b=e=>{let{componentCls:t}=e;return{[t]:{"&-horizontal":{["&".concat(t)]:{"&-sm":{marginBlock:e.marginXS},"&-md":{marginBlock:e.margin}}}}}},g=e=>{let{componentCls:t,sizePaddingEdgeHorizontal:r,colorSplit:o,lineWidth:n,textPaddingInline:a,orientationMargin:l,verticalMarginInline:c}=e;return{[t]:Object.assign(Object.assign({},(0,d.Wf)(e)),{borderBlockStart:"".concat((0,i.bf)(n)," solid ").concat(o),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:c,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,i.bf)(n)," solid ").concat(o)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,i.bf)(e.marginLG)," 0")},["&-horizontal".concat(t,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,i.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(o),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,i.bf)(n)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(t,"-with-text-start")]:{"&::before":{width:"calc(".concat(l," * 100%)")},"&::after":{width:"calc(100% - ".concat(l," * 100%)")}},["&-horizontal".concat(t,"-with-text-end")]:{"&::before":{width:"calc(100% - ".concat(l," * 100%)")},"&::after":{width:"calc(".concat(l," * 100%)")}},["".concat(t,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:a},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:"".concat((0,i.bf)(n)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(t,"-dashed")]:{borderInlineStartWidth:n,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:o,borderStyle:"dotted",borderWidth:"".concat((0,i.bf)(n)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dotted")]:{"&::before, &::after":{borderStyle:"dotted none none"}},["&-vertical".concat(t,"-dotted")]:{borderInlineStartWidth:n,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(t,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(t,"-with-text-start").concat(t,"-no-default-orientation-margin-start")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(t,"-inner-text")]:{paddingInlineStart:r}},["&-horizontal".concat(t,"-with-text-end").concat(t,"-no-default-orientation-margin-end")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(t,"-inner-text")]:{paddingInlineEnd:r}}})}};var p=(0,s.I$)("Divider",e=>{let t=(0,u.IX)(e,{dividerHorizontalWithTextGutterMargin:e.margin,sizePaddingEdgeHorizontal:0});return[g(t),b(t)]},e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),h=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let f={small:"sm",middle:"md"};var m=e=>{let{getPrefixCls:t,direction:r,className:n,style:i}=(0,l.dj)("divider"),{prefixCls:d,type:s="horizontal",orientation:u="center",orientationMargin:b,className:g,rootClassName:m,children:k,dashed:v,variant:x="solid",plain:C,style:w,size:y}=e,S=h(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style","size"]),E=t("divider",d),[O,j,I]=p(E),z=f[(0,c.Z)(y)],B=!!k,N=o.useMemo(()=>"left"===u?"rtl"===r?"end":"start":"right"===u?"rtl"===r?"start":"end":u,[r,u]),M="start"===N&&null!=b,R="end"===N&&null!=b,Z=a()(E,n,j,I,"".concat(E,"-").concat(s),{["".concat(E,"-with-text")]:B,["".concat(E,"-with-text-").concat(N)]:B,["".concat(E,"-dashed")]:!!v,["".concat(E,"-").concat(x)]:"solid"!==x,["".concat(E,"-plain")]:!!C,["".concat(E,"-rtl")]:"rtl"===r,["".concat(E,"-no-default-orientation-margin-start")]:M,["".concat(E,"-no-default-orientation-margin-end")]:R,["".concat(E,"-").concat(z)]:!!z},g,m),P=o.useMemo(()=>"number"==typeof b?b:/^\d+$/.test(b)?Number(b):b,[b]);return O(o.createElement("div",Object.assign({className:Z,style:Object.assign(Object.assign({},i),w)},S,{role:"separator"}),k&&"vertical"!==s&&o.createElement("span",{className:"".concat(E,"-inner-text"),style:{marginInlineStart:M?P:void 0,marginInlineEnd:R?P:void 0}},k)))}},29967:function(e,t,r){r.d(t,{ZP:function(){return L}});var o=r(2265),n=r(36760),a=r.n(n),l=r(92491),c=r(50506),i=r(18242),d=r(71744),s=r(64024),u=r(33759);let b=o.createContext(null),g=b.Provider,p=o.createContext(null),h=p.Provider;var f=r(20873),m=r(28791),k=r(6694),v=r(34709),x=r(66531),C=r(86586),w=r(39109),y=r(93463),S=r(12918),E=r(99320),O=r(71140);let j=e=>{let{componentCls:t,antCls:r}=e,o="".concat(t,"-group");return{[o]:Object.assign(Object.assign({},(0,S.Wf)(e)),{display:"inline-block",fontSize:0,["&".concat(o,"-rtl")]:{direction:"rtl"},["&".concat(o,"-block")]:{display:"flex"},["".concat(r,"-badge ").concat(r,"-badge-count")]:{zIndex:1},["> ".concat(r,"-badge:not(:first-child) > ").concat(r,"-button-wrapper")]:{borderInlineStart:"none"}})}},I=e=>{let{componentCls:t,wrapperMarginInlineEnd:r,colorPrimary:o,radioSize:n,motionDurationSlow:a,motionDurationMid:l,motionEaseInOutCirc:c,colorBgContainer:i,colorBorder:d,lineWidth:s,colorBgContainerDisabled:u,colorTextDisabled:b,paddingXS:g,dotColorDisabled:p,lineType:h,radioColor:f,radioBgColor:m,calc:k}=e,v="".concat(t,"-inner"),x=k(n).sub(k(4).mul(2)),C=k(1).mul(n).equal({unit:!0});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},(0,S.Wf)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:r,cursor:"pointer","&:last-child":{marginInlineEnd:0},["&".concat(t,"-wrapper-rtl")]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},["".concat(t,"-checked::after")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:"".concat((0,y.bf)(s)," ").concat(h," ").concat(o),borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[t]:Object.assign(Object.assign({},(0,S.Wf)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),["".concat(t,"-wrapper:hover &,\n &:hover ").concat(v)]:{borderColor:o},["".concat(t,"-input:focus-visible + ").concat(v)]:(0,S.oN)(e),["".concat(t,":hover::after, ").concat(t,"-wrapper:hover &::after")]:{visibility:"visible"},["".concat(t,"-inner")]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:C,height:C,marginBlockStart:k(1).mul(n).div(-2).equal({unit:!0}),marginInlineStart:k(1).mul(n).div(-2).equal({unit:!0}),backgroundColor:f,borderBlockStart:0,borderInlineStart:0,borderRadius:C,transform:"scale(0)",opacity:0,transition:"all ".concat(a," ").concat(c),content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:C,height:C,backgroundColor:i,borderColor:d,borderStyle:"solid",borderWidth:s,borderRadius:"50%",transition:"all ".concat(l)},["".concat(t,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},["".concat(t,"-checked")]:{[v]:{borderColor:o,backgroundColor:m,"&::after":{transform:"scale(".concat(e.calc(e.dotSize).div(n).equal(),")"),opacity:1,transition:"all ".concat(a," ").concat(c)}}},["".concat(t,"-disabled")]:{cursor:"not-allowed",[v]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:p}},["".concat(t,"-input")]:{cursor:"not-allowed"},["".concat(t,"-disabled + span")]:{color:b,cursor:"not-allowed"},["&".concat(t,"-checked")]:{[v]:{"&::after":{transform:"scale(".concat(k(x).div(n).equal(),")")}}}},["span".concat(t," + *")]:{paddingInlineStart:g,paddingInlineEnd:g}})}},z=e=>{let{buttonColor:t,controlHeight:r,componentCls:o,lineWidth:n,lineType:a,colorBorder:l,motionDurationMid:c,buttonPaddingInline:i,fontSize:d,buttonBg:s,fontSizeLG:u,controlHeightLG:b,controlHeightSM:g,paddingXS:p,borderRadius:h,borderRadiusSM:f,borderRadiusLG:m,buttonCheckedBg:k,buttonSolidCheckedColor:v,colorTextDisabled:x,colorBgContainerDisabled:C,buttonCheckedBgDisabled:w,buttonCheckedColorDisabled:E,colorPrimary:O,colorPrimaryHover:j,colorPrimaryActive:I,buttonSolidCheckedBg:z,buttonSolidCheckedHoverBg:B,buttonSolidCheckedActiveBg:N,calc:M}=e;return{["".concat(o,"-button-wrapper")]:{position:"relative",display:"inline-block",height:r,margin:0,paddingInline:i,paddingBlock:0,color:t,fontSize:d,lineHeight:(0,y.bf)(M(r).sub(M(n).mul(2)).equal()),background:s,border:"".concat((0,y.bf)(n)," ").concat(a," ").concat(l),borderBlockStartWidth:M(n).add(.02).equal(),borderInlineEndWidth:n,cursor:"pointer",transition:["color ".concat(c),"background ".concat(c),"box-shadow ".concat(c)].join(","),a:{color:t},["> ".concat(o,"-button")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:M(n).mul(-1).equal()},"&:first-child":{borderInlineStart:"".concat((0,y.bf)(n)," ").concat(a," ").concat(l),borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},["".concat(o,"-group-large &")]:{height:b,fontSize:u,lineHeight:(0,y.bf)(M(b).sub(M(n).mul(2)).equal()),"&:first-child":{borderStartStartRadius:m,borderEndStartRadius:m},"&:last-child":{borderStartEndRadius:m,borderEndEndRadius:m}},["".concat(o,"-group-small &")]:{height:g,paddingInline:M(p).sub(n).equal(),paddingBlock:0,lineHeight:(0,y.bf)(M(g).sub(M(n).mul(2)).equal()),"&:first-child":{borderStartStartRadius:f,borderEndStartRadius:f},"&:last-child":{borderStartEndRadius:f,borderEndEndRadius:f}},"&:hover":{position:"relative",color:O},"&:has(:focus-visible)":(0,S.oN)(e),["".concat(o,"-inner, input[type='checkbox'], input[type='radio']")]:{width:0,height:0,opacity:0,pointerEvents:"none"},["&-checked:not(".concat(o,"-button-wrapper-disabled)")]:{zIndex:1,color:O,background:k,borderColor:O,"&::before":{backgroundColor:O},"&:first-child":{borderColor:O},"&:hover":{color:j,borderColor:j,"&::before":{backgroundColor:j}},"&:active":{color:I,borderColor:I,"&::before":{backgroundColor:I}}},["".concat(o,"-group-solid &-checked:not(").concat(o,"-button-wrapper-disabled)")]:{color:v,background:z,borderColor:z,"&:hover":{color:v,background:B,borderColor:B},"&:active":{color:v,background:N,borderColor:N}},"&-disabled":{color:x,backgroundColor:C,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:x,backgroundColor:C,borderColor:l}},["&-disabled".concat(o,"-button-wrapper-checked")]:{color:E,backgroundColor:w,borderColor:l,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}};var B=(0,E.I$)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:r}=e,o="0 0 0 ".concat((0,y.bf)(r)," ").concat(t),n=(0,O.IX)(e,{radioFocusShadow:o,radioButtonFocusShadow:o});return[j(n),I(n),z(n)]},e=>{let{wireframe:t,padding:r,marginXS:o,lineWidth:n,fontSizeLG:a,colorText:l,colorBgContainer:c,colorTextDisabled:i,controlItemBgActiveDisabled:d,colorTextLightSolid:s,colorPrimary:u,colorPrimaryHover:b,colorPrimaryActive:g,colorWhite:p}=e;return{radioSize:a,dotSize:t?a-8:a-(4+n)*2,dotColorDisabled:i,buttonSolidCheckedColor:s,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:b,buttonSolidCheckedActiveBg:g,buttonBg:c,buttonCheckedBg:c,buttonColor:l,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:i,buttonPaddingInline:r-n,wrapperMarginInlineEnd:o,radioColor:t?u:p,radioBgColor:t?c:u}},{unitless:{radioSize:!0,dotSize:!0}}),N=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let M=o.forwardRef((e,t)=>{var r,n;let l=o.useContext(b),c=o.useContext(p),{getPrefixCls:i,direction:u,radio:g}=o.useContext(d.E_),h=o.useRef(null),y=(0,m.sQ)(t,h),{isFormItemInput:S}=o.useContext(w.aM),{prefixCls:E,className:O,rootClassName:j,children:I,style:z,title:M}=e,R=N(e,["prefixCls","className","rootClassName","children","style","title"]),Z=i("radio",E),P="button"===((null==l?void 0:l.optionType)||c),q=P?"".concat(Z,"-button"):Z,T=(0,s.Z)(Z),[L,W,H]=B(Z,T),X=Object.assign({},R),_=o.useContext(C.Z);l&&(X.name=l.name,X.onChange=t=>{var r,o;null===(r=e.onChange)||void 0===r||r.call(e,t),null===(o=null==l?void 0:l.onChange)||void 0===o||o.call(l,t)},X.checked=e.value===l.value,X.disabled=null!==(r=X.disabled)&&void 0!==r?r:l.disabled),X.disabled=null!==(n=X.disabled)&&void 0!==n?n:_;let K=a()("".concat(q,"-wrapper"),{["".concat(q,"-wrapper-checked")]:X.checked,["".concat(q,"-wrapper-disabled")]:X.disabled,["".concat(q,"-wrapper-rtl")]:"rtl"===u,["".concat(q,"-wrapper-in-form-item")]:S,["".concat(q,"-wrapper-block")]:!!(null==l?void 0:l.block)},null==g?void 0:g.className,O,j,W,H,T),[Y,A]=(0,x.Z)(X.onClick);return L(o.createElement(k.Z,{component:"Radio",disabled:X.disabled},o.createElement("label",{className:K,style:Object.assign(Object.assign({},null==g?void 0:g.style),z),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:M,onClick:Y},o.createElement(f.Z,Object.assign({},X,{className:a()(X.className,{[v.A]:!P}),type:"radio",prefixCls:q,ref:y,onClick:A})),void 0!==I?o.createElement("span",{className:"".concat(q,"-label")},I):null)))});var R=r(29487);let Z=o.forwardRef((e,t)=>{let{getPrefixCls:r,direction:n}=o.useContext(d.E_),{name:b}=o.useContext(w.aM),p=(0,l.Z)((0,R.S)(b)),{prefixCls:h,className:f,rootClassName:m,options:k,buttonStyle:v="outline",disabled:x,children:C,size:y,style:S,id:E,optionType:O,name:j=p,defaultValue:I,value:z,block:N=!1,onChange:Z,onMouseEnter:P,onMouseLeave:q,onFocus:T,onBlur:L}=e,[W,H]=(0,c.Z)(I,{value:z}),X=o.useCallback(t=>{let r=t.target.value;"value"in e||H(r),r!==W&&(null==Z||Z(t))},[W,H,Z]),_=r("radio",h),K="".concat(_,"-group"),Y=(0,s.Z)(_),[A,D,F]=B(_,Y),V=C;k&&k.length>0&&(V=k.map(e=>"string"==typeof e||"number"==typeof e?o.createElement(M,{key:e.toString(),prefixCls:_,disabled:x,value:e,checked:W===e},e):o.createElement(M,{key:"radio-group-value-options-".concat(e.value),prefixCls:_,disabled:e.disabled||x,value:e.value,checked:W===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let G=(0,u.Z)(y),$=a()(K,"".concat(K,"-").concat(v),{["".concat(K,"-").concat(G)]:G,["".concat(K,"-rtl")]:"rtl"===n,["".concat(K,"-block")]:N},f,m,D,F,Y),Q=o.useMemo(()=>({onChange:X,value:W,disabled:x,name:j,optionType:O,block:N}),[X,W,x,j,O,N]);return A(o.createElement("div",Object.assign({},(0,i.Z)(e,{aria:!0,data:!0}),{className:$,style:S,onMouseEnter:P,onMouseLeave:q,onFocus:T,onBlur:L,id:E,ref:t}),o.createElement(g,{value:Q},V)))});var P=o.memo(Z),q=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r},T=o.forwardRef((e,t)=>{let{getPrefixCls:r}=o.useContext(d.E_),{prefixCls:n}=e,a=q(e,["prefixCls"]),l=r("radio",n);return o.createElement(h,{value:"button"},o.createElement(M,Object.assign({prefixCls:l},a,{type:"radio",ref:t})))});M.Button=T,M.Group=P,M.__ANT_RADIO=!0;var L=M},3810:function(e,t,r){r.d(t,{Z:function(){return B}});var o=r(2265),n=r(36760),a=r.n(n),l=r(18694),c=r(93350),i=r(53445),d=r(19722),s=r(6694),u=r(71744),b=r(93463),g=r(54558),p=r(12918),h=r(71140),f=r(99320);let m=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:o,componentCls:n,calc:a}=e,l=a(o).sub(r).equal(),c=a(t).sub(r).equal();return{[n]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(n,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(n,"-close-icon")]:{marginInlineStart:c,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(n,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(n,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:l}}),["".concat(n,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},k=e=>{let{lineWidth:t,fontSizeIcon:r,calc:o}=e,n=e.fontSizeSM;return(0,h.IX)(e,{tagFontSize:n,tagLineHeight:(0,b.bf)(o(e.lineHeightSM).mul(n).equal()),tagIconSize:o(r).sub(o(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},v=e=>({defaultBg:new g.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var x=(0,f.I$)("Tag",e=>m(k(e)),v),C=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let w=o.forwardRef((e,t)=>{let{prefixCls:r,style:n,className:l,checked:c,children:i,icon:d,onChange:s,onClick:b}=e,g=C(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:h}=o.useContext(u.E_),f=p("tag",r),[m,k,v]=x(f),w=a()(f,"".concat(f,"-checkable"),{["".concat(f,"-checkable-checked")]:c},null==h?void 0:h.className,l,k,v);return m(o.createElement("span",Object.assign({},g,{ref:t,style:Object.assign(Object.assign({},n),null==h?void 0:h.style),className:w,onClick:e=>{null==s||s(!c),null==b||b(e)}}),d,o.createElement("span",null,i)))});var y=r(18536);let S=e=>(0,y.Z)(e,(t,r)=>{let{textColor:o,lightBorderColor:n,lightColor:a,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:o,background:a,borderColor:n,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var E=(0,f.bk)(["Tag","preset"],e=>S(k(e)),v);let O=(e,t,r)=>{let o="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:e["color".concat(r)],background:e["color".concat(o,"Bg")],borderColor:e["color".concat(o,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var j=(0,f.bk)(["Tag","status"],e=>{let t=k(e);return[O(t,"success","Success"),O(t,"processing","Info"),O(t,"error","Error"),O(t,"warning","Warning")]},v),I=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let z=o.forwardRef((e,t)=>{let{prefixCls:r,className:n,rootClassName:b,style:g,children:p,icon:h,color:f,onClose:m,bordered:k=!0,visible:v}=e,C=I(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:w,direction:y,tag:S}=o.useContext(u.E_),[O,z]=o.useState(!0),B=(0,l.Z)(C,["closeIcon","closable"]);o.useEffect(()=>{void 0!==v&&z(v)},[v]);let N=(0,c.o2)(f),M=(0,c.yT)(f),R=N||M,Z=Object.assign(Object.assign({backgroundColor:f&&!R?f:void 0},null==S?void 0:S.style),g),P=w("tag",r),[q,T,L]=x(P),W=a()(P,null==S?void 0:S.className,{["".concat(P,"-").concat(f)]:R,["".concat(P,"-has-color")]:f&&!R,["".concat(P,"-hidden")]:!O,["".concat(P,"-rtl")]:"rtl"===y,["".concat(P,"-borderless")]:!k},n,b,T,L),H=e=>{e.stopPropagation(),null==m||m(e),e.defaultPrevented||z(!1)},[,X]=(0,i.b)((0,i.w)(e),(0,i.w)(S),{closable:!1,closeIconRender:e=>{let t=o.createElement("span",{className:"".concat(P,"-close-icon"),onClick:H},e);return(0,d.wm)(e,t,e=>({onClick:t=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,t),H(t)},className:a()(null==e?void 0:e.className,"".concat(P,"-close-icon"))}))}}),_="function"==typeof C.onClick||p&&"a"===p.type,K=h||null,Y=K?o.createElement(o.Fragment,null,K,p&&o.createElement("span",null,p)):p,A=o.createElement("span",Object.assign({},B,{ref:t,className:W,style:Z}),Y,X,N&&o.createElement(E,{key:"preset",prefixCls:P}),M&&o.createElement(j,{key:"status",prefixCls:P}));return q(_?o.createElement(s.Z,{component:"Tag"},A):A)});z.CheckableTag=w;var B=z},20873:function(e,t,r){var o=r(1119),n=r(31686),a=r(11993),l=r(26365),c=r(6989),i=r(36760),d=r.n(i),s=r(50506),u=r(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],g=(0,u.forwardRef)(function(e,t){var r=e.prefixCls,i=void 0===r?"rc-checkbox":r,g=e.className,p=e.style,h=e.checked,f=e.disabled,m=e.defaultChecked,k=e.type,v=void 0===k?"checkbox":k,x=e.title,C=e.onChange,w=(0,c.Z)(e,b),y=(0,u.useRef)(null),S=(0,u.useRef)(null),E=(0,s.Z)(void 0!==m&&m,{value:h}),O=(0,l.Z)(E,2),j=O[0],I=O[1];(0,u.useImperativeHandle)(t,function(){return{focus:function(e){var t;null===(t=y.current)||void 0===t||t.focus(e)},blur:function(){var e;null===(e=y.current)||void 0===e||e.blur()},input:y.current,nativeElement:S.current}});var z=d()(i,g,(0,a.Z)((0,a.Z)({},"".concat(i,"-checked"),j),"".concat(i,"-disabled"),f));return u.createElement("span",{className:z,title:x,style:p,ref:S},u.createElement("input",(0,o.Z)({},w,{className:"".concat(i,"-input"),ref:y,onChange:function(t){f||("checked"in e||I(t.target.checked),null==C||C({target:(0,n.Z)((0,n.Z)({},e),{},{type:v,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:f,checked:!!j,type:v})),u.createElement("span",{className:"".concat(i,"-inner")}))});t.Z=g},77331:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=n},86462:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=n},44633:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=n},93416:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=n},49084:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=n},74998:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});t.Z=n}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4693],{29271:function(e,t,r){r.d(t,{Z:function(){return c}});var o=r(1119),n=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},l=r(55015),c=n.forwardRef(function(e,t){return n.createElement(l.Z,(0,o.Z)({},e,{ref:t,icon:a}))})},41649:function(e,t,r){r.d(t,{Z:function(){return g}});var o=r(5853),n=r(2265),a=r(47187),l=r(7084),c=r(26898),i=r(13241),d=r(1153);let s={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},b=(0,d.fn)("Badge"),g=n.forwardRef((e,t)=>{let{color:r,icon:g,size:p=l.u8.SM,tooltip:h,className:f,children:m}=e,k=(0,o._T)(e,["color","icon","size","tooltip","className","children"]),v=g||null,{tooltipProps:x,getReferenceProps:C}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,d.lq)([t,x.refs.setReference]),className:(0,i.q)(b("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,i.q)((0,d.bM)(r,c.K.background).bgColor,(0,d.bM)(r,c.K.iconText).textColor,(0,d.bM)(r,c.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),s[p].paddingX,s[p].paddingY,s[p].fontSize,f)},C,k),n.createElement(a.Z,Object.assign({text:h},x)),v?n.createElement(v,{className:(0,i.q)(b("icon"),"shrink-0 -ml-1 mr-1.5",u[p].height,u[p].width)}):null,n.createElement("span",{className:(0,i.q)(b("text"),"whitespace-nowrap")},m))});g.displayName="Badge"},47323:function(e,t,r){r.d(t,{Z:function(){return h}});var o=r(5853),n=r(2265),a=r(47187),l=r(7084),c=r(13241),i=r(1153),d=r(26898);let s={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},u={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},b={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},g=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,i.bM)(t,d.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,c.q)((0,i.bM)(t,d.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,i.bM)(t,d.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,c.q)((0,i.bM)(t,d.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,i.fn)("Icon"),h=n.forwardRef((e,t)=>{let{icon:r,variant:d="simple",tooltip:h,size:f=l.u8.SM,color:m,className:k}=e,v=(0,o._T)(e,["icon","variant","tooltip","size","color","className"]),x=g(d,m),{tooltipProps:C,getReferenceProps:w}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,i.lq)([t,C.refs.setReference]),className:(0,c.q)(p("root"),"inline-flex shrink-0 items-center justify-center",x.bgColor,x.textColor,x.borderColor,x.ringColor,b[d].rounded,b[d].border,b[d].shadow,b[d].ring,s[f].paddingX,s[f].paddingY,k)},w,v),n.createElement(a.Z,Object.assign({text:h},C)),n.createElement(r,{className:(0,c.q)(p("icon"),"shrink-0",u[f].height,u[f].width)}))});h.displayName="Icon"},16853:function(e,t,r){r.d(t,{Z:function(){return s}});var o=r(5853),n=r(96398),a=r(44140),l=r(2265),c=r(13241),i=r(1153);let d=(0,i.fn)("Textarea"),s=l.forwardRef((e,t)=>{let{value:r,defaultValue:s="",placeholder:u="Type...",error:b=!1,errorMessage:g,disabled:p=!1,className:h,onChange:f,onValueChange:m,autoHeight:k=!1}=e,v=(0,o._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[x,C]=(0,a.Z)(s,r),w=(0,l.useRef)(null),y=(0,n.Uh)(x);return(0,l.useEffect)(()=>{let e=w.current;if(k&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[k,w,x]),l.createElement(l.Fragment,null,l.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:x,placeholder:u,disabled:p,className:(0,c.q)(d("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,n.um)(y,p,b),p?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",h),"data-testid":"text-area",onChange:e=>{null==f||f(e),C(e.target.value),null==m||m(e.target.value)}},v)),b&&g?l.createElement("p",{className:(0,c.q)(d("errorMessage"),"text-sm text-red-500 mt-1")},g):null)});s.displayName="Textarea"},44140:function(e,t,r){r.d(t,{Z:function(){return n}});var o=r(2265);let n=(e,t)=>{let r=void 0!==t,[n,a]=(0,o.useState)(e);return[r?t:n,e=>{r||a(e)}]}},66531:function(e,t,r){r.d(t,{Z:function(){return a}});var o=r(2265),n=r(53346);function a(e){let t=o.useRef(null),r=()=>{n.Z.cancel(t.current),t.current=null};return[()=>{r(),t.current=(0,n.Z)(()=>{t.current=null})},o=>{t.current&&(o.stopPropagation(),r()),null==e||e(o)}]}},23496:function(e,t,r){r.d(t,{Z:function(){return m}});var o=r(2265),n=r(36760),a=r.n(n),l=r(71744),c=r(33759),i=r(93463),d=r(12918),s=r(99320),u=r(71140);let b=e=>{let{componentCls:t}=e;return{[t]:{"&-horizontal":{["&".concat(t)]:{"&-sm":{marginBlock:e.marginXS},"&-md":{marginBlock:e.margin}}}}}},g=e=>{let{componentCls:t,sizePaddingEdgeHorizontal:r,colorSplit:o,lineWidth:n,textPaddingInline:a,orientationMargin:l,verticalMarginInline:c}=e;return{[t]:Object.assign(Object.assign({},(0,d.Wf)(e)),{borderBlockStart:"".concat((0,i.bf)(n)," solid ").concat(o),"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:c,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:"".concat((0,i.bf)(n)," solid ").concat(o)},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:"".concat((0,i.bf)(e.marginLG)," 0")},["&-horizontal".concat(t,"-with-text")]:{display:"flex",alignItems:"center",margin:"".concat((0,i.bf)(e.dividerHorizontalWithTextGutterMargin)," 0"),color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:"0 ".concat(o),"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:"".concat((0,i.bf)(n)," solid transparent"),borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},["&-horizontal".concat(t,"-with-text-start")]:{"&::before":{width:"calc(".concat(l," * 100%)")},"&::after":{width:"calc(100% - ".concat(l," * 100%)")}},["&-horizontal".concat(t,"-with-text-end")]:{"&::before":{width:"calc(100% - ".concat(l," * 100%)")},"&::after":{width:"calc(".concat(l," * 100%)")}},["".concat(t,"-inner-text")]:{display:"inline-block",paddingBlock:0,paddingInline:a},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:"".concat((0,i.bf)(n)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dashed")]:{"&::before, &::after":{borderStyle:"dashed none none"}},["&-vertical".concat(t,"-dashed")]:{borderInlineStartWidth:n,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:o,borderStyle:"dotted",borderWidth:"".concat((0,i.bf)(n)," 0 0")},["&-horizontal".concat(t,"-with-text").concat(t,"-dotted")]:{"&::before, &::after":{borderStyle:"dotted none none"}},["&-vertical".concat(t,"-dotted")]:{borderInlineStartWidth:n,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},["&-plain".concat(t,"-with-text")]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},["&-horizontal".concat(t,"-with-text-start").concat(t,"-no-default-orientation-margin-start")]:{"&::before":{width:0},"&::after":{width:"100%"},["".concat(t,"-inner-text")]:{paddingInlineStart:r}},["&-horizontal".concat(t,"-with-text-end").concat(t,"-no-default-orientation-margin-end")]:{"&::before":{width:"100%"},"&::after":{width:0},["".concat(t,"-inner-text")]:{paddingInlineEnd:r}}})}};var p=(0,s.I$)("Divider",e=>{let t=(0,u.IX)(e,{dividerHorizontalWithTextGutterMargin:e.margin,sizePaddingEdgeHorizontal:0});return[g(t),b(t)]},e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),{unitless:{orientationMargin:!0}}),h=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let f={small:"sm",middle:"md"};var m=e=>{let{getPrefixCls:t,direction:r,className:n,style:i}=(0,l.dj)("divider"),{prefixCls:d,type:s="horizontal",orientation:u="center",orientationMargin:b,className:g,rootClassName:m,children:k,dashed:v,variant:x="solid",plain:C,style:w,size:y}=e,S=h(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style","size"]),E=t("divider",d),[O,j,I]=p(E),z=f[(0,c.Z)(y)],B=!!k,N=o.useMemo(()=>"left"===u?"rtl"===r?"end":"start":"right"===u?"rtl"===r?"start":"end":u,[r,u]),M="start"===N&&null!=b,R="end"===N&&null!=b,Z=a()(E,n,j,I,"".concat(E,"-").concat(s),{["".concat(E,"-with-text")]:B,["".concat(E,"-with-text-").concat(N)]:B,["".concat(E,"-dashed")]:!!v,["".concat(E,"-").concat(x)]:"solid"!==x,["".concat(E,"-plain")]:!!C,["".concat(E,"-rtl")]:"rtl"===r,["".concat(E,"-no-default-orientation-margin-start")]:M,["".concat(E,"-no-default-orientation-margin-end")]:R,["".concat(E,"-").concat(z)]:!!z},g,m),P=o.useMemo(()=>"number"==typeof b?b:/^\d+$/.test(b)?Number(b):b,[b]);return O(o.createElement("div",Object.assign({className:Z,style:Object.assign(Object.assign({},i),w)},S,{role:"separator"}),k&&"vertical"!==s&&o.createElement("span",{className:"".concat(E,"-inner-text"),style:{marginInlineStart:M?P:void 0,marginInlineEnd:R?P:void 0}},k)))}},29967:function(e,t,r){r.d(t,{ZP:function(){return L}});var o=r(2265),n=r(36760),a=r.n(n),l=r(92491),c=r(50506),i=r(18242),d=r(71744),s=r(64024),u=r(33759);let b=o.createContext(null),g=b.Provider,p=o.createContext(null),h=p.Provider;var f=r(20873),m=r(28791),k=r(6694),v=r(34709),x=r(66531),C=r(86586),w=r(39109),y=r(93463),S=r(12918),E=r(99320),O=r(71140);let j=e=>{let{componentCls:t,antCls:r}=e,o="".concat(t,"-group");return{[o]:Object.assign(Object.assign({},(0,S.Wf)(e)),{display:"inline-block",fontSize:0,["&".concat(o,"-rtl")]:{direction:"rtl"},["&".concat(o,"-block")]:{display:"flex"},["".concat(r,"-badge ").concat(r,"-badge-count")]:{zIndex:1},["> ".concat(r,"-badge:not(:first-child) > ").concat(r,"-button-wrapper")]:{borderInlineStart:"none"}})}},I=e=>{let{componentCls:t,wrapperMarginInlineEnd:r,colorPrimary:o,radioSize:n,motionDurationSlow:a,motionDurationMid:l,motionEaseInOutCirc:c,colorBgContainer:i,colorBorder:d,lineWidth:s,colorBgContainerDisabled:u,colorTextDisabled:b,paddingXS:g,dotColorDisabled:p,lineType:h,radioColor:f,radioBgColor:m,calc:k}=e,v="".concat(t,"-inner"),x=k(n).sub(k(4).mul(2)),C=k(1).mul(n).equal({unit:!0});return{["".concat(t,"-wrapper")]:Object.assign(Object.assign({},(0,S.Wf)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:r,cursor:"pointer","&:last-child":{marginInlineEnd:0},["&".concat(t,"-wrapper-rtl")]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},["".concat(t,"-checked::after")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:"".concat((0,y.bf)(s)," ").concat(h," ").concat(o),borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[t]:Object.assign(Object.assign({},(0,S.Wf)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),["".concat(t,"-wrapper:hover &,\n &:hover ").concat(v)]:{borderColor:o},["".concat(t,"-input:focus-visible + ").concat(v)]:(0,S.oN)(e),["".concat(t,":hover::after, ").concat(t,"-wrapper:hover &::after")]:{visibility:"visible"},["".concat(t,"-inner")]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:C,height:C,marginBlockStart:k(1).mul(n).div(-2).equal({unit:!0}),marginInlineStart:k(1).mul(n).div(-2).equal({unit:!0}),backgroundColor:f,borderBlockStart:0,borderInlineStart:0,borderRadius:C,transform:"scale(0)",opacity:0,transition:"all ".concat(a," ").concat(c),content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:C,height:C,backgroundColor:i,borderColor:d,borderStyle:"solid",borderWidth:s,borderRadius:"50%",transition:"all ".concat(l)},["".concat(t,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},["".concat(t,"-checked")]:{[v]:{borderColor:o,backgroundColor:m,"&::after":{transform:"scale(".concat(e.calc(e.dotSize).div(n).equal(),")"),opacity:1,transition:"all ".concat(a," ").concat(c)}}},["".concat(t,"-disabled")]:{cursor:"not-allowed",[v]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:p}},["".concat(t,"-input")]:{cursor:"not-allowed"},["".concat(t,"-disabled + span")]:{color:b,cursor:"not-allowed"},["&".concat(t,"-checked")]:{[v]:{"&::after":{transform:"scale(".concat(k(x).div(n).equal(),")")}}}},["span".concat(t," + *")]:{paddingInlineStart:g,paddingInlineEnd:g}})}},z=e=>{let{buttonColor:t,controlHeight:r,componentCls:o,lineWidth:n,lineType:a,colorBorder:l,motionDurationMid:c,buttonPaddingInline:i,fontSize:d,buttonBg:s,fontSizeLG:u,controlHeightLG:b,controlHeightSM:g,paddingXS:p,borderRadius:h,borderRadiusSM:f,borderRadiusLG:m,buttonCheckedBg:k,buttonSolidCheckedColor:v,colorTextDisabled:x,colorBgContainerDisabled:C,buttonCheckedBgDisabled:w,buttonCheckedColorDisabled:E,colorPrimary:O,colorPrimaryHover:j,colorPrimaryActive:I,buttonSolidCheckedBg:z,buttonSolidCheckedHoverBg:B,buttonSolidCheckedActiveBg:N,calc:M}=e;return{["".concat(o,"-button-wrapper")]:{position:"relative",display:"inline-block",height:r,margin:0,paddingInline:i,paddingBlock:0,color:t,fontSize:d,lineHeight:(0,y.bf)(M(r).sub(M(n).mul(2)).equal()),background:s,border:"".concat((0,y.bf)(n)," ").concat(a," ").concat(l),borderBlockStartWidth:M(n).add(.02).equal(),borderInlineEndWidth:n,cursor:"pointer",transition:["color ".concat(c),"background ".concat(c),"box-shadow ".concat(c)].join(","),a:{color:t},["> ".concat(o,"-button")]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:M(n).mul(-1).equal()},"&:first-child":{borderInlineStart:"".concat((0,y.bf)(n)," ").concat(a," ").concat(l),borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h},"&:first-child:last-child":{borderRadius:h},["".concat(o,"-group-large &")]:{height:b,fontSize:u,lineHeight:(0,y.bf)(M(b).sub(M(n).mul(2)).equal()),"&:first-child":{borderStartStartRadius:m,borderEndStartRadius:m},"&:last-child":{borderStartEndRadius:m,borderEndEndRadius:m}},["".concat(o,"-group-small &")]:{height:g,paddingInline:M(p).sub(n).equal(),paddingBlock:0,lineHeight:(0,y.bf)(M(g).sub(M(n).mul(2)).equal()),"&:first-child":{borderStartStartRadius:f,borderEndStartRadius:f},"&:last-child":{borderStartEndRadius:f,borderEndEndRadius:f}},"&:hover":{position:"relative",color:O},"&:has(:focus-visible)":(0,S.oN)(e),["".concat(o,"-inner, input[type='checkbox'], input[type='radio']")]:{width:0,height:0,opacity:0,pointerEvents:"none"},["&-checked:not(".concat(o,"-button-wrapper-disabled)")]:{zIndex:1,color:O,background:k,borderColor:O,"&::before":{backgroundColor:O},"&:first-child":{borderColor:O},"&:hover":{color:j,borderColor:j,"&::before":{backgroundColor:j}},"&:active":{color:I,borderColor:I,"&::before":{backgroundColor:I}}},["".concat(o,"-group-solid &-checked:not(").concat(o,"-button-wrapper-disabled)")]:{color:v,background:z,borderColor:z,"&:hover":{color:v,background:B,borderColor:B},"&:active":{color:v,background:N,borderColor:N}},"&-disabled":{color:x,backgroundColor:C,borderColor:l,cursor:"not-allowed","&:first-child, &:hover":{color:x,backgroundColor:C,borderColor:l}},["&-disabled".concat(o,"-button-wrapper-checked")]:{color:E,backgroundColor:w,borderColor:l,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}};var B=(0,E.I$)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:r}=e,o="0 0 0 ".concat((0,y.bf)(r)," ").concat(t),n=(0,O.IX)(e,{radioFocusShadow:o,radioButtonFocusShadow:o});return[j(n),I(n),z(n)]},e=>{let{wireframe:t,padding:r,marginXS:o,lineWidth:n,fontSizeLG:a,colorText:l,colorBgContainer:c,colorTextDisabled:i,controlItemBgActiveDisabled:d,colorTextLightSolid:s,colorPrimary:u,colorPrimaryHover:b,colorPrimaryActive:g,colorWhite:p}=e;return{radioSize:a,dotSize:t?a-8:a-(4+n)*2,dotColorDisabled:i,buttonSolidCheckedColor:s,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:b,buttonSolidCheckedActiveBg:g,buttonBg:c,buttonCheckedBg:c,buttonColor:l,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:i,buttonPaddingInline:r-n,wrapperMarginInlineEnd:o,radioColor:t?u:p,radioBgColor:t?c:u}},{unitless:{radioSize:!0,dotSize:!0}}),N=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let M=o.forwardRef((e,t)=>{var r,n;let l=o.useContext(b),c=o.useContext(p),{getPrefixCls:i,direction:u,radio:g}=o.useContext(d.E_),h=o.useRef(null),y=(0,m.sQ)(t,h),{isFormItemInput:S}=o.useContext(w.aM),{prefixCls:E,className:O,rootClassName:j,children:I,style:z,title:M}=e,R=N(e,["prefixCls","className","rootClassName","children","style","title"]),Z=i("radio",E),P="button"===((null==l?void 0:l.optionType)||c),q=P?"".concat(Z,"-button"):Z,T=(0,s.Z)(Z),[L,W,H]=B(Z,T),X=Object.assign({},R),_=o.useContext(C.Z);l&&(X.name=l.name,X.onChange=t=>{var r,o;null===(r=e.onChange)||void 0===r||r.call(e,t),null===(o=null==l?void 0:l.onChange)||void 0===o||o.call(l,t)},X.checked=e.value===l.value,X.disabled=null!==(r=X.disabled)&&void 0!==r?r:l.disabled),X.disabled=null!==(n=X.disabled)&&void 0!==n?n:_;let K=a()("".concat(q,"-wrapper"),{["".concat(q,"-wrapper-checked")]:X.checked,["".concat(q,"-wrapper-disabled")]:X.disabled,["".concat(q,"-wrapper-rtl")]:"rtl"===u,["".concat(q,"-wrapper-in-form-item")]:S,["".concat(q,"-wrapper-block")]:!!(null==l?void 0:l.block)},null==g?void 0:g.className,O,j,W,H,T),[Y,A]=(0,x.Z)(X.onClick);return L(o.createElement(k.Z,{component:"Radio",disabled:X.disabled},o.createElement("label",{className:K,style:Object.assign(Object.assign({},null==g?void 0:g.style),z),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:M,onClick:Y},o.createElement(f.Z,Object.assign({},X,{className:a()(X.className,{[v.A]:!P}),type:"radio",prefixCls:q,ref:y,onClick:A})),void 0!==I?o.createElement("span",{className:"".concat(q,"-label")},I):null)))});var R=r(29487);let Z=o.forwardRef((e,t)=>{let{getPrefixCls:r,direction:n}=o.useContext(d.E_),{name:b}=o.useContext(w.aM),p=(0,l.Z)((0,R.S)(b)),{prefixCls:h,className:f,rootClassName:m,options:k,buttonStyle:v="outline",disabled:x,children:C,size:y,style:S,id:E,optionType:O,name:j=p,defaultValue:I,value:z,block:N=!1,onChange:Z,onMouseEnter:P,onMouseLeave:q,onFocus:T,onBlur:L}=e,[W,H]=(0,c.Z)(I,{value:z}),X=o.useCallback(t=>{let r=t.target.value;"value"in e||H(r),r!==W&&(null==Z||Z(t))},[W,H,Z]),_=r("radio",h),K="".concat(_,"-group"),Y=(0,s.Z)(_),[A,D,F]=B(_,Y),V=C;k&&k.length>0&&(V=k.map(e=>"string"==typeof e||"number"==typeof e?o.createElement(M,{key:e.toString(),prefixCls:_,disabled:x,value:e,checked:W===e},e):o.createElement(M,{key:"radio-group-value-options-".concat(e.value),prefixCls:_,disabled:e.disabled||x,value:e.value,checked:W===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let G=(0,u.Z)(y),$=a()(K,"".concat(K,"-").concat(v),{["".concat(K,"-").concat(G)]:G,["".concat(K,"-rtl")]:"rtl"===n,["".concat(K,"-block")]:N},f,m,D,F,Y),Q=o.useMemo(()=>({onChange:X,value:W,disabled:x,name:j,optionType:O,block:N}),[X,W,x,j,O,N]);return A(o.createElement("div",Object.assign({},(0,i.Z)(e,{aria:!0,data:!0}),{className:$,style:S,onMouseEnter:P,onMouseLeave:q,onFocus:T,onBlur:L,id:E,ref:t}),o.createElement(g,{value:Q},V)))});var P=o.memo(Z),q=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r},T=o.forwardRef((e,t)=>{let{getPrefixCls:r}=o.useContext(d.E_),{prefixCls:n}=e,a=q(e,["prefixCls"]),l=r("radio",n);return o.createElement(h,{value:"button"},o.createElement(M,Object.assign({prefixCls:l},a,{type:"radio",ref:t})))});M.Button=T,M.Group=P,M.__ANT_RADIO=!0;var L=M},3810:function(e,t,r){r.d(t,{Z:function(){return B}});var o=r(2265),n=r(36760),a=r.n(n),l=r(18694),c=r(93350),i=r(53445),d=r(19722),s=r(6694),u=r(71744),b=r(93463),g=r(54558),p=r(12918),h=r(71140),f=r(99320);let m=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:o,componentCls:n,calc:a}=e,l=a(o).sub(r).equal(),c=a(t).sub(r).equal();return{[n]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,b.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(n,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(n,"-close-icon")]:{marginInlineStart:c,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(n,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(n,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:l}}),["".concat(n,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},k=e=>{let{lineWidth:t,fontSizeIcon:r,calc:o}=e,n=e.fontSizeSM;return(0,h.IX)(e,{tagFontSize:n,tagLineHeight:(0,b.bf)(o(e.lineHeightSM).mul(n).equal()),tagIconSize:o(r).sub(o(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},v=e=>({defaultBg:new g.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var x=(0,f.I$)("Tag",e=>m(k(e)),v),C=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let w=o.forwardRef((e,t)=>{let{prefixCls:r,style:n,className:l,checked:c,children:i,icon:d,onChange:s,onClick:b}=e,g=C(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:h}=o.useContext(u.E_),f=p("tag",r),[m,k,v]=x(f),w=a()(f,"".concat(f,"-checkable"),{["".concat(f,"-checkable-checked")]:c},null==h?void 0:h.className,l,k,v);return m(o.createElement("span",Object.assign({},g,{ref:t,style:Object.assign(Object.assign({},n),null==h?void 0:h.style),className:w,onClick:e=>{null==s||s(!c),null==b||b(e)}}),d,o.createElement("span",null,i)))});var y=r(18536);let S=e=>(0,y.Z)(e,(t,r)=>{let{textColor:o,lightBorderColor:n,lightColor:a,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:o,background:a,borderColor:n,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var E=(0,f.bk)(["Tag","preset"],e=>S(k(e)),v);let O=(e,t,r)=>{let o="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:e["color".concat(r)],background:e["color".concat(o,"Bg")],borderColor:e["color".concat(o,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var j=(0,f.bk)(["Tag","status"],e=>{let t=k(e);return[O(t,"success","Success"),O(t,"processing","Info"),O(t,"error","Error"),O(t,"warning","Warning")]},v),I=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,o=Object.getOwnPropertySymbols(e);nt.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r};let z=o.forwardRef((e,t)=>{let{prefixCls:r,className:n,rootClassName:b,style:g,children:p,icon:h,color:f,onClose:m,bordered:k=!0,visible:v}=e,C=I(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:w,direction:y,tag:S}=o.useContext(u.E_),[O,z]=o.useState(!0),B=(0,l.Z)(C,["closeIcon","closable"]);o.useEffect(()=>{void 0!==v&&z(v)},[v]);let N=(0,c.o2)(f),M=(0,c.yT)(f),R=N||M,Z=Object.assign(Object.assign({backgroundColor:f&&!R?f:void 0},null==S?void 0:S.style),g),P=w("tag",r),[q,T,L]=x(P),W=a()(P,null==S?void 0:S.className,{["".concat(P,"-").concat(f)]:R,["".concat(P,"-has-color")]:f&&!R,["".concat(P,"-hidden")]:!O,["".concat(P,"-rtl")]:"rtl"===y,["".concat(P,"-borderless")]:!k},n,b,T,L),H=e=>{e.stopPropagation(),null==m||m(e),e.defaultPrevented||z(!1)},[,X]=(0,i.b)((0,i.w)(e),(0,i.w)(S),{closable:!1,closeIconRender:e=>{let t=o.createElement("span",{className:"".concat(P,"-close-icon"),onClick:H},e);return(0,d.wm)(e,t,e=>({onClick:t=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,t),H(t)},className:a()(null==e?void 0:e.className,"".concat(P,"-close-icon"))}))}}),_="function"==typeof C.onClick||p&&"a"===p.type,K=h||null,Y=K?o.createElement(o.Fragment,null,K,p&&o.createElement("span",null,p)):p,A=o.createElement("span",Object.assign({},B,{ref:t,className:W,style:Z}),Y,X,N&&o.createElement(E,{key:"preset",prefixCls:P}),M&&o.createElement(j,{key:"status",prefixCls:P}));return q(_?o.createElement(s.Z,{component:"Tag"},A):A)});z.CheckableTag=w;var B=z},20873:function(e,t,r){var o=r(1119),n=r(31686),a=r(11993),l=r(26365),c=r(6989),i=r(36760),d=r.n(i),s=r(50506),u=r(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],g=(0,u.forwardRef)(function(e,t){var r=e.prefixCls,i=void 0===r?"rc-checkbox":r,g=e.className,p=e.style,h=e.checked,f=e.disabled,m=e.defaultChecked,k=e.type,v=void 0===k?"checkbox":k,x=e.title,C=e.onChange,w=(0,c.Z)(e,b),y=(0,u.useRef)(null),S=(0,u.useRef)(null),E=(0,s.Z)(void 0!==m&&m,{value:h}),O=(0,l.Z)(E,2),j=O[0],I=O[1];(0,u.useImperativeHandle)(t,function(){return{focus:function(e){var t;null===(t=y.current)||void 0===t||t.focus(e)},blur:function(){var e;null===(e=y.current)||void 0===e||e.blur()},input:y.current,nativeElement:S.current}});var z=d()(i,g,(0,a.Z)((0,a.Z)({},"".concat(i,"-checked"),j),"".concat(i,"-disabled"),f));return u.createElement("span",{className:z,title:x,style:p,ref:S},u.createElement("input",(0,o.Z)({},w,{className:"".concat(i,"-input"),ref:y,onChange:function(t){f||("checked"in e||I(t.target.checked),null==C||C({target:(0,n.Z)((0,n.Z)({},e),{},{type:v,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:f,checked:!!j,type:v})),u.createElement("span",{className:"".concat(i,"-inner")}))});t.Z=g},10900:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=n},86462:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=n},44633:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=n},93416:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=n},49084:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=n},74998:function(e,t,r){var o=r(2265);let n=o.forwardRef(function(e,t){return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});t.Z=n}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5238-6d33a8514cdeefb9.js b/litellm/proxy/_experimental/out/_next/static/chunks/5238-80f2369616f27d95.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5238-6d33a8514cdeefb9.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5238-80f2369616f27d95.js index 21d94ac83f..15dba90af9 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5238-6d33a8514cdeefb9.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5238-80f2369616f27d95.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5238],{75105:function(e,t,n){"use strict";n.d(t,{Z:function(){return eo}});var r=n(5853),o=n(2265),a=n(47625),i=n(93765),l=n(87602),c=n(84735),s=n(86757),u=n.n(s),d=n(95645),p=n.n(d),f=n(77571),m=n.n(f),h=n(82559),y=n.n(h),v=n(21652),b=n.n(v),g=n(57165),k=n(81889),x=n(9841),w=n(58772),A=n(34067),O=n(16630),j=n(85355),E=n(82944),P=["layout","type","stroke","connectNulls","isRange","ref"],S=["key"];function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!b()(l,r)||!b()(c,o))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,o,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,a=t.points,i=t.className,c=t.top,s=t.left,u=t.xAxis,d=t.yAxis,p=t.width,f=t.height,h=t.isAnimationActive,y=t.id;if(n||!a||!a.length)return null;var v=this.state.isAnimationFinished,b=1===a.length,g=(0,l.Z)("recharts-area",i),k=u&&u.allowDataOverflow,A=d&&d.allowDataOverflow,O=k||A,j=m()(y)?this.id:y,P=null!==(e=(0,E.L6)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,C=((0,E.jf)(r)?r:{}).clipDot,N=void 0===C||C,T=2*(void 0===S?3:S)+(void 0===L?2:L);return o.createElement(x.m,{className:g},k||A?o.createElement("defs",null,o.createElement("clipPath",{id:"clipPath-".concat(j)},o.createElement("rect",{x:k?s:s-p/2,y:A?c:c-f/2,width:k?p:2*p,height:A?f:2*f})),!N&&o.createElement("clipPath",{id:"clipPath-dots-".concat(j)},o.createElement("rect",{x:s-T/2,y:c-T/2,width:p+T,height:f+T}))):null,b?null:this.renderArea(O,j),(r||b)&&this.renderDots(O,N,j),(!h||v)&&w.e.renderCallByParent(this.props,a))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],t&&R(r.prototype,t),n&&R(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(o.PureComponent);F(K,"displayName","Area"),F(K,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!A.x.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),F(K,"getBaseValue",function(e,t,n,r){var o=e.layout,a=e.baseValue,i=t.props.baseValue,l=null!=i?i:a;if((0,O.hj)(l)&&"number"==typeof l)return l;var c="horizontal"===o?r:n,s=c.scale.domain();if("number"===c.type){var u=Math.max(s[0],s[1]),d=Math.min(s[0],s[1]);return"dataMin"===l?d:"dataMax"===l?u:u<0?u:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===l?s[0]:"dataMax"===l?s[1]:s[0]}),F(K,"getComposedData",function(e){var t,n=e.props,r=e.item,o=e.xAxis,a=e.yAxis,i=e.xAxisTicks,l=e.yAxisTicks,c=e.bandSize,s=e.dataKey,u=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,m=n.layout,h=u&&u.length,y=K.getBaseValue(n,r,o,a),v="horizontal"===m,b=!1,g=p.map(function(e,t){h?n=u[d+t]:Array.isArray(n=(0,j.F$)(e,s))?b=!0:n=[y,n];var n,r=null==n[1]||h&&null==(0,j.F$)(e,s);return v?{x:(0,j.Hv)({axis:o,ticks:i,bandSize:c,entry:e,index:t}),y:r?null:a.scale(n[1]),value:n,payload:e}:{x:r?null:o.scale(n[1]),y:(0,j.Hv)({axis:a,ticks:l,bandSize:c,entry:e,index:t}),value:n,payload:e}});return t=h||b?g.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?a.scale(t):null}:{x:null!=t?o.scale(t):null,y:e.y}}):v?a.scale(y):o.scale(y),D({points:g,baseLine:t,layout:m,isRange:b},f)}),F(K,"renderDotItem",function(e,t){var n;if(o.isValidElement(e))n=o.cloneElement(e,t);else if(u()(e))n=e(t);else{var r=(0,l.Z)("recharts-area-dot","boolean"!=typeof e?e.className:""),a=t.key,i=C(t,S);n=o.createElement(k.o,N({},i,{key:a,className:r}))}return n});var _=n(97059),H=n(62994),z=n(25311),V=(0,i.z)({chartName:"AreaChart",GraphicalChild:K,axisComponents:[{axisType:"xAxis",AxisComp:_.K},{axisType:"yAxis",AxisComp:H.B}],formatAxisMap:z.t9}),W=n(56940),q=n(26680),G=n(8147),$=n(22190),X=n(54061),U=n(65278),Y=n(98593),Q=n(92666),J=n(32644),ee=n(7084),et=n(26898),en=n(13241),er=n(1153);let eo=o.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:l,stack:c=!1,colors:s=et.s,valueFormatter:u=er.Cj,startEndOnly:d=!1,showXAxis:p=!0,showYAxis:f=!0,yAxisWidth:m=56,intervalType:h="equidistantPreserveStart",showAnimation:y=!1,animationDuration:v=900,showTooltip:b=!0,showLegend:g=!0,showGridLines:x=!0,showGradient:w=!0,autoMinValue:A=!1,curveType:O="linear",minValue:j,maxValue:E,connectNulls:P=!1,allowDecimals:S=!0,noDataText:L,className:C,onValueChange:N,enableLegendSlider:T=!1,customTooltip:D,rotateLabelX:R,padding:M=(p||f)&&(!d||f)?{left:20,right:20}:{left:0,right:0},tickGap:I=5,xAxisLabel:Z,yAxisLabel:F}=e,B=(0,r._T)(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[z,eo]=(0,o.useState)(60),[ea,ei]=(0,o.useState)(void 0),[el,ec]=(0,o.useState)(void 0),es=(0,J.me)(i,s),eu=(0,J.i4)(A,j,E),ed=!!N;function ep(e){ed&&(e===el&&!ea||(0,J.FB)(n,e)&&ea&&ea.dataKey===e?(ec(void 0),null==N||N(null)):(ec(e),null==N||N({eventType:"category",categoryClicked:e})),ei(void 0))}return o.createElement("div",Object.assign({ref:t,className:(0,en.q)("w-full h-80",C)},B),o.createElement(a.h,{className:"h-full w-full"},(null==n?void 0:n.length)?o.createElement(V,{data:n,onClick:ed&&(el||ea)?()=>{ei(void 0),ec(void 0),null==N||N(null)}:void 0,margin:{bottom:Z?30:void 0,left:F?20:void 0,right:F?5:void 0,top:5}},x?o.createElement(W.q,{className:(0,en.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,o.createElement(_.K,{padding:M,hide:!p,dataKey:l,tick:{transform:"translate(0, 6)"},ticks:d?[n[0][l],n[n.length-1][l]]:void 0,fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:d?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:I,angle:null==R?void 0:R.angle,dy:null==R?void 0:R.verticalShift,height:null==R?void 0:R.xAxisHeight},Z&&o.createElement(q._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Z)),o.createElement(H.B,{width:m,hide:!f,axisLine:!1,tickLine:!1,type:"number",domain:eu,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u,allowDecimals:S},F&&o.createElement(q._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},F)),o.createElement(G.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?e=>{let{active:t,payload:n,label:r}=e;return D?o.createElement(D,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=es.get(e.dataKey))&&void 0!==t?t:ee.fr.Gray})}),active:t,label:r}):o.createElement(Y.ZP,{active:t,payload:n,label:r,valueFormatter:u,categoryColors:es})}:o.createElement(o.Fragment,null),position:{y:0}}),g?o.createElement($.D,{verticalAlign:"top",height:z,content:e=>{let{payload:t}=e;return(0,U.Z)({payload:t},es,eo,el,ed?e=>ep(e):void 0,T)}}):null,i.map(e=>{var t,n,r;let a=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement("defs",{key:e},w?o.createElement("linearGradient",{className:(0,er.bM)(null!==(n=es.get(e))&&void 0!==n?n:ee.fr.Gray,et.K.text).textColor,id:a,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:ea||el&&el!==e?.15:.4}),o.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):o.createElement("linearGradient",{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).textColor,id:a,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{stopColor:"currentColor",stopOpacity:ea||el&&el!==e?.1:.3})))}),i.map(e=>{var t,r;let a=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement(K,{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).strokeColor,strokeOpacity:ea||el&&el!==e?.3:1,activeDot:e=>{var t;let{cx:r,cy:a,stroke:i,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,dataKey:u}=e;return o.createElement(k.o,{className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",N?"cursor-pointer":"",(0,er.bM)(null!==(t=es.get(u))&&void 0!==t?t:ee.fr.Gray,et.K.text).fillColor),cx:r,cy:a,r:5,fill:"",stroke:i,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,onClick:(t,r)=>{r.stopPropagation(),ed&&(e.index===(null==ea?void 0:ea.index)&&e.dataKey===(null==ea?void 0:ea.dataKey)||(0,J.FB)(n,e.dataKey)&&el&&el===e.dataKey?(ec(void 0),ei(void 0),null==N||N(null)):(ec(e.dataKey),ei({index:e.index,dataKey:e.dataKey}),null==N||N(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var r;let{stroke:a,strokeLinecap:i,strokeLinejoin:l,strokeWidth:c,cx:s,cy:u,dataKey:d,index:p}=t;return(0,J.FB)(n,e)&&!(ea||el&&el!==e)||(null==ea?void 0:ea.index)===p&&(null==ea?void 0:ea.dataKey)===e?o.createElement(k.o,{key:p,cx:s,cy:u,r:5,stroke:a,fill:"",strokeLinecap:i,strokeLinejoin:l,strokeWidth:c,className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",N?"cursor-pointer":"",(0,er.bM)(null!==(r=es.get(d))&&void 0!==r?r:ee.fr.Gray,et.K.text).fillColor)}):o.createElement(o.Fragment,{key:p})},key:e,name:e,type:O,dataKey:e,stroke:"",fill:"url(#".concat(a,")"),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:y,animationDuration:v,stackId:c?"a":void 0,connectNulls:P})}),N?i.map(e=>o.createElement(X.x,{className:(0,en.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:O,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:P,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;ep(n)}})):null):o.createElement(Q.Z,{noDataText:L})))});eo.displayName="AreaChart"},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return e_}});var r=n(5853),o=n(7084),a=n(26898),i=n(13241),l=n(1153),c=n(2265),s=n(60474),u=n(47625),d=n(93765),p=n(86757),f=n.n(p),m=n(87602),h=n(9841),y=n(81889),v=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){w(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),w(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},O=function(e,t){var n=A(e);t&&(n=[n.reduce(function(e,t){return[].concat(k(e),k(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},j=function(e,t,n){var r=O(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(O(t.reverse(),n).slice(1))},E=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var i=(0,m.Z)("recharts-polygon",n);if(r&&r.length){var l=a.stroke&&"none"!==a.stroke,s=j(t,r,o);return c.createElement("g",{className:i},c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"Z"===s.slice(-1)?a.fill:"none",stroke:"none",d:s})),l?c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"none",d:O(t,o)})):null,l?c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"none",d:O(r,o)})):null)}var u=O(t,o);return c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"Z"===u.slice(-1)?a.fill:"none",className:i,d:u}))},P=n(58811),S=n(41637),L=n(39206);function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,a=e.axisLineType,i=D(D({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===a)return c.createElement(y.o,N({className:"recharts-polar-angle-axis-line"},i,{cx:t,cy:n,r:r}));var l=this.props.ticks.map(function(e){return(0,L.op)(t,n,r,e.coordinate)});return c.createElement(E,N({className:"recharts-polar-angle-axis-line"},i,{points:l}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,a=t.tickLine,i=t.tickFormatter,l=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(o,!1),d=D(D({},s),{},{fill:"none"},(0,v.L6)(a,!1)),p=n.map(function(t,n){var p=e.getTickLineCoord(t),f=D(D(D({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:l},u),{},{index:n,payload:t,x:p.x2,y:p.y2});return c.createElement(h.m,N({className:(0,m.Z)("recharts-polar-angle-axis-tick",(0,L.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),a&&c.createElement("line",N({className:"recharts-polar-angle-axis-tick-line"},d,p)),o&&r.renderTickItem(o,f,i?i(t.value,n):t.value))});return c.createElement(h.m,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?c.createElement(h.m,{className:(0,m.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return c.isValidElement(e)?c.cloneElement(e,t):f()(e)?e(t):c.createElement(P.x,N({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&R(r.prototype,t),n&&R(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(c.PureComponent);F(_,"displayName","PolarAngleAxis"),F(_,"axisType","angleAxis"),F(_,"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 H=n(35802),z=n.n(H),V=n(37891),W=n.n(V),q=n(26680),G=["cx","cy","angle","ticks","axisLine"],$=["ticks","tick","angle","tickFormatter","stroke"];function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var l=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),c=ej(ej({},e),{},{startAngle:a+i,endAngle:a+l(r)+i});o.push(c),a=c.endAngle}else{var s=e.endAngle,d=e.startAngle,p=(0,eb.k4)(0,s-d)(r),f=ej(ej({},e),{},{startAngle:a+i,endAngle:a+p+i});o.push(f),a=f.endAngle}}),c.createElement(h.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ed()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,a=t.label,i=t.cx,l=t.cy,s=t.innerRadius,u=t.outerRadius,d=t.isAnimationActive,p=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(i)||!(0,eb.hj)(l)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var f=(0,m.Z)("recharts-pie",o);return c.createElement(h.m,{tabIndex:this.props.rootTabIndex,className:f,ref:function(t){e.pieRef=t}},this.renderSectors(),a&&this.renderLabels(r),q._.renderCallByParent(this.props,null,!1),(!d||p)&&eh.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?k:k-1)*u,w=i.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return w>0&&(t=i.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),a=(0,eg.F$)(e,p,t),i=((0,eb.hj)(o)?o:0)/w,s=(r=t?n.endAngle+(0,eb.uY)(v)*u*(0!==o?1:0):c)+(0,eb.uY)(v)*((0!==o?h:0)+i*x),d=(r+s)/2,f=(y.innerRadius+y.outerRadius)/2,b=[{name:a,value:o,payload:e,dataKey:g,type:m}],k=(0,L.op)(y.cx,y.cy,f,d);return n=ej(ej(ej({percent:i,cornerRadius:l,name:a,tooltipPayload:b,midAngle:d,middleRadius:f,tooltipPosition:k},e),y),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(v)*u})})),ej(ej({},y),{},{sectors:t,data:i})});var eD=(0,d.z)({chartName:"PieChart",GraphicalChild:eT,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:_},{axisType:"radiusAxis",AxisComp:ei}],formatAxisMap:L.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eR=n(8147),eM=n(92666),eI=n(98593);let eZ=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return c.createElement(eI.$B,null,c.createElement("div",{className:(0,i.q)("px-4 py-2")},c.createElement(eI.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eF=(e,t)=>e.map((e,n)=>{let r=ne||t((0,l.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:a,endAngle:i,className:l}=e;return c.createElement("g",null,c.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:a,endAngle:i,className:l,fill:"",opacity:.3,style:{outline:"none"}}))},e_=c.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:d="name",colors:p=a.s,variant:f="donut",valueFormatter:m=l.Cj,label:h,showLabel:y=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:k,onValueChange:x,customTooltip:w,className:A}=e,O=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),j="donut"==f,E=eB(h,m,n,s),[P,S]=c.useState(void 0),L=!!x;return(0,c.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[P]),c.createElement("div",Object.assign({ref:t,className:(0,i.q)("w-full h-40",A)},O),c.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?c.createElement(eD,{onClick:L&&P?()=>{S(void 0),null==x||x(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},y&&j?c.createElement("text",{className:(0,i.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},E):null,c.createElement(eT,{className:(0,i.q)("stroke-tremor-background dark:stroke-dark-tremor-background",x?"cursor-pointer":"cursor-default"),data:eF(n,p),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:j?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:d,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),L&&(P===t?(S(void 0),null==x||x(null)):(S(t),null==x||x(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:P,inactiveShape:eK,style:{outline:"none"}}),c.createElement(eR.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return w?c.createElement(w,{payload:null==r?void 0:r.map(e=>{var t,n,a;return Object.assign(Object.assign({},e),{color:null!==(a=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==a?a:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):c.createElement(eZ,{active:n,payload:r,valueFormatter:m})}:c.createElement(c.Fragment,null)})):c.createElement(eM.Z,{noDataText:k})))});e_.displayName="DonutChart"},59341:function(e,t,n){"use strict";n.d(t,{Z:function(){return T}});var r=n(5853),o=n(71049),a=n(11323),i=n(2265),l=n(66797),c=n(40099),s=n(74275),u=n(59456),d=n(93980),p=n(65573),f=n(67561),m=n(87550),h=n(628),y=n(80281),v=n(31370),b=n(20131),g=n(38929),k=n(52307),x=n(52724),w=n(7935);let A=(0,i.createContext)(null);A.displayName="GroupContext";let O=i.Fragment,j=Object.assign((0,g.yV)(function(e,t){var n;let r=(0,i.useId)(),O=(0,y.Q)(),j=(0,m.B)(),{id:E=O||"headlessui-switch-".concat(r),disabled:P=j||!1,checked:S,defaultChecked:L,onChange:C,name:N,value:T,form:D,autoFocus:R=!1,...M}=e,I=(0,i.useContext)(A),[Z,F]=(0,i.useState)(null),B=(0,i.useRef)(null),K=(0,f.T)(B,t,null===I?null:I.setSwitch,F),_=(0,s.L)(L),[H,z]=(0,c.q)(S,C,null!=_&&_),V=(0,u.G)(),[W,q]=(0,i.useState)(!1),G=(0,d.z)(()=>{q(!0),null==z||z(!H),V.nextFrame(()=>{q(!1)})}),$=(0,d.z)(e=>{if((0,v.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),G()}),X=(0,d.z)(e=>{e.key===x.R.Space?(e.preventDefault(),G()):e.key===x.R.Enter&&(0,b.g)(e.currentTarget)}),U=(0,d.z)(e=>e.preventDefault()),Y=(0,w.wp)(),Q=(0,k.zH)(),{isFocusVisible:J,focusProps:ee}=(0,o.F)({autoFocus:R}),{isHovered:et,hoverProps:en}=(0,a.X)({isDisabled:P}),{pressed:er,pressProps:eo}=(0,l.x)({disabled:P}),ea=(0,i.useMemo)(()=>({checked:H,disabled:P,hover:et,focus:J,active:er,autofocus:R,changing:W}),[H,et,J,er,P,W,R]),ei=(0,g.dG)({id:E,ref:K,role:"switch",type:(0,p.f)(e,Z),tabIndex:-1===e.tabIndex?0:null!=(n=e.tabIndex)?n:0,"aria-checked":H,"aria-labelledby":Y,"aria-describedby":Q,disabled:P||void 0,autoFocus:R,onClick:$,onKeyUp:X,onKeyPress:U},ee,en,eo),el=(0,i.useCallback)(()=>{if(void 0!==_)return null==z?void 0:z(_)},[z,_]),ec=(0,g.L6)();return i.createElement(i.Fragment,null,null!=N&&i.createElement(h.Mt,{disabled:P,data:{[N]:T||"on"},overrides:{type:"checkbox",checked:H},form:D,onReset:el}),ec({ourProps:ei,theirProps:M,slot:ea,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[n,r]=(0,i.useState)(null),[o,a]=(0,w.bE)(),[l,c]=(0,k.fw)(),s=(0,i.useMemo)(()=>({switch:n,setSwitch:r}),[n,r]),u=(0,g.L6)();return i.createElement(c,{name:"Switch.Description",value:l},i.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){n&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},i.createElement(A.Provider,{value:s},u({ourProps:{},theirProps:e,slot:{},defaultTag:O,name:"Switch.Group"}))))},Label:w.__,Description:k.dk});var E=n(44140),P=n(26898),S=n(13241),L=n(1153),C=n(47187);let N=(0,L.fn)("Switch"),T=i.forwardRef((e,t)=>{let{checked:n,defaultChecked:o=!1,onChange:a,color:l,name:c,error:s,errorMessage:u,disabled:d,required:p,tooltip:f,id:m}=e,h=(0,r._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),y={bgColor:l?(0,L.bM)(l,P.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:l?(0,L.bM)(l,P.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,b]=(0,E.Z)(o,n),[g,k]=(0,i.useState)(!1),{tooltipProps:x,getReferenceProps:w}=(0,C.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(C.Z,Object.assign({text:f},x)),i.createElement("div",Object.assign({ref:(0,L.lq)([t,x.refs.setReference]),className:(0,S.q)(N("root"),"flex flex-row relative h-5")},h,w),i.createElement("input",{type:"checkbox",className:(0,S.q)(N("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:c,required:p,checked:v,onChange:e=>{e.preventDefault()}}),i.createElement(j,{checked:v,onChange:e=>{b(e),null==a||a(e)},disabled:d,className:(0,S.q)(N("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",d?"cursor-not-allowed":""),onFocus:()=>k(!0),onBlur:()=>k(!1),id:m},i.createElement("span",{className:(0,S.q)(N("sr-only"),"sr-only")},"Switch ",v?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,S.q)(N("background"),v?y.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,S.q)(N("round"),v?(0,S.q)(y.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",g?(0,S.q)("ring-2",y.ringColor):"")}))),s&&u?i.createElement("p",{className:(0,S.q)(N("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});T.displayName="Switch"},10968:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(2265),o=n(36760),a=n.n(o),i=n(1119),l=n(26365),c=n(6989),s=n(11993),u=n(31686),d=n(41154),p=n(50506),f=n(18694),m=n(28791),h=n(66632),y=n(27380),v=function(e,t){if(!e)return null;var n={left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth,top:e.offsetTop,bottom:e.parentElement.clientHeight-e.clientHeight-e.offsetTop,height:e.clientHeight};return t?{left:0,right:0,width:0,top:n.top,bottom:n.bottom,height:n.height}:{left:n.left,right:n.right,width:n.width,top:0,bottom:0,height:0}},b=function(e){return void 0!==e?"".concat(e,"px"):void 0};function g(e){var t=e.prefixCls,n=e.containerRef,o=e.value,i=e.getValueIndex,c=e.motionName,s=e.onMotionStart,d=e.onMotionEnd,p=e.direction,f=e.vertical,g=void 0!==f&&f,k=r.useRef(null),x=r.useState(o),w=(0,l.Z)(x,2),A=w[0],O=w[1],j=function(e){var r,o=i(e),a=null===(r=n.current)||void 0===r?void 0:r.querySelectorAll(".".concat(t,"-item"))[o];return(null==a?void 0:a.offsetParent)&&a},E=r.useState(null),P=(0,l.Z)(E,2),S=P[0],L=P[1],C=r.useState(null),N=(0,l.Z)(C,2),T=N[0],D=N[1];(0,y.Z)(function(){if(A!==o){var e=j(A),t=j(o),n=v(e,g),r=v(t,g);O(o),L(n),D(r),e&&t?s():d()}},[o]);var R=r.useMemo(function(){if(g){var e;return b(null!==(e=null==S?void 0:S.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==S?void 0:S.right)):b(null==S?void 0:S.left)},[g,p,S]),M=r.useMemo(function(){if(g){var e;return b(null!==(e=null==T?void 0:T.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==T?void 0:T.right)):b(null==T?void 0:T.left)},[g,p,T]);return S&&T?r.createElement(h.ZP,{visible:!0,motionName:c,motionAppear:!0,onAppearStart:function(){return g?{transform:"translateY(var(--thumb-start-top))",height:"var(--thumb-start-height)"}:{transform:"translateX(var(--thumb-start-left))",width:"var(--thumb-start-width)"}},onAppearActive:function(){return g?{transform:"translateY(var(--thumb-active-top))",height:"var(--thumb-active-height)"}:{transform:"translateX(var(--thumb-active-left))",width:"var(--thumb-active-width)"}},onVisibleChanged:function(){L(null),D(null),d()}},function(e,n){var o=e.className,i=e.style,l=(0,u.Z)((0,u.Z)({},i),{},{"--thumb-start-left":R,"--thumb-start-width":b(null==S?void 0:S.width),"--thumb-active-left":M,"--thumb-active-width":b(null==T?void 0:T.width),"--thumb-start-top":R,"--thumb-start-height":b(null==S?void 0:S.height),"--thumb-active-top":M,"--thumb-active-height":b(null==T?void 0:T.height)}),c={ref:(0,m.sQ)(k,n),style:l,className:a()("".concat(t,"-thumb"),o)};return r.createElement("div",c)}):null}var k=["prefixCls","direction","vertical","options","disabled","defaultValue","value","name","onChange","className","motionName"],x=function(e){var t=e.prefixCls,n=e.className,o=e.disabled,i=e.checked,l=e.label,c=e.title,u=e.value,d=e.name,p=e.onChange,f=e.onFocus,m=e.onBlur,h=e.onKeyDown,y=e.onKeyUp,v=e.onMouseDown;return r.createElement("label",{className:a()(n,(0,s.Z)({},"".concat(t,"-item-disabled"),o)),onMouseDown:v},r.createElement("input",{name:d,className:"".concat(t,"-item-input"),type:"radio",disabled:o,checked:i,onChange:function(e){o||p(e,u)},onFocus:f,onBlur:m,onKeyDown:h,onKeyUp:y}),r.createElement("div",{className:"".concat(t,"-item-label"),title:c,"aria-selected":i},l))},w=r.forwardRef(function(e,t){var n,o,h=e.prefixCls,y=void 0===h?"rc-segmented":h,v=e.direction,b=e.vertical,w=e.options,A=void 0===w?[]:w,O=e.disabled,j=e.defaultValue,E=e.value,P=e.name,S=e.onChange,L=e.className,C=e.motionName,N=(0,c.Z)(e,k),T=r.useRef(null),D=r.useMemo(function(){return(0,m.sQ)(T,t)},[T,t]),R=r.useMemo(function(){return A.map(function(e){if("object"===(0,d.Z)(e)&&null!==e){var t=function(e){if(void 0!==e.title)return e.title;if("object"!==(0,d.Z)(e.label)){var t;return null===(t=e.label)||void 0===t?void 0:t.toString()}}(e);return(0,u.Z)((0,u.Z)({},e),{},{title:t})}return{label:null==e?void 0:e.toString(),title:null==e?void 0:e.toString(),value:e}})},[A]),M=(0,p.Z)(null===(n=R[0])||void 0===n?void 0:n.value,{value:E,defaultValue:j}),I=(0,l.Z)(M,2),Z=I[0],F=I[1],B=r.useState(!1),K=(0,l.Z)(B,2),_=K[0],H=K[1],z=function(e,t){F(t),null==S||S(t)},V=(0,f.Z)(N,["children"]),W=r.useState(!1),q=(0,l.Z)(W,2),G=q[0],$=q[1],X=r.useState(!1),U=(0,l.Z)(X,2),Y=U[0],Q=U[1],J=function(){Q(!0)},ee=function(){Q(!1)},et=function(){$(!1)},en=function(e){"Tab"===e.key&&$(!0)},er=function(e){var t=R.findIndex(function(e){return e.value===Z}),n=R.length,r=R[(t+e+n)%n];r&&(F(r.value),null==S||S(r.value))},eo=function(e){switch(e.key){case"ArrowLeft":case"ArrowUp":er(-1);break;case"ArrowRight":case"ArrowDown":er(1)}};return r.createElement("div",(0,i.Z)({role:"radiogroup","aria-label":"segmented control",tabIndex:O?void 0:0},V,{className:a()(y,(o={},(0,s.Z)(o,"".concat(y,"-rtl"),"rtl"===v),(0,s.Z)(o,"".concat(y,"-disabled"),O),(0,s.Z)(o,"".concat(y,"-vertical"),b),o),void 0===L?"":L),ref:D}),r.createElement("div",{className:"".concat(y,"-group")},r.createElement(g,{vertical:b,prefixCls:y,value:Z,containerRef:T,motionName:"".concat(y,"-").concat(void 0===C?"thumb-motion":C),direction:v,getValueIndex:function(e){return R.findIndex(function(t){return t.value===e})},onMotionStart:function(){H(!0)},onMotionEnd:function(){H(!1)}}),R.map(function(e){var t;return r.createElement(x,(0,i.Z)({},e,{name:P,key:e.value,prefixCls:y,className:a()(e.className,"".concat(y,"-item"),(t={},(0,s.Z)(t,"".concat(y,"-item-selected"),e.value===Z&&!_),(0,s.Z)(t,"".concat(y,"-item-focused"),Y&&G&&e.value===Z),t)),checked:e.value===Z,onChange:z,onFocus:J,onBlur:ee,onKeyDown:eo,onKeyUp:en,onMouseDown:et,disabled:!!O||!!e.disabled}))})))}),A=n(92491),O=n(71744),j=n(33759),E=n(93463),P=n(12918),S=n(99320),L=n(71140);function C(e,t){return{["".concat(e,", ").concat(e,":hover, ").concat(e,":focus")]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function N(e){return{background:e.itemSelectedBg,boxShadow:e.boxShadowTertiary}}let T=Object.assign({overflow:"hidden"},P.vS),D=e=>{let{componentCls:t}=e,n=e.calc(e.controlHeight).sub(e.calc(e.trackPadding).mul(2)).equal(),r=e.calc(e.controlHeightLG).sub(e.calc(e.trackPadding).mul(2)).equal(),o=e.calc(e.controlHeightSM).sub(e.calc(e.trackPadding).mul(2)).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,P.Wf)(e)),{display:"inline-block",padding:e.trackPadding,color:e.itemColor,background:e.trackBg,borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationMid)}),(0,P.Qy)(e)),{["".concat(t,"-group")]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",flexDirection:"row",width:"100%"},["&".concat(t,"-rtl")]:{direction:"rtl"},["&".concat(t,"-vertical")]:{["".concat(t,"-group")]:{flexDirection:"column"},["".concat(t,"-thumb")]:{width:"100%",height:0,padding:"0 ".concat((0,E.bf)(e.paddingXXS))}},["&".concat(t,"-block")]:{display:"flex"},["&".concat(t,"-block ").concat(t,"-item")]:{flex:1,minWidth:0},["".concat(t,"-item")]:{position:"relative",textAlign:"center",cursor:"pointer",transition:"color ".concat(e.motionDurationMid),borderRadius:e.borderRadiusSM,transform:"translateZ(0)","&-selected":Object.assign(Object.assign({},N(e)),{color:e.itemSelectedColor}),"&-focused":(0,P.oN)(e),"&::after":{content:'""',position:"absolute",zIndex:-1,width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",opacity:0,transition:"opacity ".concat(e.motionDurationMid,", background-color ").concat(e.motionDurationMid),pointerEvents:"none"},["&:not(".concat(t,"-item-selected):not(").concat(t,"-item-disabled)")]:{"&:hover, &:active":{color:e.itemHoverColor},"&:hover::after":{opacity:1,backgroundColor:e.itemHoverBg},"&:active::after":{opacity:1,backgroundColor:e.itemActiveBg}},"&-label":Object.assign({minHeight:n,lineHeight:(0,E.bf)(n),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal))},T),"&-icon + *":{marginInlineStart:e.calc(e.marginSM).div(2).equal()},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},["".concat(t,"-thumb")]:Object.assign(Object.assign({},N(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:"".concat((0,E.bf)(e.paddingXXS)," 0"),borderRadius:e.borderRadiusSM,["& ~ ".concat(t,"-item:not(").concat(t,"-item-selected):not(").concat(t,"-item-disabled)::after")]:{backgroundColor:"transparent"}}),["&".concat(t,"-lg")]:{borderRadius:e.borderRadiusLG,["".concat(t,"-item-label")]:{minHeight:r,lineHeight:(0,E.bf)(r),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal)),fontSize:e.fontSizeLG},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadius}},["&".concat(t,"-sm")]:{borderRadius:e.borderRadiusSM,["".concat(t,"-item-label")]:{minHeight:o,lineHeight:(0,E.bf)(o),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontalSM))},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadiusXS}}}),C("&-disabled ".concat(t,"-item"),e)),C("".concat(t,"-item-disabled"),e)),{["".concat(t,"-thumb-motion-appear-active")]:{transition:"transform ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,", width ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),willChange:"transform, width"},["&".concat(t,"-shape-round")]:{borderRadius:9999,["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:9999}}})}};var R=(0,S.I$)("Segmented",e=>{let{lineWidth:t,calc:n}=e;return D((0,L.IX)(e,{segmentedPaddingHorizontal:n(e.controlPaddingHorizontal).sub(t).equal(),segmentedPaddingHorizontalSM:n(e.controlPaddingHorizontalSM).sub(t).equal()}))},e=>{let{colorTextLabel:t,colorText:n,colorFillSecondary:r,colorBgElevated:o,colorFill:a,lineWidthBold:i,colorBgLayout:l}=e;return{trackPadding:i,trackBg:l,itemColor:t,itemHoverColor:n,itemHoverBg:r,itemSelectedBg:o,itemActiveBg:a,itemSelectedColor:n}}),M=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},I=r.forwardRef((e,t)=>{let n=(0,A.Z)(),{prefixCls:o,className:i,rootClassName:l,block:c,options:s=[],size:u="middle",style:d,vertical:p,shape:f="default",name:m=n}=e,h=M(e,["prefixCls","className","rootClassName","block","options","size","style","vertical","shape","name"]),{getPrefixCls:y,direction:v,className:b,style:g}=(0,O.dj)("segmented"),k=y("segmented",o),[x,E,P]=R(k),S=(0,j.Z)(u),L=r.useMemo(()=>s.map(e=>{if("object"==typeof e&&(null==e?void 0:e.icon)){let{icon:t,label:n}=e;return Object.assign(Object.assign({},M(e,["icon","label"])),{label:r.createElement(r.Fragment,null,r.createElement("span",{className:"".concat(k,"-item-icon")},t),n&&r.createElement("span",null,n))})}return e}),[s,k]),C=a()(i,l,b,{["".concat(k,"-block")]:c,["".concat(k,"-sm")]:"small"===S,["".concat(k,"-lg")]:"large"===S,["".concat(k,"-vertical")]:p,["".concat(k,"-shape-").concat(f)]:"round"===f},E,P),N=Object.assign(Object.assign({},g),d);return x(r.createElement(w,Object.assign({},h,{name:m,className:C,style:N,options:L,ref:t,prefixCls:k,direction:v,vertical:p})))})},35802:function(e,t,n){var r=n(67646),o=n(58905),a=n(88157);e.exports=function(e,t){return e&&e.length?r(e,a(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),a=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),a):void 0}},15051:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},49322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},99397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},32489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},54061:function(e,t,n){"use strict";n.d(t,{x:function(){return I}});var r=n(2265),o=n(84735),a=n(86757),i=n.n(a),l=n(77571),c=n.n(l),s=n(21652),u=n.n(s),d=n(87602),p=n(57165),f=n(81889),m=n(9841),h=n(58772),y=n(13137),v=n(16630),b=n(82944),g=n(34067),k=n(85355),x=["type","layout","connectNulls","ref"],w=["key"];function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j(){return(j=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ni){c=[].concat(S(r.slice(0,s)),[i-u]);break}var d=c.length%2==0?[0,l]:[l];return[].concat(S(a.repeat(r,Math.floor(t/o))),S(c),d).map(function(e){return"".concat(e,"px")}).join(", ")}),R(e,"id",(0,v.EL)("recharts-line-")),R(e,"pathRef",function(t){e.mainCurve=t}),R(e,"handleAnimationEnd",function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),R(e,"handleAnimationStart",function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}(a,e),t=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,o=n.points,a=n.xAxis,i=n.yAxis,l=n.layout,c=n.children,s=(0,b.NN)(c,y.W);if(!s)return null;var u=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:(0,k.F$)(e.payload,t)}};return r.createElement(m.m,{clipPath:e?"url(#clipPath-".concat(t,")"):null},s.map(function(e){return r.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:o,xAxis:a,yAxis:i,layout:l,dataPointFormatter:u})}))}},{key:"renderDots",value:function(e,t,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.dot,l=o.points,c=o.dataKey,s=(0,b.L6)(this.props,!1),u=(0,b.L6)(i,!0),d=l.map(function(e,t){var n=P(P(P({key:"dot-".concat(t),r:3},s),u),{},{index:t,cx:e.x,cy:e.y,value:e.value,dataKey:c,payload:e.payload,points:l});return a.renderDotItem(i,n)}),p={clipPath:e?"url(#clipPath-".concat(t?"":"dots-").concat(n,")"):null};return r.createElement(m.m,j({className:"recharts-line-dots",key:"dots"},p),d)}},{key:"renderCurveStatically",value:function(e,t,n,o){var a=this.props,i=a.type,l=a.layout,c=a.connectNulls,s=(a.ref,O(a,x)),u=P(P(P({},(0,b.L6)(s,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},o),{},{type:i,layout:l,connectNulls:c});return r.createElement(p.H,j({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,a=this.props,i=a.points,l=a.strokeDasharray,c=a.isAnimationActive,s=a.animationBegin,u=a.animationDuration,d=a.animationEasing,p=a.animationId,f=a.animateNewValues,m=a.width,h=a.height,y=this.state,b=y.prevPoints,g=y.totalLength;return r.createElement(o.ZP,{begin:s,duration:u,isActive:c,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o,a=r.t;if(b){var c=b.length/i.length,s=i.map(function(e,t){var n=Math.floor(t*c);if(b[n]){var r=b[n],o=(0,v.k4)(r.x,e.x),i=(0,v.k4)(r.y,e.y);return P(P({},e),{},{x:o(a),y:i(a)})}if(f){var l=(0,v.k4)(2*m,e.x),s=(0,v.k4)(h/2,e.y);return P(P({},e),{},{x:l(a),y:s(a)})}return P(P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(s,e,t)}var u=(0,v.k4)(0,g)(a);if(l){var d="".concat(l).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});o=n.getStrokeDasharray(u,g,d)}else o=n.generateSimpleStrokeDasharray(g,u);return n.renderCurveStatically(i,e,t,{strokeDasharray:o})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,o=n.isAnimationActive,a=this.state,i=a.prevPoints,l=a.totalLength;return o&&r&&r.length&&(!i&&l>0||!u()(i,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,o=t.dot,a=t.points,i=t.className,l=t.xAxis,s=t.yAxis,u=t.top,p=t.left,f=t.width,y=t.height,v=t.isAnimationActive,g=t.id;if(n||!a||!a.length)return null;var k=this.state.isAnimationFinished,x=1===a.length,w=(0,d.Z)("recharts-line",i),A=l&&l.allowDataOverflow,O=s&&s.allowDataOverflow,j=A||O,E=c()(g)?this.id:g,P=null!==(e=(0,b.L6)(o,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,C=((0,b.jf)(o)?o:{}).clipDot,N=void 0===C||C,T=2*(void 0===S?3:S)+(void 0===L?2:L);return r.createElement(m.m,{className:w},A||O?r.createElement("defs",null,r.createElement("clipPath",{id:"clipPath-".concat(E)},r.createElement("rect",{x:A?p:p-f/2,y:O?u:u-y/2,width:A?f:2*f,height:O?y:2*y})),!N&&r.createElement("clipPath",{id:"clipPath-dots-".concat(E)},r.createElement("rect",{x:p-T/2,y:u-T/2,width:f+T,height:y+T}))):null,!x&&this.renderCurve(j,E),this.renderErrorBar(j,E),(x||o)&&this.renderDots(j,N,E),(!v||k)&&h.e.renderCallByParent(this.props,a))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(S(e),[0]):e,r=[],o=0;o=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!b()(l,r)||!b()(c,o))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,o,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,a=t.points,i=t.className,c=t.top,s=t.left,u=t.xAxis,d=t.yAxis,p=t.width,f=t.height,h=t.isAnimationActive,y=t.id;if(n||!a||!a.length)return null;var v=this.state.isAnimationFinished,b=1===a.length,g=(0,l.Z)("recharts-area",i),k=u&&u.allowDataOverflow,A=d&&d.allowDataOverflow,O=k||A,j=m()(y)?this.id:y,P=null!==(e=(0,E.L6)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,C=((0,E.jf)(r)?r:{}).clipDot,N=void 0===C||C,T=2*(void 0===S?3:S)+(void 0===L?2:L);return o.createElement(x.m,{className:g},k||A?o.createElement("defs",null,o.createElement("clipPath",{id:"clipPath-".concat(j)},o.createElement("rect",{x:k?s:s-p/2,y:A?c:c-f/2,width:k?p:2*p,height:A?f:2*f})),!N&&o.createElement("clipPath",{id:"clipPath-dots-".concat(j)},o.createElement("rect",{x:s-T/2,y:c-T/2,width:p+T,height:f+T}))):null,b?null:this.renderArea(O,j),(r||b)&&this.renderDots(O,N,j),(!h||v)&&w.e.renderCallByParent(this.props,a))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],t&&R(r.prototype,t),n&&R(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(o.PureComponent);F(K,"displayName","Area"),F(K,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!A.x.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),F(K,"getBaseValue",function(e,t,n,r){var o=e.layout,a=e.baseValue,i=t.props.baseValue,l=null!=i?i:a;if((0,O.hj)(l)&&"number"==typeof l)return l;var c="horizontal"===o?r:n,s=c.scale.domain();if("number"===c.type){var u=Math.max(s[0],s[1]),d=Math.min(s[0],s[1]);return"dataMin"===l?d:"dataMax"===l?u:u<0?u:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===l?s[0]:"dataMax"===l?s[1]:s[0]}),F(K,"getComposedData",function(e){var t,n=e.props,r=e.item,o=e.xAxis,a=e.yAxis,i=e.xAxisTicks,l=e.yAxisTicks,c=e.bandSize,s=e.dataKey,u=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,m=n.layout,h=u&&u.length,y=K.getBaseValue(n,r,o,a),v="horizontal"===m,b=!1,g=p.map(function(e,t){h?n=u[d+t]:Array.isArray(n=(0,j.F$)(e,s))?b=!0:n=[y,n];var n,r=null==n[1]||h&&null==(0,j.F$)(e,s);return v?{x:(0,j.Hv)({axis:o,ticks:i,bandSize:c,entry:e,index:t}),y:r?null:a.scale(n[1]),value:n,payload:e}:{x:r?null:o.scale(n[1]),y:(0,j.Hv)({axis:a,ticks:l,bandSize:c,entry:e,index:t}),value:n,payload:e}});return t=h||b?g.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?a.scale(t):null}:{x:null!=t?o.scale(t):null,y:e.y}}):v?a.scale(y):o.scale(y),D({points:g,baseLine:t,layout:m,isRange:b},f)}),F(K,"renderDotItem",function(e,t){var n;if(o.isValidElement(e))n=o.cloneElement(e,t);else if(u()(e))n=e(t);else{var r=(0,l.Z)("recharts-area-dot","boolean"!=typeof e?e.className:""),a=t.key,i=C(t,S);n=o.createElement(k.o,N({},i,{key:a,className:r}))}return n});var _=n(97059),H=n(62994),z=n(25311),V=(0,i.z)({chartName:"AreaChart",GraphicalChild:K,axisComponents:[{axisType:"xAxis",AxisComp:_.K},{axisType:"yAxis",AxisComp:H.B}],formatAxisMap:z.t9}),W=n(56940),q=n(26680),G=n(8147),$=n(22190),X=n(54061),U=n(65278),Y=n(98593),Q=n(92666),J=n(32644),ee=n(7084),et=n(26898),en=n(13241),er=n(1153);let eo=o.forwardRef((e,t)=>{let{data:n=[],categories:i=[],index:l,stack:c=!1,colors:s=et.s,valueFormatter:u=er.Cj,startEndOnly:d=!1,showXAxis:p=!0,showYAxis:f=!0,yAxisWidth:m=56,intervalType:h="equidistantPreserveStart",showAnimation:y=!1,animationDuration:v=900,showTooltip:b=!0,showLegend:g=!0,showGridLines:x=!0,showGradient:w=!0,autoMinValue:A=!1,curveType:O="linear",minValue:j,maxValue:E,connectNulls:P=!1,allowDecimals:S=!0,noDataText:L,className:C,onValueChange:N,enableLegendSlider:T=!1,customTooltip:D,rotateLabelX:R,padding:M=(p||f)&&(!d||f)?{left:20,right:20}:{left:0,right:0},tickGap:I=5,xAxisLabel:Z,yAxisLabel:F}=e,B=(0,r._T)(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[z,eo]=(0,o.useState)(60),[ea,ei]=(0,o.useState)(void 0),[el,ec]=(0,o.useState)(void 0),es=(0,J.me)(i,s),eu=(0,J.i4)(A,j,E),ed=!!N;function ep(e){ed&&(e===el&&!ea||(0,J.FB)(n,e)&&ea&&ea.dataKey===e?(ec(void 0),null==N||N(null)):(ec(e),null==N||N({eventType:"category",categoryClicked:e})),ei(void 0))}return o.createElement("div",Object.assign({ref:t,className:(0,en.q)("w-full h-80",C)},B),o.createElement(a.h,{className:"h-full w-full"},(null==n?void 0:n.length)?o.createElement(V,{data:n,onClick:ed&&(el||ea)?()=>{ei(void 0),ec(void 0),null==N||N(null)}:void 0,margin:{bottom:Z?30:void 0,left:F?20:void 0,right:F?5:void 0,top:5}},x?o.createElement(W.q,{className:(0,en.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,o.createElement(_.K,{padding:M,hide:!p,dataKey:l,tick:{transform:"translate(0, 6)"},ticks:d?[n[0][l],n[n.length-1][l]]:void 0,fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:d?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:I,angle:null==R?void 0:R.angle,dy:null==R?void 0:R.verticalShift,height:null==R?void 0:R.xAxisHeight},Z&&o.createElement(q._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Z)),o.createElement(H.B,{width:m,hide:!f,axisLine:!1,tickLine:!1,type:"number",domain:eu,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u,allowDecimals:S},F&&o.createElement(q._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},F)),o.createElement(G.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?e=>{let{active:t,payload:n,label:r}=e;return D?o.createElement(D,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=es.get(e.dataKey))&&void 0!==t?t:ee.fr.Gray})}),active:t,label:r}):o.createElement(Y.ZP,{active:t,payload:n,label:r,valueFormatter:u,categoryColors:es})}:o.createElement(o.Fragment,null),position:{y:0}}),g?o.createElement($.D,{verticalAlign:"top",height:z,content:e=>{let{payload:t}=e;return(0,U.Z)({payload:t},es,eo,el,ed?e=>ep(e):void 0,T)}}):null,i.map(e=>{var t,n,r;let a=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement("defs",{key:e},w?o.createElement("linearGradient",{className:(0,er.bM)(null!==(n=es.get(e))&&void 0!==n?n:ee.fr.Gray,et.K.text).textColor,id:a,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:ea||el&&el!==e?.15:.4}),o.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):o.createElement("linearGradient",{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).textColor,id:a,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{stopColor:"currentColor",stopOpacity:ea||el&&el!==e?.1:.3})))}),i.map(e=>{var t,r;let a=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement(K,{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).strokeColor,strokeOpacity:ea||el&&el!==e?.3:1,activeDot:e=>{var t;let{cx:r,cy:a,stroke:i,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,dataKey:u}=e;return o.createElement(k.o,{className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",N?"cursor-pointer":"",(0,er.bM)(null!==(t=es.get(u))&&void 0!==t?t:ee.fr.Gray,et.K.text).fillColor),cx:r,cy:a,r:5,fill:"",stroke:i,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,onClick:(t,r)=>{r.stopPropagation(),ed&&(e.index===(null==ea?void 0:ea.index)&&e.dataKey===(null==ea?void 0:ea.dataKey)||(0,J.FB)(n,e.dataKey)&&el&&el===e.dataKey?(ec(void 0),ei(void 0),null==N||N(null)):(ec(e.dataKey),ei({index:e.index,dataKey:e.dataKey}),null==N||N(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var r;let{stroke:a,strokeLinecap:i,strokeLinejoin:l,strokeWidth:c,cx:s,cy:u,dataKey:d,index:p}=t;return(0,J.FB)(n,e)&&!(ea||el&&el!==e)||(null==ea?void 0:ea.index)===p&&(null==ea?void 0:ea.dataKey)===e?o.createElement(k.o,{key:p,cx:s,cy:u,r:5,stroke:a,fill:"",strokeLinecap:i,strokeLinejoin:l,strokeWidth:c,className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",N?"cursor-pointer":"",(0,er.bM)(null!==(r=es.get(d))&&void 0!==r?r:ee.fr.Gray,et.K.text).fillColor)}):o.createElement(o.Fragment,{key:p})},key:e,name:e,type:O,dataKey:e,stroke:"",fill:"url(#".concat(a,")"),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:y,animationDuration:v,stackId:c?"a":void 0,connectNulls:P})}),N?i.map(e=>o.createElement(X.x,{className:(0,en.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:O,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:P,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;ep(n)}})):null):o.createElement(Q.Z,{noDataText:L})))});eo.displayName="AreaChart"},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return e_}});var r=n(5853),o=n(7084),a=n(26898),i=n(13241),l=n(1153),c=n(2265),s=n(60474),u=n(47625),d=n(93765),p=n(86757),f=n.n(p),m=n(87602),h=n(9841),y=n(81889),v=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){w(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),w(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},O=function(e,t){var n=A(e);t&&(n=[n.reduce(function(e,t){return[].concat(k(e),k(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},j=function(e,t,n){var r=O(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(O(t.reverse(),n).slice(1))},E=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var i=(0,m.Z)("recharts-polygon",n);if(r&&r.length){var l=a.stroke&&"none"!==a.stroke,s=j(t,r,o);return c.createElement("g",{className:i},c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"Z"===s.slice(-1)?a.fill:"none",stroke:"none",d:s})),l?c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"none",d:O(t,o)})):null,l?c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"none",d:O(r,o)})):null)}var u=O(t,o);return c.createElement("path",g({},(0,v.L6)(a,!0),{fill:"Z"===u.slice(-1)?a.fill:"none",className:i,d:u}))},P=n(58811),S=n(41637),L=n(39206);function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function N(){return(N=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,a=e.axisLineType,i=D(D({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===a)return c.createElement(y.o,N({className:"recharts-polar-angle-axis-line"},i,{cx:t,cy:n,r:r}));var l=this.props.ticks.map(function(e){return(0,L.op)(t,n,r,e.coordinate)});return c.createElement(E,N({className:"recharts-polar-angle-axis-line"},i,{points:l}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,a=t.tickLine,i=t.tickFormatter,l=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(o,!1),d=D(D({},s),{},{fill:"none"},(0,v.L6)(a,!1)),p=n.map(function(t,n){var p=e.getTickLineCoord(t),f=D(D(D({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:l},u),{},{index:n,payload:t,x:p.x2,y:p.y2});return c.createElement(h.m,N({className:(0,m.Z)("recharts-polar-angle-axis-tick",(0,L.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),a&&c.createElement("line",N({className:"recharts-polar-angle-axis-tick-line"},d,p)),o&&r.renderTickItem(o,f,i?i(t.value,n):t.value))});return c.createElement(h.m,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?c.createElement(h.m,{className:(0,m.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return c.isValidElement(e)?c.cloneElement(e,t):f()(e)?e(t):c.createElement(P.x,N({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&R(r.prototype,t),n&&R(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(c.PureComponent);F(_,"displayName","PolarAngleAxis"),F(_,"axisType","angleAxis"),F(_,"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 H=n(35802),z=n.n(H),V=n(37891),W=n.n(V),q=n(26680),G=["cx","cy","angle","ticks","axisLine"],$=["ticks","tick","angle","tickFormatter","stroke"];function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var l=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),c=ej(ej({},e),{},{startAngle:a+i,endAngle:a+l(r)+i});o.push(c),a=c.endAngle}else{var s=e.endAngle,d=e.startAngle,p=(0,eb.k4)(0,s-d)(r),f=ej(ej({},e),{},{startAngle:a+i,endAngle:a+p+i});o.push(f),a=f.endAngle}}),c.createElement(h.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ed()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,a=t.label,i=t.cx,l=t.cy,s=t.innerRadius,u=t.outerRadius,d=t.isAnimationActive,p=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(i)||!(0,eb.hj)(l)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var f=(0,m.Z)("recharts-pie",o);return c.createElement(h.m,{tabIndex:this.props.rootTabIndex,className:f,ref:function(t){e.pieRef=t}},this.renderSectors(),a&&this.renderLabels(r),q._.renderCallByParent(this.props,null,!1),(!d||p)&&eh.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?k:k-1)*u,w=i.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return w>0&&(t=i.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),a=(0,eg.F$)(e,p,t),i=((0,eb.hj)(o)?o:0)/w,s=(r=t?n.endAngle+(0,eb.uY)(v)*u*(0!==o?1:0):c)+(0,eb.uY)(v)*((0!==o?h:0)+i*x),d=(r+s)/2,f=(y.innerRadius+y.outerRadius)/2,b=[{name:a,value:o,payload:e,dataKey:g,type:m}],k=(0,L.op)(y.cx,y.cy,f,d);return n=ej(ej(ej({percent:i,cornerRadius:l,name:a,tooltipPayload:b,midAngle:d,middleRadius:f,tooltipPosition:k},e),y),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(v)*u})})),ej(ej({},y),{},{sectors:t,data:i})});var eD=(0,d.z)({chartName:"PieChart",GraphicalChild:eT,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:_},{axisType:"radiusAxis",AxisComp:ei}],formatAxisMap:L.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eR=n(8147),eM=n(92666),eI=n(98593);let eZ=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return c.createElement(eI.$B,null,c.createElement("div",{className:(0,i.q)("px-4 py-2")},c.createElement(eI.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eF=(e,t)=>e.map((e,n)=>{let r=ne||t((0,l.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:a,endAngle:i,className:l}=e;return c.createElement("g",null,c.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:a,endAngle:i,className:l,fill:"",opacity:.3,style:{outline:"none"}}))},e_=c.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:d="name",colors:p=a.s,variant:f="donut",valueFormatter:m=l.Cj,label:h,showLabel:y=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:k,onValueChange:x,customTooltip:w,className:A}=e,O=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),j="donut"==f,E=eB(h,m,n,s),[P,S]=c.useState(void 0),L=!!x;return(0,c.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[P]),c.createElement("div",Object.assign({ref:t,className:(0,i.q)("w-full h-40",A)},O),c.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?c.createElement(eD,{onClick:L&&P?()=>{S(void 0),null==x||x(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},y&&j?c.createElement("text",{className:(0,i.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},E):null,c.createElement(eT,{className:(0,i.q)("stroke-tremor-background dark:stroke-dark-tremor-background",x?"cursor-pointer":"cursor-default"),data:eF(n,p),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:j?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:d,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),L&&(P===t?(S(void 0),null==x||x(null)):(S(t),null==x||x(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:P,inactiveShape:eK,style:{outline:"none"}}),c.createElement(eR.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return w?c.createElement(w,{payload:null==r?void 0:r.map(e=>{var t,n,a;return Object.assign(Object.assign({},e),{color:null!==(a=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==a?a:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):c.createElement(eZ,{active:n,payload:r,valueFormatter:m})}:c.createElement(c.Fragment,null)})):c.createElement(eM.Z,{noDataText:k})))});e_.displayName="DonutChart"},59341:function(e,t,n){"use strict";n.d(t,{Z:function(){return T}});var r=n(5853),o=n(71049),a=n(11323),i=n(2265),l=n(66797),c=n(40099),s=n(74275),u=n(59456),d=n(93980),p=n(65573),f=n(67561),m=n(87550),h=n(628),y=n(80281),v=n(31370),b=n(20131),g=n(38929),k=n(52307),x=n(52724),w=n(7935);let A=(0,i.createContext)(null);A.displayName="GroupContext";let O=i.Fragment,j=Object.assign((0,g.yV)(function(e,t){var n;let r=(0,i.useId)(),O=(0,y.Q)(),j=(0,m.B)(),{id:E=O||"headlessui-switch-".concat(r),disabled:P=j||!1,checked:S,defaultChecked:L,onChange:C,name:N,value:T,form:D,autoFocus:R=!1,...M}=e,I=(0,i.useContext)(A),[Z,F]=(0,i.useState)(null),B=(0,i.useRef)(null),K=(0,f.T)(B,t,null===I?null:I.setSwitch,F),_=(0,s.L)(L),[H,z]=(0,c.q)(S,C,null!=_&&_),V=(0,u.G)(),[W,q]=(0,i.useState)(!1),G=(0,d.z)(()=>{q(!0),null==z||z(!H),V.nextFrame(()=>{q(!1)})}),$=(0,d.z)(e=>{if((0,v.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),G()}),X=(0,d.z)(e=>{e.key===x.R.Space?(e.preventDefault(),G()):e.key===x.R.Enter&&(0,b.g)(e.currentTarget)}),U=(0,d.z)(e=>e.preventDefault()),Y=(0,w.wp)(),Q=(0,k.zH)(),{isFocusVisible:J,focusProps:ee}=(0,o.F)({autoFocus:R}),{isHovered:et,hoverProps:en}=(0,a.X)({isDisabled:P}),{pressed:er,pressProps:eo}=(0,l.x)({disabled:P}),ea=(0,i.useMemo)(()=>({checked:H,disabled:P,hover:et,focus:J,active:er,autofocus:R,changing:W}),[H,et,J,er,P,W,R]),ei=(0,g.dG)({id:E,ref:K,role:"switch",type:(0,p.f)(e,Z),tabIndex:-1===e.tabIndex?0:null!=(n=e.tabIndex)?n:0,"aria-checked":H,"aria-labelledby":Y,"aria-describedby":Q,disabled:P||void 0,autoFocus:R,onClick:$,onKeyUp:X,onKeyPress:U},ee,en,eo),el=(0,i.useCallback)(()=>{if(void 0!==_)return null==z?void 0:z(_)},[z,_]),ec=(0,g.L6)();return i.createElement(i.Fragment,null,null!=N&&i.createElement(h.Mt,{disabled:P,data:{[N]:T||"on"},overrides:{type:"checkbox",checked:H},form:D,onReset:el}),ec({ourProps:ei,theirProps:M,slot:ea,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[n,r]=(0,i.useState)(null),[o,a]=(0,w.bE)(),[l,c]=(0,k.fw)(),s=(0,i.useMemo)(()=>({switch:n,setSwitch:r}),[n,r]),u=(0,g.L6)();return i.createElement(c,{name:"Switch.Description",value:l},i.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){n&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},i.createElement(A.Provider,{value:s},u({ourProps:{},theirProps:e,slot:{},defaultTag:O,name:"Switch.Group"}))))},Label:w.__,Description:k.dk});var E=n(44140),P=n(26898),S=n(13241),L=n(1153),C=n(47187);let N=(0,L.fn)("Switch"),T=i.forwardRef((e,t)=>{let{checked:n,defaultChecked:o=!1,onChange:a,color:l,name:c,error:s,errorMessage:u,disabled:d,required:p,tooltip:f,id:m}=e,h=(0,r._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),y={bgColor:l?(0,L.bM)(l,P.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:l?(0,L.bM)(l,P.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,b]=(0,E.Z)(o,n),[g,k]=(0,i.useState)(!1),{tooltipProps:x,getReferenceProps:w}=(0,C.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(C.Z,Object.assign({text:f},x)),i.createElement("div",Object.assign({ref:(0,L.lq)([t,x.refs.setReference]),className:(0,S.q)(N("root"),"flex flex-row relative h-5")},h,w),i.createElement("input",{type:"checkbox",className:(0,S.q)(N("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:c,required:p,checked:v,onChange:e=>{e.preventDefault()}}),i.createElement(j,{checked:v,onChange:e=>{b(e),null==a||a(e)},disabled:d,className:(0,S.q)(N("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",d?"cursor-not-allowed":""),onFocus:()=>k(!0),onBlur:()=>k(!1),id:m},i.createElement("span",{className:(0,S.q)(N("sr-only"),"sr-only")},"Switch ",v?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,S.q)(N("background"),v?y.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,S.q)(N("round"),v?(0,S.q)(y.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",g?(0,S.q)("ring-2",y.ringColor):"")}))),s&&u?i.createElement("p",{className:(0,S.q)(N("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});T.displayName="Switch"},10968:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(2265),o=n(36760),a=n.n(o),i=n(1119),l=n(26365),c=n(6989),s=n(11993),u=n(31686),d=n(41154),p=n(50506),f=n(18694),m=n(28791),h=n(66632),y=n(27380),v=function(e,t){if(!e)return null;var n={left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth,top:e.offsetTop,bottom:e.parentElement.clientHeight-e.clientHeight-e.offsetTop,height:e.clientHeight};return t?{left:0,right:0,width:0,top:n.top,bottom:n.bottom,height:n.height}:{left:n.left,right:n.right,width:n.width,top:0,bottom:0,height:0}},b=function(e){return void 0!==e?"".concat(e,"px"):void 0};function g(e){var t=e.prefixCls,n=e.containerRef,o=e.value,i=e.getValueIndex,c=e.motionName,s=e.onMotionStart,d=e.onMotionEnd,p=e.direction,f=e.vertical,g=void 0!==f&&f,k=r.useRef(null),x=r.useState(o),w=(0,l.Z)(x,2),A=w[0],O=w[1],j=function(e){var r,o=i(e),a=null===(r=n.current)||void 0===r?void 0:r.querySelectorAll(".".concat(t,"-item"))[o];return(null==a?void 0:a.offsetParent)&&a},E=r.useState(null),P=(0,l.Z)(E,2),S=P[0],L=P[1],C=r.useState(null),N=(0,l.Z)(C,2),T=N[0],D=N[1];(0,y.Z)(function(){if(A!==o){var e=j(A),t=j(o),n=v(e,g),r=v(t,g);O(o),L(n),D(r),e&&t?s():d()}},[o]);var R=r.useMemo(function(){if(g){var e;return b(null!==(e=null==S?void 0:S.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==S?void 0:S.right)):b(null==S?void 0:S.left)},[g,p,S]),M=r.useMemo(function(){if(g){var e;return b(null!==(e=null==T?void 0:T.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==T?void 0:T.right)):b(null==T?void 0:T.left)},[g,p,T]);return S&&T?r.createElement(h.ZP,{visible:!0,motionName:c,motionAppear:!0,onAppearStart:function(){return g?{transform:"translateY(var(--thumb-start-top))",height:"var(--thumb-start-height)"}:{transform:"translateX(var(--thumb-start-left))",width:"var(--thumb-start-width)"}},onAppearActive:function(){return g?{transform:"translateY(var(--thumb-active-top))",height:"var(--thumb-active-height)"}:{transform:"translateX(var(--thumb-active-left))",width:"var(--thumb-active-width)"}},onVisibleChanged:function(){L(null),D(null),d()}},function(e,n){var o=e.className,i=e.style,l=(0,u.Z)((0,u.Z)({},i),{},{"--thumb-start-left":R,"--thumb-start-width":b(null==S?void 0:S.width),"--thumb-active-left":M,"--thumb-active-width":b(null==T?void 0:T.width),"--thumb-start-top":R,"--thumb-start-height":b(null==S?void 0:S.height),"--thumb-active-top":M,"--thumb-active-height":b(null==T?void 0:T.height)}),c={ref:(0,m.sQ)(k,n),style:l,className:a()("".concat(t,"-thumb"),o)};return r.createElement("div",c)}):null}var k=["prefixCls","direction","vertical","options","disabled","defaultValue","value","name","onChange","className","motionName"],x=function(e){var t=e.prefixCls,n=e.className,o=e.disabled,i=e.checked,l=e.label,c=e.title,u=e.value,d=e.name,p=e.onChange,f=e.onFocus,m=e.onBlur,h=e.onKeyDown,y=e.onKeyUp,v=e.onMouseDown;return r.createElement("label",{className:a()(n,(0,s.Z)({},"".concat(t,"-item-disabled"),o)),onMouseDown:v},r.createElement("input",{name:d,className:"".concat(t,"-item-input"),type:"radio",disabled:o,checked:i,onChange:function(e){o||p(e,u)},onFocus:f,onBlur:m,onKeyDown:h,onKeyUp:y}),r.createElement("div",{className:"".concat(t,"-item-label"),title:c,"aria-selected":i},l))},w=r.forwardRef(function(e,t){var n,o,h=e.prefixCls,y=void 0===h?"rc-segmented":h,v=e.direction,b=e.vertical,w=e.options,A=void 0===w?[]:w,O=e.disabled,j=e.defaultValue,E=e.value,P=e.name,S=e.onChange,L=e.className,C=e.motionName,N=(0,c.Z)(e,k),T=r.useRef(null),D=r.useMemo(function(){return(0,m.sQ)(T,t)},[T,t]),R=r.useMemo(function(){return A.map(function(e){if("object"===(0,d.Z)(e)&&null!==e){var t=function(e){if(void 0!==e.title)return e.title;if("object"!==(0,d.Z)(e.label)){var t;return null===(t=e.label)||void 0===t?void 0:t.toString()}}(e);return(0,u.Z)((0,u.Z)({},e),{},{title:t})}return{label:null==e?void 0:e.toString(),title:null==e?void 0:e.toString(),value:e}})},[A]),M=(0,p.Z)(null===(n=R[0])||void 0===n?void 0:n.value,{value:E,defaultValue:j}),I=(0,l.Z)(M,2),Z=I[0],F=I[1],B=r.useState(!1),K=(0,l.Z)(B,2),_=K[0],H=K[1],z=function(e,t){F(t),null==S||S(t)},V=(0,f.Z)(N,["children"]),W=r.useState(!1),q=(0,l.Z)(W,2),G=q[0],$=q[1],X=r.useState(!1),U=(0,l.Z)(X,2),Y=U[0],Q=U[1],J=function(){Q(!0)},ee=function(){Q(!1)},et=function(){$(!1)},en=function(e){"Tab"===e.key&&$(!0)},er=function(e){var t=R.findIndex(function(e){return e.value===Z}),n=R.length,r=R[(t+e+n)%n];r&&(F(r.value),null==S||S(r.value))},eo=function(e){switch(e.key){case"ArrowLeft":case"ArrowUp":er(-1);break;case"ArrowRight":case"ArrowDown":er(1)}};return r.createElement("div",(0,i.Z)({role:"radiogroup","aria-label":"segmented control",tabIndex:O?void 0:0},V,{className:a()(y,(o={},(0,s.Z)(o,"".concat(y,"-rtl"),"rtl"===v),(0,s.Z)(o,"".concat(y,"-disabled"),O),(0,s.Z)(o,"".concat(y,"-vertical"),b),o),void 0===L?"":L),ref:D}),r.createElement("div",{className:"".concat(y,"-group")},r.createElement(g,{vertical:b,prefixCls:y,value:Z,containerRef:T,motionName:"".concat(y,"-").concat(void 0===C?"thumb-motion":C),direction:v,getValueIndex:function(e){return R.findIndex(function(t){return t.value===e})},onMotionStart:function(){H(!0)},onMotionEnd:function(){H(!1)}}),R.map(function(e){var t;return r.createElement(x,(0,i.Z)({},e,{name:P,key:e.value,prefixCls:y,className:a()(e.className,"".concat(y,"-item"),(t={},(0,s.Z)(t,"".concat(y,"-item-selected"),e.value===Z&&!_),(0,s.Z)(t,"".concat(y,"-item-focused"),Y&&G&&e.value===Z),t)),checked:e.value===Z,onChange:z,onFocus:J,onBlur:ee,onKeyDown:eo,onKeyUp:en,onMouseDown:et,disabled:!!O||!!e.disabled}))})))}),A=n(92491),O=n(71744),j=n(33759),E=n(93463),P=n(12918),S=n(99320),L=n(71140);function C(e,t){return{["".concat(e,", ").concat(e,":hover, ").concat(e,":focus")]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function N(e){return{background:e.itemSelectedBg,boxShadow:e.boxShadowTertiary}}let T=Object.assign({overflow:"hidden"},P.vS),D=e=>{let{componentCls:t}=e,n=e.calc(e.controlHeight).sub(e.calc(e.trackPadding).mul(2)).equal(),r=e.calc(e.controlHeightLG).sub(e.calc(e.trackPadding).mul(2)).equal(),o=e.calc(e.controlHeightSM).sub(e.calc(e.trackPadding).mul(2)).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,P.Wf)(e)),{display:"inline-block",padding:e.trackPadding,color:e.itemColor,background:e.trackBg,borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationMid)}),(0,P.Qy)(e)),{["".concat(t,"-group")]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",flexDirection:"row",width:"100%"},["&".concat(t,"-rtl")]:{direction:"rtl"},["&".concat(t,"-vertical")]:{["".concat(t,"-group")]:{flexDirection:"column"},["".concat(t,"-thumb")]:{width:"100%",height:0,padding:"0 ".concat((0,E.bf)(e.paddingXXS))}},["&".concat(t,"-block")]:{display:"flex"},["&".concat(t,"-block ").concat(t,"-item")]:{flex:1,minWidth:0},["".concat(t,"-item")]:{position:"relative",textAlign:"center",cursor:"pointer",transition:"color ".concat(e.motionDurationMid),borderRadius:e.borderRadiusSM,transform:"translateZ(0)","&-selected":Object.assign(Object.assign({},N(e)),{color:e.itemSelectedColor}),"&-focused":(0,P.oN)(e),"&::after":{content:'""',position:"absolute",zIndex:-1,width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",opacity:0,transition:"opacity ".concat(e.motionDurationMid,", background-color ").concat(e.motionDurationMid),pointerEvents:"none"},["&:not(".concat(t,"-item-selected):not(").concat(t,"-item-disabled)")]:{"&:hover, &:active":{color:e.itemHoverColor},"&:hover::after":{opacity:1,backgroundColor:e.itemHoverBg},"&:active::after":{opacity:1,backgroundColor:e.itemActiveBg}},"&-label":Object.assign({minHeight:n,lineHeight:(0,E.bf)(n),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal))},T),"&-icon + *":{marginInlineStart:e.calc(e.marginSM).div(2).equal()},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},["".concat(t,"-thumb")]:Object.assign(Object.assign({},N(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:"".concat((0,E.bf)(e.paddingXXS)," 0"),borderRadius:e.borderRadiusSM,["& ~ ".concat(t,"-item:not(").concat(t,"-item-selected):not(").concat(t,"-item-disabled)::after")]:{backgroundColor:"transparent"}}),["&".concat(t,"-lg")]:{borderRadius:e.borderRadiusLG,["".concat(t,"-item-label")]:{minHeight:r,lineHeight:(0,E.bf)(r),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal)),fontSize:e.fontSizeLG},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadius}},["&".concat(t,"-sm")]:{borderRadius:e.borderRadiusSM,["".concat(t,"-item-label")]:{minHeight:o,lineHeight:(0,E.bf)(o),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontalSM))},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadiusXS}}}),C("&-disabled ".concat(t,"-item"),e)),C("".concat(t,"-item-disabled"),e)),{["".concat(t,"-thumb-motion-appear-active")]:{transition:"transform ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,", width ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),willChange:"transform, width"},["&".concat(t,"-shape-round")]:{borderRadius:9999,["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:9999}}})}};var R=(0,S.I$)("Segmented",e=>{let{lineWidth:t,calc:n}=e;return D((0,L.IX)(e,{segmentedPaddingHorizontal:n(e.controlPaddingHorizontal).sub(t).equal(),segmentedPaddingHorizontalSM:n(e.controlPaddingHorizontalSM).sub(t).equal()}))},e=>{let{colorTextLabel:t,colorText:n,colorFillSecondary:r,colorBgElevated:o,colorFill:a,lineWidthBold:i,colorBgLayout:l}=e;return{trackPadding:i,trackBg:l,itemColor:t,itemHoverColor:n,itemHoverBg:r,itemSelectedBg:o,itemActiveBg:a,itemSelectedColor:n}}),M=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},I=r.forwardRef((e,t)=>{let n=(0,A.Z)(),{prefixCls:o,className:i,rootClassName:l,block:c,options:s=[],size:u="middle",style:d,vertical:p,shape:f="default",name:m=n}=e,h=M(e,["prefixCls","className","rootClassName","block","options","size","style","vertical","shape","name"]),{getPrefixCls:y,direction:v,className:b,style:g}=(0,O.dj)("segmented"),k=y("segmented",o),[x,E,P]=R(k),S=(0,j.Z)(u),L=r.useMemo(()=>s.map(e=>{if("object"==typeof e&&(null==e?void 0:e.icon)){let{icon:t,label:n}=e;return Object.assign(Object.assign({},M(e,["icon","label"])),{label:r.createElement(r.Fragment,null,r.createElement("span",{className:"".concat(k,"-item-icon")},t),n&&r.createElement("span",null,n))})}return e}),[s,k]),C=a()(i,l,b,{["".concat(k,"-block")]:c,["".concat(k,"-sm")]:"small"===S,["".concat(k,"-lg")]:"large"===S,["".concat(k,"-vertical")]:p,["".concat(k,"-shape-").concat(f)]:"round"===f},E,P),N=Object.assign(Object.assign({},g),d);return x(r.createElement(w,Object.assign({},h,{name:m,className:C,style:N,options:L,ref:t,prefixCls:k,direction:v,vertical:p})))})},35802:function(e,t,n){var r=n(67646),o=n(58905),a=n(88157);e.exports=function(e,t){return e&&e.length?r(e,a(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),a=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),a):void 0}},15051:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},49322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},99397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},32489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},54061:function(e,t,n){"use strict";n.d(t,{x:function(){return I}});var r=n(2265),o=n(84735),a=n(86757),i=n.n(a),l=n(77571),c=n.n(l),s=n(21652),u=n.n(s),d=n(87602),p=n(57165),f=n(81889),m=n(9841),h=n(58772),y=n(13137),v=n(16630),b=n(82944),g=n(34067),k=n(85355),x=["type","layout","connectNulls","ref"],w=["key"];function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j(){return(j=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ni){c=[].concat(S(r.slice(0,s)),[i-u]);break}var d=c.length%2==0?[0,l]:[l];return[].concat(S(a.repeat(r,Math.floor(t/o))),S(c),d).map(function(e){return"".concat(e,"px")}).join(", ")}),R(e,"id",(0,v.EL)("recharts-line-")),R(e,"pathRef",function(t){e.mainCurve=t}),R(e,"handleAnimationEnd",function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),R(e,"handleAnimationStart",function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}(a,e),t=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,o=n.points,a=n.xAxis,i=n.yAxis,l=n.layout,c=n.children,s=(0,b.NN)(c,y.W);if(!s)return null;var u=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:(0,k.F$)(e.payload,t)}};return r.createElement(m.m,{clipPath:e?"url(#clipPath-".concat(t,")"):null},s.map(function(e){return r.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:o,xAxis:a,yAxis:i,layout:l,dataPointFormatter:u})}))}},{key:"renderDots",value:function(e,t,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.dot,l=o.points,c=o.dataKey,s=(0,b.L6)(this.props,!1),u=(0,b.L6)(i,!0),d=l.map(function(e,t){var n=P(P(P({key:"dot-".concat(t),r:3},s),u),{},{index:t,cx:e.x,cy:e.y,value:e.value,dataKey:c,payload:e.payload,points:l});return a.renderDotItem(i,n)}),p={clipPath:e?"url(#clipPath-".concat(t?"":"dots-").concat(n,")"):null};return r.createElement(m.m,j({className:"recharts-line-dots",key:"dots"},p),d)}},{key:"renderCurveStatically",value:function(e,t,n,o){var a=this.props,i=a.type,l=a.layout,c=a.connectNulls,s=(a.ref,O(a,x)),u=P(P(P({},(0,b.L6)(s,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},o),{},{type:i,layout:l,connectNulls:c});return r.createElement(p.H,j({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,a=this.props,i=a.points,l=a.strokeDasharray,c=a.isAnimationActive,s=a.animationBegin,u=a.animationDuration,d=a.animationEasing,p=a.animationId,f=a.animateNewValues,m=a.width,h=a.height,y=this.state,b=y.prevPoints,g=y.totalLength;return r.createElement(o.ZP,{begin:s,duration:u,isActive:c,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o,a=r.t;if(b){var c=b.length/i.length,s=i.map(function(e,t){var n=Math.floor(t*c);if(b[n]){var r=b[n],o=(0,v.k4)(r.x,e.x),i=(0,v.k4)(r.y,e.y);return P(P({},e),{},{x:o(a),y:i(a)})}if(f){var l=(0,v.k4)(2*m,e.x),s=(0,v.k4)(h/2,e.y);return P(P({},e),{},{x:l(a),y:s(a)})}return P(P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(s,e,t)}var u=(0,v.k4)(0,g)(a);if(l){var d="".concat(l).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});o=n.getStrokeDasharray(u,g,d)}else o=n.generateSimpleStrokeDasharray(g,u);return n.renderCurveStatically(i,e,t,{strokeDasharray:o})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,o=n.isAnimationActive,a=this.state,i=a.prevPoints,l=a.totalLength;return o&&r&&r.length&&(!i&&l>0||!u()(i,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,o=t.dot,a=t.points,i=t.className,l=t.xAxis,s=t.yAxis,u=t.top,p=t.left,f=t.width,y=t.height,v=t.isAnimationActive,g=t.id;if(n||!a||!a.length)return null;var k=this.state.isAnimationFinished,x=1===a.length,w=(0,d.Z)("recharts-line",i),A=l&&l.allowDataOverflow,O=s&&s.allowDataOverflow,j=A||O,E=c()(g)?this.id:g,P=null!==(e=(0,b.L6)(o,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,C=((0,b.jf)(o)?o:{}).clipDot,N=void 0===C||C,T=2*(void 0===S?3:S)+(void 0===L?2:L);return r.createElement(m.m,{className:w},A||O?r.createElement("defs",null,r.createElement("clipPath",{id:"clipPath-".concat(E)},r.createElement("rect",{x:A?p:p-f/2,y:O?u:u-y/2,width:A?f:2*f,height:O?y:2*y})),!N&&r.createElement("clipPath",{id:"clipPath-dots-".concat(E)},r.createElement("rect",{x:p-T/2,y:u-T/2,width:f+T,height:y+T}))):null,!x&&this.renderCurve(j,E),this.renderErrorBar(j,E),(x||o)&&this.renderDots(j,N,E),(!v||k)&&h.e.renderCallByParent(this.props,a))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(S(e),[0]):e,r=[],o=0;o{let{placeholder:l,value:s,onChange:r,icon:d,className:c}=e,[m,u]=(0,o.useState)(s);(0,o.useEffect)(()=>{u(s)},[s]);let x=(0,o.useMemo)(()=>n()(e=>r(e),300),[r]);(0,o.useEffect)(()=>()=>{x.cancel()},[x]);let h=(0,o.useCallback)(e=>{let l=e.target.value;u(l),x(l)},[x]);return(0,i.jsx)(t.default,{placeholder:l,value:m,onChange:h,prefix:d?(0,i.jsx)(d,{size:16,className:"text-gray-500"}):void 0,className:(0,a.cx)("w-64",c)})}},51205:function(e,l,s){s.d(l,{c:function(){return n}});var i=s(57437),a=s(33866),t=s(5545),r=s(3577);s(2265);let n=e=>{let{onClick:l,active:s,hasActiveFilters:n,label:o="Filters"}=e;return(0,i.jsx)(a.Z,{color:"blue",dot:n,children:(0,i.jsx)(t.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(r.Z,{size:16}),className:s?"bg-gray-100":"",children:o})})}},57716:function(e,l,s){s.d(l,{z:function(){return r}});var i=s(57437),a=s(5545),t=s(69076);s(2265);let r=e=>{let{onClick:l,label:s="Reset Filters"}=e;return(0,i.jsx)(a.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(t.Z,{size:16}),children:s})}},35706:function(e,l,s){s.d(l,{Z:function(){return ed},g:function(){return eo}});var i=s(57437),a=s(56083),t=s(51205),r=s(57716),n=s(73247),o=s(92369),d=e=>{let{filters:l,showFilters:s,onToggleFilters:d,onChange:c,onReset:m}=e,u=!!(l.org_id||l.org_alias);return(0,i.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsx)(a.H,{placeholder:"Search by Organization Name",value:l.org_alias,onChange:e=>c("org_alias",e),icon:n.Z,className:"w-64"}),(0,i.jsx)(t.c,{onClick:()=>d(!s),active:s,hasActiveFilters:u}),(0,i.jsx)(r.z,{onClick:m})]}),s&&(0,i.jsx)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:(0,i.jsx)(a.H,{placeholder:"Search by Organization ID",value:l.org_id,onChange:e=>c("org_id",e),icon:o.Z,className:"w-64"})})]})},c=s(15424),m=s(23628),u=s(86462),x=s(47686),h=s(41649),_=s(78489),g=s(12514),j=s(49804),p=s(67101),v=s(47323),Z=s(12485),b=s(18135),f=s(35242),w=s(29706),z=s(77991),y=s(21626),N=s(97214),C=s(28241),S=s(58834),O=s(69552),k=s(71876),M=s(84264),I=s(49566),F=s(10032),P=s(99981),A=s(22116),T=s(37592),D=s(4260),L=s(2265),E=s(59872),R=s(21609),U=s(39957),V=s(46468),B=s(97492),q=s(8156),G=s(9114),W=s(19250),$=s(47359),H=s(29299),J=s(77331),Q=s(53410),Y=s(74998),K=s(96761),X=s(5545),ee=s(30401),el=s(78867),es=s(33860),ei=s(60131),ea=s(24199),et=s(36894),er=s(97415),en=e=>{var l,s,a,t;let{organizationId:r,onClose:n,accessToken:o,is_org_admin:d,is_proxy_admin:c,userModels:m,editOrg:u}=e,[x,j]=(0,L.useState)(null),[P,A]=(0,L.useState)(!0),[R]=F.Z.useForm(),[U,V]=(0,L.useState)(!1),[en,eo]=(0,L.useState)(!1),[ed,ec]=(0,L.useState)(!1),[em,eu]=(0,L.useState)(null),[ex,eh]=(0,L.useState)({}),[e_,eg]=(0,L.useState)(!1),ej=d||c,{data:ep}=(0,$.y2)(),ev=(0,L.useMemo)(()=>(0,H.O)(ep),[ep]),eZ=async()=>{try{if(A(!0),!o)return;let e=await (0,W.organizationInfoCall)(o,r);j(e)}catch(e){G.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{A(!1)}};(0,L.useEffect)(()=>{eZ()},[r,o]);let eb=async e=>{try{if(null==o)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,W.organizationMemberAddCall)(o,r,l),G.Z.success("Organization member added successfully"),eo(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ef=async e=>{try{if(!o)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,W.organizationMemberUpdateCall)(o,r,l),G.Z.success("Organization member updated successfully"),ec(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},ew=async e=>{try{if(!o)return;await (0,W.organizationMemberDeleteCall)(o,r,e.user_id),G.Z.success("Organization member deleted successfully"),ec(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},ez=async e=>{try{if(!o)return;eg(!0);let l={organization_id:r,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==x?void 0:x.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,W.organizationUpdateCall)(o,l),G.Z.success("Organization settings updated successfully"),V(!1),eZ()}catch(e){G.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{eg(!1)}};if(P)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!x)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ey=async(e,l)=>{await (0,E.vQ)(e)&&(eh(e=>({...e,[l]:!0})),setTimeout(()=>{eh(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(_.Z,{icon:J.Z,onClick:n,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(K.Z,{children:x.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(M.Z,{className:"text-gray-500 font-mono",children:x.organization_id}),(0,i.jsx)(X.ZP,{type:"text",size:"small",icon:ex["org-id"]?(0,i.jsx)(ee.Z,{size:12}):(0,i.jsx)(el.Z,{size:12}),onClick:()=>ey(x.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(ex["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(b.Z,{defaultIndex:u?2:0,children:[(0,i.jsxs)(f.Z,{className:"mb-4",children:[(0,i.jsx)(Z.Z,{children:"Overview"}),(0,i.jsx)(Z.Z,{children:"Members"}),(0,i.jsx)(Z.Z,{children:"Settings"})]}),(0,i.jsxs)(z.Z,{children:[(0,i.jsx)(w.Z,{children:(0,i.jsxs)(p.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(M.Z,{children:["Created: ",new Date(x.created_at).toLocaleDateString()]}),(0,i.jsxs)(M.Z,{children:["Updated: ",new Date(x.updated_at).toLocaleDateString()]}),(0,i.jsxs)(M.Z,{children:["Created By: ",x.created_by]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(K.Z,{children:["$",(0,E.pw)(x.spend,4)]}),(0,i.jsxs)(M.Z,{children:["of"," ",null===x.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,E.pw)(x.litellm_budget_table.max_budget,4))]}),x.litellm_budget_table.budget_duration&&(0,i.jsxs)(M.Z,{className:"text-gray-500",children:["Reset: ",x.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(M.Z,{children:["TPM: ",x.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(M.Z,{children:["RPM: ",x.litellm_budget_table.rpm_limit||"Unlimited"]}),x.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(M.Z,{children:["Max Parallel Requests: ",x.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===x.models.length?(0,i.jsx)(h.Z,{color:"red",children:"All proxy models"}):x.models.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=x.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:ev[e.team_id]||e.team_id},l))})]}),(0,i.jsx)(ei.Z,{objectPermission:x.object_permission,variant:"card",accessToken:o})]})}),(0,i.jsx)(w.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(g.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(S.Z,{children:(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(O.Z,{children:"User ID"}),(0,i.jsx)(O.Z,{children:"Role"}),(0,i.jsx)(O.Z,{children:"Spend"}),(0,i.jsx)(O.Z,{children:"Created At"}),(0,i.jsx)(O.Z,{})]})}),(0,i.jsx)(N.Z,{children:x.members&&x.members.length>0?x.members.map((e,l)=>(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:["$",(0,E.pw)(e.spend,4)]})}),(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(C.Z,{children:ej&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v.Z,{icon:Q.Z,size:"sm",onClick:()=>{eu({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ec(!0)}}),(0,i.jsx)(v.Z,{icon:Y.Z,size:"sm",onClick:()=>{ew(e)}})]})})]},l)):(0,i.jsx)(k.Z,{children:(0,i.jsx)(C.Z,{colSpan:5,className:"text-center py-8",children:(0,i.jsx)(M.Z,{className:"text-gray-500",children:"No members found"})})})})]})}),ej&&(0,i.jsx)(_.Z,{onClick:()=>{eo(!0)},children:"Add Member"})]})}),(0,i.jsx)(w.Z,{children:(0,i.jsxs)(g.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(K.Z,{children:"Organization Settings"}),ej&&!U&&(0,i.jsx)(_.Z,{onClick:()=>V(!0),children:"Edit Settings"})]}),U?(0,i.jsxs)(F.Z,{form:R,onFinish:ez,initialValues:{organization_alias:x.organization_alias,models:x.models,tpm_limit:x.litellm_budget_table.tpm_limit,rpm_limit:x.litellm_budget_table.rpm_limit,max_budget:x.litellm_budget_table.max_budget,budget_duration:x.litellm_budget_table.budget_duration,metadata:x.metadata?JSON.stringify(x.metadata,null,2):"",vector_stores:(null===(s=x.object_permission)||void 0===s?void 0:s.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(a=x.object_permission)||void 0===a?void 0:a.mcp_servers)||[],accessGroups:(null===(t=x.object_permission)||void 0===t?void 0:t.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(F.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(I.Z,{})}),(0,i.jsx)(F.Z.Item,{label:"Models",name:"models",children:(0,i.jsx)(q.q,{value:R.getFieldValue("models"),onChange:e=>R.setFieldValue("models",e),context:"organization",options:{includeSpecialOptions:!0,showAllProxyModelsOverride:!0}})}),(0,i.jsx)(F.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(ea.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(T.default,{placeholder:"n/a",children:[(0,i.jsx)(T.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(T.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(T.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(F.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(ea.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(ea.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(er.Z,{onChange:e=>R.setFieldValue("vector_stores",e),value:R.getFieldValue("vector_stores"),accessToken:o||"",placeholder:"Select vector stores"})}),(0,i.jsx)(F.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(B.Z,{onChange:e=>R.setFieldValue("mcp_servers_and_groups",e),value:R.getFieldValue("mcp_servers_and_groups"),accessToken:o||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(F.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(D.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(_.Z,{variant:"secondary",onClick:()=>V(!1),disabled:e_,children:"Cancel"}),(0,i.jsx)(_.Z,{type:"submit",loading:e_,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:x.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:x.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(x.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:x.models.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",x.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",x.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==x.litellm_budget_table.max_budget?"$".concat((0,E.pw)(x.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",x.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(ei.Z,{objectPermission:x.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:o})]})]})})]})]}),(0,i.jsx)(es.Z,{isVisible:en,onCancel:()=>eo(!1),onSubmit:eb,accessToken:o,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(et.Z,{visible:ed,onCancel:()=>ec(!1),onSubmit:ef,initialData:em,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})};let eo=async function(e,l){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;l(await (0,W.organizationListCall)(e,s,i))};var ed=e=>{let{organizations:l,userRole:s,userModels:a,accessToken:t,lastRefreshed:r,handleRefreshClick:n,currentOrg:o,guardrailsList:$=[],setOrganizations:H,premiumUser:J}=e,[Q,Y]=(0,L.useState)(null),[K,X]=(0,L.useState)(!1),[ee,el]=(0,L.useState)(!1),[es,ei]=(0,L.useState)(null),[et,ed]=(0,L.useState)(!1),[ec,em]=(0,L.useState)(!1),[eu]=F.Z.useForm(),[ex,eh]=(0,L.useState)({}),[e_,eg]=(0,L.useState)(!1),[ej,ep]=(0,L.useState)({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),ev=e=>{e&&(ei(e),el(!0))},eZ=async()=>{if(es&&t)try{ed(!0),await (0,W.organizationDeleteCall)(t,es),G.Z.success("Organization deleted successfully"),el(!1),ei(null),await eo(t,H,ej.org_id||null,ej.org_alias||null)}catch(e){console.error("Error deleting organization:",e)}finally{ed(!1)}},eb=async e=>{try{var l,s,i,a;if(!t)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,W.organizationCreateCall)(t,e),G.Z.success("Organization created successfully"),em(!1),eu.resetFields(),eo(t,H,ej.org_id||null,ej.org_alias||null)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(p.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(j.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(_.Z,{className:"w-fit",onClick:()=>em(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(en,{organizationId:Q,onClose:()=>{Y(null),X(!1)},accessToken:t,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:a,editOrg:K}):(0,i.jsxs)(b.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(f.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(Z.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,i.jsxs)(M.Z,{children:["Last Refreshed: ",r]}),(0,i.jsx)(v.Z,{icon:m.Z,variant:"shadow",size:"xs",className:"self-center",onClick:n})]})]}),(0,i.jsx)(z.Z,{children:(0,i.jsxs)(w.Z,{children:[(0,i.jsx)(M.Z,{children:"Click on “Organization ID” to view organization details."}),(0,i.jsx)(p.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(j.Z,{numColSpan:1,children:(0,i.jsxs)(g.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,i.jsx)("div",{className:"border-b px-6 py-4",children:(0,i.jsx)("div",{className:"flex flex-col space-y-4",children:(0,i.jsx)(d,{filters:ej,showFilters:e_,onToggleFilters:eg,onChange:(e,l)=>{let s={...ej,[e]:l};ep(s),t&&(0,W.organizationListCall)(t,s.org_id||null,s.org_alias||null).then(e=>{e&&H(e)}).catch(e=>{console.error("Error fetching organizations:",e)})},onReset:()=>{ep({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),t&&(0,W.organizationListCall)(t,null,null).then(e=>{e&&H(e)}).catch(e=>{console.error("Error fetching organizations:",e)})}})})}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(S.Z,{children:(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(O.Z,{children:"Organization ID"}),(0,i.jsx)(O.Z,{children:"Organization Name"}),(0,i.jsx)(O.Z,{children:"Created"}),(0,i.jsx)(O.Z,{children:"Spend (USD)"}),(0,i.jsx)(O.Z,{children:"Budget (USD)"}),(0,i.jsx)(O.Z,{children:"Models"}),(0,i.jsx)(O.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(O.Z,{children:"Info"}),(0,i.jsx)(O.Z,{children:"Actions"})]})}),(0,i.jsx)(N.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,t,r,n,o,d,c,m;return(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(C.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(P.Z,{title:e.organization_id,children:(0,i.jsxs)(_.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>Y(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(C.Z,{children:e.organization_alias}),(0,i.jsx)(C.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(C.Z,{children:(0,E.pw)(e.spend,4)}),(0,i.jsx)(C.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(t=e.litellm_budget_table)||void 0===t?void 0:t.max_budget)!==void 0?null===(r=e.litellm_budget_table)||void 0===r?void 0:r.max_budget:"No limit"}),(0,i.jsx)(C.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(h.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(v.Z,{icon:ex[e.organization_id||""]?u.Z:x.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eh(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(h.Z,{size:"xs",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(h.Z,{size:"xs",color:"blue",children:(0,i.jsx)(M.Z,{children:e.length>30?"".concat((0,V.W0)(e).slice(0,30),"..."):(0,V.W0)(e)})},l)),e.models.length>3&&!ex[e.organization_id||""]&&(0,i.jsx)(h.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(M.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ex[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(h.Z,{size:"xs",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(h.Z,{size:"xs",color:"blue",children:(0,i.jsx)(M.Z,{children:e.length>30?"".concat((0,V.W0)(e).slice(0,30),"..."):(0,V.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:["TPM:"," ",(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.tpm_limit)?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.rpm_limit)?null===(c=e.litellm_budget_table)||void 0===c?void 0:c.rpm_limit:"Unlimited"]})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:[(null===(m=e.members)||void 0===m?void 0:m.length)||0," Members"]})}),(0,i.jsx)(C.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U.Z,{variant:"Edit",tooltipText:"Edit organization",onClick:()=>{Y(e.organization_id),X(!0)}}),(0,i.jsx)(U.Z,{variant:"Delete",tooltipText:"Delete organization",onClick:()=>ev(e.organization_id)})]})})]},e.organization_id)}):null})]})]})})})]})})]})]})}),(0,i.jsx)(A.Z,{title:"Create Organization",visible:ec,width:800,footer:null,onCancel:()=>{em(!1),eu.resetFields()},children:(0,i.jsxs)(F.Z,{form:eu,onFinish:eb,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(F.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(I.Z,{placeholder:""})}),(0,i.jsx)(F.Z.Item,{label:"Models",name:"models",children:(0,i.jsx)(q.q,{options:{showAllProxyModelsOverride:!0,includeSpecialOptions:!0},value:eu.getFieldValue("models"),onChange:e=>eu.setFieldValue("models",e),context:"organization"})}),(0,i.jsx)(F.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(ea.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(F.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(T.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(T.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(T.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(T.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(F.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(ea.Z,{step:1,width:400})}),(0,i.jsx)(F.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(ea.Z,{step:1,width:400})}),(0,i.jsx)(F.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(P.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(c.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(er.Z,{onChange:e=>eu.setFieldValue("allowed_vector_store_ids",e),value:eu.getFieldValue("allowed_vector_store_ids"),accessToken:t||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(F.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(P.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(c.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(B.Z,{onChange:e=>eu.setFieldValue("allowed_mcp_servers_and_groups",e),value:eu.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:t||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(F.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(D.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(_.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(R.Z,{isOpen:ee,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:es,code:!0}],onCancel:()=>{el(!1),ei(null)},onOk:eZ,confirmLoading:et})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(M.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}},29299:function(e,l,s){s.d(l,{O:function(){return i},o:function(){return a}});let i=e=>e?e.reduce((e,l)=>(e[l.team_id]=l.team_alias,e),{}):{},a=(e,l)=>{let s=l.find(l=>l.team_id===e);return s?s.team_alias:null}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5706],{56083:function(e,l,s){s.d(l,{H:function(){return d}});var i=s(57437),a=s(10012),t=s(4260),r=s(7310),n=s.n(r),o=s(2265);let d=e=>{let{placeholder:l,value:s,onChange:r,icon:d,className:c}=e,[m,u]=(0,o.useState)(s);(0,o.useEffect)(()=>{u(s)},[s]);let x=(0,o.useMemo)(()=>n()(e=>r(e),300),[r]);(0,o.useEffect)(()=>()=>{x.cancel()},[x]);let h=(0,o.useCallback)(e=>{let l=e.target.value;u(l),x(l)},[x]);return(0,i.jsx)(t.default,{placeholder:l,value:m,onChange:h,prefix:d?(0,i.jsx)(d,{size:16,className:"text-gray-500"}):void 0,className:(0,a.cx)("w-64",c)})}},51205:function(e,l,s){s.d(l,{c:function(){return n}});var i=s(57437),a=s(33866),t=s(5545),r=s(3577);s(2265);let n=e=>{let{onClick:l,active:s,hasActiveFilters:n,label:o="Filters"}=e;return(0,i.jsx)(a.Z,{color:"blue",dot:n,children:(0,i.jsx)(t.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(r.Z,{size:16}),className:s?"bg-gray-100":"",children:o})})}},57716:function(e,l,s){s.d(l,{z:function(){return r}});var i=s(57437),a=s(5545),t=s(69076);s(2265);let r=e=>{let{onClick:l,label:s="Reset Filters"}=e;return(0,i.jsx)(a.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(t.Z,{size:16}),children:s})}},35706:function(e,l,s){s.d(l,{Z:function(){return ed},g:function(){return eo}});var i=s(57437),a=s(56083),t=s(51205),r=s(57716),n=s(73247),o=s(92369),d=e=>{let{filters:l,showFilters:s,onToggleFilters:d,onChange:c,onReset:m}=e,u=!!(l.org_id||l.org_alias);return(0,i.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsx)(a.H,{placeholder:"Search by Organization Name",value:l.org_alias,onChange:e=>c("org_alias",e),icon:n.Z,className:"w-64"}),(0,i.jsx)(t.c,{onClick:()=>d(!s),active:s,hasActiveFilters:u}),(0,i.jsx)(r.z,{onClick:m})]}),s&&(0,i.jsx)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:(0,i.jsx)(a.H,{placeholder:"Search by Organization ID",value:l.org_id,onChange:e=>c("org_id",e),icon:o.Z,className:"w-64"})})]})},c=s(15424),m=s(23628),u=s(86462),x=s(47686),h=s(41649),_=s(78489),g=s(12514),j=s(49804),p=s(67101),v=s(47323),Z=s(12485),b=s(18135),f=s(35242),w=s(29706),z=s(77991),y=s(21626),N=s(97214),C=s(28241),S=s(58834),O=s(69552),k=s(71876),M=s(84264),I=s(49566),F=s(10032),P=s(99981),A=s(22116),T=s(37592),D=s(4260),L=s(2265),E=s(59872),R=s(21609),U=s(39957),V=s(46468),B=s(97492),q=s(8156),G=s(9114),W=s(19250),$=s(47359),H=s(29299),J=s(10900),Q=s(53410),Y=s(74998),K=s(96761),X=s(5545),ee=s(30401),el=s(78867),es=s(33860),ei=s(60131),ea=s(24199),et=s(36894),er=s(97415),en=e=>{var l,s,a,t;let{organizationId:r,onClose:n,accessToken:o,is_org_admin:d,is_proxy_admin:c,userModels:m,editOrg:u}=e,[x,j]=(0,L.useState)(null),[P,A]=(0,L.useState)(!0),[R]=F.Z.useForm(),[U,V]=(0,L.useState)(!1),[en,eo]=(0,L.useState)(!1),[ed,ec]=(0,L.useState)(!1),[em,eu]=(0,L.useState)(null),[ex,eh]=(0,L.useState)({}),[e_,eg]=(0,L.useState)(!1),ej=d||c,{data:ep}=(0,$.y2)(),ev=(0,L.useMemo)(()=>(0,H.O)(ep),[ep]),eZ=async()=>{try{if(A(!0),!o)return;let e=await (0,W.organizationInfoCall)(o,r);j(e)}catch(e){G.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{A(!1)}};(0,L.useEffect)(()=>{eZ()},[r,o]);let eb=async e=>{try{if(null==o)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,W.organizationMemberAddCall)(o,r,l),G.Z.success("Organization member added successfully"),eo(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ef=async e=>{try{if(!o)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,W.organizationMemberUpdateCall)(o,r,l),G.Z.success("Organization member updated successfully"),ec(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},ew=async e=>{try{if(!o)return;await (0,W.organizationMemberDeleteCall)(o,r,e.user_id),G.Z.success("Organization member deleted successfully"),ec(!1),R.resetFields(),eZ()}catch(e){G.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},ez=async e=>{try{if(!o)return;eg(!0);let l={organization_id:r,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==x?void 0:x.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,W.organizationUpdateCall)(o,l),G.Z.success("Organization settings updated successfully"),V(!1),eZ()}catch(e){G.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{eg(!1)}};if(P)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!x)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ey=async(e,l)=>{await (0,E.vQ)(e)&&(eh(e=>({...e,[l]:!0})),setTimeout(()=>{eh(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(_.Z,{icon:J.Z,onClick:n,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(K.Z,{children:x.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(M.Z,{className:"text-gray-500 font-mono",children:x.organization_id}),(0,i.jsx)(X.ZP,{type:"text",size:"small",icon:ex["org-id"]?(0,i.jsx)(ee.Z,{size:12}):(0,i.jsx)(el.Z,{size:12}),onClick:()=>ey(x.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(ex["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(b.Z,{defaultIndex:u?2:0,children:[(0,i.jsxs)(f.Z,{className:"mb-4",children:[(0,i.jsx)(Z.Z,{children:"Overview"}),(0,i.jsx)(Z.Z,{children:"Members"}),(0,i.jsx)(Z.Z,{children:"Settings"})]}),(0,i.jsxs)(z.Z,{children:[(0,i.jsx)(w.Z,{children:(0,i.jsxs)(p.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(M.Z,{children:["Created: ",new Date(x.created_at).toLocaleDateString()]}),(0,i.jsxs)(M.Z,{children:["Updated: ",new Date(x.updated_at).toLocaleDateString()]}),(0,i.jsxs)(M.Z,{children:["Created By: ",x.created_by]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(K.Z,{children:["$",(0,E.pw)(x.spend,4)]}),(0,i.jsxs)(M.Z,{children:["of"," ",null===x.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,E.pw)(x.litellm_budget_table.max_budget,4))]}),x.litellm_budget_table.budget_duration&&(0,i.jsxs)(M.Z,{className:"text-gray-500",children:["Reset: ",x.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(M.Z,{children:["TPM: ",x.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(M.Z,{children:["RPM: ",x.litellm_budget_table.rpm_limit||"Unlimited"]}),x.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(M.Z,{children:["Max Parallel Requests: ",x.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===x.models.length?(0,i.jsx)(h.Z,{color:"red",children:"All proxy models"}):x.models.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(M.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=x.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:ev[e.team_id]||e.team_id},l))})]}),(0,i.jsx)(ei.Z,{objectPermission:x.object_permission,variant:"card",accessToken:o})]})}),(0,i.jsx)(w.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(g.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(S.Z,{children:(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(O.Z,{children:"User ID"}),(0,i.jsx)(O.Z,{children:"Role"}),(0,i.jsx)(O.Z,{children:"Spend"}),(0,i.jsx)(O.Z,{children:"Created At"}),(0,i.jsx)(O.Z,{})]})}),(0,i.jsx)(N.Z,{children:x.members&&x.members.length>0?x.members.map((e,l)=>(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:["$",(0,E.pw)(e.spend,4)]})}),(0,i.jsx)(C.Z,{children:(0,i.jsx)(M.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(C.Z,{children:ej&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v.Z,{icon:Q.Z,size:"sm",onClick:()=>{eu({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),ec(!0)}}),(0,i.jsx)(v.Z,{icon:Y.Z,size:"sm",onClick:()=>{ew(e)}})]})})]},l)):(0,i.jsx)(k.Z,{children:(0,i.jsx)(C.Z,{colSpan:5,className:"text-center py-8",children:(0,i.jsx)(M.Z,{className:"text-gray-500",children:"No members found"})})})})]})}),ej&&(0,i.jsx)(_.Z,{onClick:()=>{eo(!0)},children:"Add Member"})]})}),(0,i.jsx)(w.Z,{children:(0,i.jsxs)(g.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(K.Z,{children:"Organization Settings"}),ej&&!U&&(0,i.jsx)(_.Z,{onClick:()=>V(!0),children:"Edit Settings"})]}),U?(0,i.jsxs)(F.Z,{form:R,onFinish:ez,initialValues:{organization_alias:x.organization_alias,models:x.models,tpm_limit:x.litellm_budget_table.tpm_limit,rpm_limit:x.litellm_budget_table.rpm_limit,max_budget:x.litellm_budget_table.max_budget,budget_duration:x.litellm_budget_table.budget_duration,metadata:x.metadata?JSON.stringify(x.metadata,null,2):"",vector_stores:(null===(s=x.object_permission)||void 0===s?void 0:s.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(a=x.object_permission)||void 0===a?void 0:a.mcp_servers)||[],accessGroups:(null===(t=x.object_permission)||void 0===t?void 0:t.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(F.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(I.Z,{})}),(0,i.jsx)(F.Z.Item,{label:"Models",name:"models",children:(0,i.jsx)(q.q,{value:R.getFieldValue("models"),onChange:e=>R.setFieldValue("models",e),context:"organization",options:{includeSpecialOptions:!0,showAllProxyModelsOverride:!0}})}),(0,i.jsx)(F.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(ea.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(T.default,{placeholder:"n/a",children:[(0,i.jsx)(T.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(T.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(T.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(F.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(ea.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(ea.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(F.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(er.Z,{onChange:e=>R.setFieldValue("vector_stores",e),value:R.getFieldValue("vector_stores"),accessToken:o||"",placeholder:"Select vector stores"})}),(0,i.jsx)(F.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(B.Z,{onChange:e=>R.setFieldValue("mcp_servers_and_groups",e),value:R.getFieldValue("mcp_servers_and_groups"),accessToken:o||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(F.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(D.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(_.Z,{variant:"secondary",onClick:()=>V(!1),disabled:e_,children:"Cancel"}),(0,i.jsx)(_.Z,{type:"submit",loading:e_,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:x.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:x.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(x.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:x.models.map((e,l)=>(0,i.jsx)(h.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",x.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",x.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(M.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==x.litellm_budget_table.max_budget?"$".concat((0,E.pw)(x.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",x.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(ei.Z,{objectPermission:x.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:o})]})]})})]})]}),(0,i.jsx)(es.Z,{isVisible:en,onCancel:()=>eo(!1),onSubmit:eb,accessToken:o,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(et.Z,{visible:ed,onCancel:()=>ec(!1),onSubmit:ef,initialData:em,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})};let eo=async function(e,l){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;l(await (0,W.organizationListCall)(e,s,i))};var ed=e=>{let{organizations:l,userRole:s,userModels:a,accessToken:t,lastRefreshed:r,handleRefreshClick:n,currentOrg:o,guardrailsList:$=[],setOrganizations:H,premiumUser:J}=e,[Q,Y]=(0,L.useState)(null),[K,X]=(0,L.useState)(!1),[ee,el]=(0,L.useState)(!1),[es,ei]=(0,L.useState)(null),[et,ed]=(0,L.useState)(!1),[ec,em]=(0,L.useState)(!1),[eu]=F.Z.useForm(),[ex,eh]=(0,L.useState)({}),[e_,eg]=(0,L.useState)(!1),[ej,ep]=(0,L.useState)({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),ev=e=>{e&&(ei(e),el(!0))},eZ=async()=>{if(es&&t)try{ed(!0),await (0,W.organizationDeleteCall)(t,es),G.Z.success("Organization deleted successfully"),el(!1),ei(null),await eo(t,H,ej.org_id||null,ej.org_alias||null)}catch(e){console.error("Error deleting organization:",e)}finally{ed(!1)}},eb=async e=>{try{var l,s,i,a;if(!t)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,W.organizationCreateCall)(t,e),G.Z.success("Organization created successfully"),em(!1),eu.resetFields(),eo(t,H,ej.org_id||null,ej.org_alias||null)}catch(e){console.error("Error creating organization:",e)}};return J?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(p.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(j.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(_.Z,{className:"w-fit",onClick:()=>em(!0),children:"+ Create New Organization"}),Q?(0,i.jsx)(en,{organizationId:Q,onClose:()=>{Y(null),X(!1)},accessToken:t,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:a,editOrg:K}):(0,i.jsxs)(b.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(f.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(Z.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,i.jsxs)(M.Z,{children:["Last Refreshed: ",r]}),(0,i.jsx)(v.Z,{icon:m.Z,variant:"shadow",size:"xs",className:"self-center",onClick:n})]})]}),(0,i.jsx)(z.Z,{children:(0,i.jsxs)(w.Z,{children:[(0,i.jsx)(M.Z,{children:"Click on “Organization ID” to view organization details."}),(0,i.jsx)(p.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(j.Z,{numColSpan:1,children:(0,i.jsxs)(g.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,i.jsx)("div",{className:"border-b px-6 py-4",children:(0,i.jsx)("div",{className:"flex flex-col space-y-4",children:(0,i.jsx)(d,{filters:ej,showFilters:e_,onToggleFilters:eg,onChange:(e,l)=>{let s={...ej,[e]:l};ep(s),t&&(0,W.organizationListCall)(t,s.org_id||null,s.org_alias||null).then(e=>{e&&H(e)}).catch(e=>{console.error("Error fetching organizations:",e)})},onReset:()=>{ep({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),t&&(0,W.organizationListCall)(t,null,null).then(e=>{e&&H(e)}).catch(e=>{console.error("Error fetching organizations:",e)})}})})}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(S.Z,{children:(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(O.Z,{children:"Organization ID"}),(0,i.jsx)(O.Z,{children:"Organization Name"}),(0,i.jsx)(O.Z,{children:"Created"}),(0,i.jsx)(O.Z,{children:"Spend (USD)"}),(0,i.jsx)(O.Z,{children:"Budget (USD)"}),(0,i.jsx)(O.Z,{children:"Models"}),(0,i.jsx)(O.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(O.Z,{children:"Info"}),(0,i.jsx)(O.Z,{children:"Actions"})]})}),(0,i.jsx)(N.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,t,r,n,o,d,c,m;return(0,i.jsxs)(k.Z,{children:[(0,i.jsx)(C.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(P.Z,{title:e.organization_id,children:(0,i.jsxs)(_.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>Y(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(C.Z,{children:e.organization_alias}),(0,i.jsx)(C.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(C.Z,{children:(0,E.pw)(e.spend,4)}),(0,i.jsx)(C.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(t=e.litellm_budget_table)||void 0===t?void 0:t.max_budget)!==void 0?null===(r=e.litellm_budget_table)||void 0===r?void 0:r.max_budget:"No limit"}),(0,i.jsx)(C.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(h.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(v.Z,{icon:ex[e.organization_id||""]?u.Z:x.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eh(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(h.Z,{size:"xs",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(h.Z,{size:"xs",color:"blue",children:(0,i.jsx)(M.Z,{children:e.length>30?"".concat((0,V.W0)(e).slice(0,30),"..."):(0,V.W0)(e)})},l)),e.models.length>3&&!ex[e.organization_id||""]&&(0,i.jsx)(h.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(M.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ex[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(h.Z,{size:"xs",color:"red",children:(0,i.jsx)(M.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(h.Z,{size:"xs",color:"blue",children:(0,i.jsx)(M.Z,{children:e.length>30?"".concat((0,V.W0)(e).slice(0,30),"..."):(0,V.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:["TPM:"," ",(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.tpm_limit)?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.rpm_limit)?null===(c=e.litellm_budget_table)||void 0===c?void 0:c.rpm_limit:"Unlimited"]})}),(0,i.jsx)(C.Z,{children:(0,i.jsxs)(M.Z,{children:[(null===(m=e.members)||void 0===m?void 0:m.length)||0," Members"]})}),(0,i.jsx)(C.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U.Z,{variant:"Edit",tooltipText:"Edit organization",onClick:()=>{Y(e.organization_id),X(!0)}}),(0,i.jsx)(U.Z,{variant:"Delete",tooltipText:"Delete organization",onClick:()=>ev(e.organization_id)})]})})]},e.organization_id)}):null})]})]})})})]})})]})]})}),(0,i.jsx)(A.Z,{title:"Create Organization",visible:ec,width:800,footer:null,onCancel:()=>{em(!1),eu.resetFields()},children:(0,i.jsxs)(F.Z,{form:eu,onFinish:eb,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(F.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(I.Z,{placeholder:""})}),(0,i.jsx)(F.Z.Item,{label:"Models",name:"models",children:(0,i.jsx)(q.q,{options:{showAllProxyModelsOverride:!0,includeSpecialOptions:!0},value:eu.getFieldValue("models"),onChange:e=>eu.setFieldValue("models",e),context:"organization"})}),(0,i.jsx)(F.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(ea.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(F.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(T.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(T.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(T.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(T.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(F.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(ea.Z,{step:1,width:400})}),(0,i.jsx)(F.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(ea.Z,{step:1,width:400})}),(0,i.jsx)(F.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(P.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(c.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(er.Z,{onChange:e=>eu.setFieldValue("allowed_vector_store_ids",e),value:eu.getFieldValue("allowed_vector_store_ids"),accessToken:t||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(F.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(P.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(c.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(B.Z,{onChange:e=>eu.setFieldValue("allowed_mcp_servers_and_groups",e),value:eu.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:t||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(F.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(D.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(_.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)(R.Z,{isOpen:ee,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:es,code:!0}],onCancel:()=>{el(!1),ei(null)},onOk:eZ,confirmLoading:et})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(M.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}},29299:function(e,l,s){s.d(l,{O:function(){return i},o:function(){return a}});let i=e=>e?e.reduce((e,l)=>(e[l.team_id]=l.team_alias,e),{}):{},a=(e,l)=>{let s=l.find(l=>l.team_id===e);return s?s.team_alias:null}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5733-7fdc8bb12360677b.js b/litellm/proxy/_experimental/out/_next/static/chunks/5733-6468df5f227a2c59.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5733-7fdc8bb12360677b.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5733-6468df5f227a2c59.js index 5339c39c40..28910e766e 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5733-7fdc8bb12360677b.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5733-6468df5f227a2c59.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5733],{58747:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},88237:function(e,t,r){let n,a,o;r.d(t,{Z:function(){return rV}});var l,i,s,u=r(5853),d=r(2265);let c=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),d.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var m=r(4537),f=r(99649);function h(e){let t=(0,f.Q)(e);return t.setHours(0,0,0,0),t}function p(){return h(Date.now())}function v(e){let t=(0,f.Q)(e);return t.setDate(1),t.setHours(0,0,0,0),t}var b=r(13241),g=r(96398);function y(e){let t;return e.forEach(function(e){let r=(0,f.Q)(e);(void 0===t||t{let r=(0,f.Q)(e);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}var x=r(59121);function k(e,t){return(0,x.E)(e,-t)}var M=r(31091),E=r(63497);function N(e,t){var r;let{years:n=0,months:a=0,weeks:o=0,days:l=0,hours:i=0,minutes:s=0,seconds:u=0}=t,d=k((r=a+12*n,(0,M.z)(e,-r)),l+7*o);return(0,E.L)(e,d.getTime()-1e3*(u+60*(s+60*i)))}function C(e){let t=(0,f.Q)(e),r=(0,E.L)(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}let P={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function S(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}let D={date:S({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:S({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:S({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function L(e){return(t,r)=>{let n;if("formatting"===((null==r?void 0:r.context)?String(r.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,a=(null==r?void 0:r.width)?String(r.width):t;n=e.formattingValues[a]||e.formattingValues[t]}else{let t=e.defaultWidth,a=(null==r?void 0:r.width)?String(r.width):e.defaultWidth;n=e.values[a]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function j(e){return function(t){let r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,o=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;let i=l[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?function(e,t){for(let r=0;re.test(i)):function(e,t){for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}(s,e=>e.test(i));return r=e.valueCallback?e.valueCallback(u):u,{value:r=n.valueCallback?n.valueCallback(r):r,rest:t.slice(i.length)}}}let O={code:"en-US",formatDistance:(e,t,r)=>{let n;let a=P[e];return(n="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null==r?void 0:r.addSuffix)?r.comparison&&r.comparison>0?"in "+n:n+" ago":n},formatLong:D,formatRelative:(e,t,r,n)=>_[e],localize:{ordinalNumber:(e,t)=>{let r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:L({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:L({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:L({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:L({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:L({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(l={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(l.matchPattern);if(!r)return null;let n=r[0],a=e.match(l.parsePattern);if(!a)return null;let o=l.valueCallback?l.valueCallback(a[0]):a[0];return{value:o=t.valueCallback?t.valueCallback(o):o,rest:e.slice(n.length)}}),era:j({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:j({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:j({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:j({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:j({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},T={};function F(e){let t=(0,f.Q)(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function I(e,t){let r=h(e),n=h(t);return Math.round((+r-F(r)-(+n-F(n)))/864e5)}function Y(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.weekStartsOn)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.weekStartsOn)&&void 0!==i?i:T.weekStartsOn)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==u?u:0,c=(0,f.Q)(e),m=c.getDay();return c.setDate(c.getDate()-((m=a.getTime()?r+1:t.getTime()>=l.getTime()?r:r-1}function z(e){let t=(0,f.Q)(e);return Math.round((+W(t)-+function(e){let t=q(e),r=(0,E.L)(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),W(r)}(t))/6048e5)+1}function R(e,t){var r,n,a,o,l,i,s,u;let d=(0,f.Q)(e),c=d.getFullYear(),m=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.firstWeekContainsDate)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.firstWeekContainsDate)&&void 0!==i?i:T.firstWeekContainsDate)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==u?u:1,h=(0,E.L)(e,0);h.setFullYear(c+1,0,m),h.setHours(0,0,0,0);let p=Y(h,t),v=(0,E.L)(e,0);v.setFullYear(c,0,m),v.setHours(0,0,0,0);let b=Y(v,t);return d.getTime()>=p.getTime()?c+1:d.getTime()>=b.getTime()?c:c-1}function B(e,t){let r=(0,f.Q)(e);return Math.round((+Y(r,t)-+function(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.firstWeekContainsDate)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.firstWeekContainsDate)&&void 0!==i?i:T.firstWeekContainsDate)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==u?u:1,c=R(e,t),m=(0,E.L)(e,0);return m.setFullYear(c,0,d),m.setHours(0,0,0,0),Y(m,t)}(r,t))/6048e5)+1}function H(e,t){let r=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+r}let A={y(e,t){let r=e.getFullYear(),n=r>0?r:1-r;return H("yy"===t?n%100:n,t.length)},M(e,t){let r=e.getMonth();return"M"===t?String(r+1):H(r+1,2)},d:(e,t)=>H(e.getDate(),t.length),a(e,t){let r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:(e,t)=>H(e.getHours()%12||12,t.length),H:(e,t)=>H(e.getHours(),t.length),m:(e,t)=>H(e.getMinutes(),t.length),s:(e,t)=>H(e.getSeconds(),t.length),S(e,t){let r=t.length;return H(Math.trunc(e.getMilliseconds()*Math.pow(10,r-3)),t.length)}},V={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Z={G:function(e,t,r){let n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){let t=e.getFullYear();return r.ordinalNumber(t>0?t:1-t,{unit:"year"})}return A.y(e,t)},Y:function(e,t,r,n){let a=R(e,n),o=a>0?a:1-a;return"YY"===t?H(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):H(o,t.length)},R:function(e,t){return H(q(e),t.length)},u:function(e,t){return H(e.getFullYear(),t.length)},Q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return H(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return H(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){let n=e.getMonth();switch(t){case"M":case"MM":return A.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){let n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return H(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){let a=B(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):H(a,t.length)},I:function(e,t,r){let n=z(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):H(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getDate(),{unit:"date"}):A.d(e,t)},D:function(e,t,r){let n=function(e){let t=(0,f.Q)(e);return I(t,C(t))+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):H(n,t.length)},E:function(e,t,r){let n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return H(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return H(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){let n=e.getDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return H(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){let n;let a=e.getHours();switch(n=12===a?V.noon:0===a?V.midnight:a/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){let n;let a=e.getHours();switch(n=a>=17?V.evening:a>=12?V.afternoon:a>=4?V.morning:V.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),r.ordinalNumber(t,{unit:"hour"})}return A.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getHours(),{unit:"hour"}):A.H(e,t)},K:function(e,t,r){let n=e.getHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):H(n,t.length)},k:function(e,t,r){let n=e.getHours();return(0===n&&(n=24),"ko"===t)?r.ordinalNumber(n,{unit:"hour"}):H(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):A.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getSeconds(),{unit:"second"}):A.s(e,t)},S:function(e,t){return A.S(e,t)},X:function(e,t,r){let n=e.getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return G(n);case"XXXX":case"XX":return X(n);default:return X(n,":")}},x:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"x":return G(n);case"xxxx":case"xx":return X(n);default:return X(n,":")}},O:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Q(n,":");default:return"GMT"+X(n,":")}},z:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Q(n,":");default:return"GMT"+X(n,":")}},t:function(e,t,r){return H(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,r){return H(e.getTime(),t.length)}};function Q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return 0===o?r+String(a):r+String(a)+t+H(o,2)}function G(e,t){return e%60==0?(e>0?"-":"+")+H(Math.abs(e)/60,2):X(e,t)}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=Math.abs(e);return(e>0?"-":"+")+H(Math.trunc(r/60),2)+t+H(r%60,2)}let K=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},U=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},J={p:U,P:(e,t)=>{let r;let n=e.match(/(P+)(p+)?/)||[],a=n[1],o=n[2];if(!o)return K(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",K(a,t)).replace("{{time}}",U(o,t))}},$=/^D+$/,ee=/^Y+$/,et=["D","DD","YY","YYYY"];function er(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}let en=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ea=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eo=/^'([^]*?)'?$/,el=/''/g,ei=/[a-zA-Z]/;function es(e,t,r){var n,a,o,l,i,s,u,d,c,m,h,p,v,b,g,y,w,x;let k=null!==(m=null!==(c=null==r?void 0:r.locale)&&void 0!==c?c:T.locale)&&void 0!==m?m:O,M=null!==(b=null!==(v=null!==(p=null!==(h=null==r?void 0:r.firstWeekContainsDate)&&void 0!==h?h:null==r?void 0:null===(a=r.locale)||void 0===a?void 0:null===(n=a.options)||void 0===n?void 0:n.firstWeekContainsDate)&&void 0!==p?p:T.firstWeekContainsDate)&&void 0!==v?v:null===(l=T.locale)||void 0===l?void 0:null===(o=l.options)||void 0===o?void 0:o.firstWeekContainsDate)&&void 0!==b?b:1,E=null!==(x=null!==(w=null!==(y=null!==(g=null==r?void 0:r.weekStartsOn)&&void 0!==g?g:null==r?void 0:null===(s=r.locale)||void 0===s?void 0:null===(i=s.options)||void 0===i?void 0:i.weekStartsOn)&&void 0!==y?y:T.weekStartsOn)&&void 0!==w?w:null===(d=T.locale)||void 0===d?void 0:null===(u=d.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==x?x:0,N=(0,f.Q)(e);if(!((er(N)||"number"==typeof N)&&!isNaN(Number((0,f.Q)(N)))))throw RangeError("Invalid time value");let C=t.match(ea).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,J[t])(e,k.formatLong):e}).join("").match(en).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t)return{isToken:!1,value:function(e){let t=e.match(eo);return t?t[1].replace(el,"'"):e}(e)};if(Z[t])return{isToken:!0,value:e};if(t.match(ei))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});k.localize.preprocessor&&(C=k.localize.preprocessor(N,C));let P={firstWeekContainsDate:M,weekStartsOn:E,locale:k};return C.map(n=>{if(!n.isToken)return n.value;let a=n.value;return(!(null==r?void 0:r.useAdditionalWeekYearTokens)&&ee.test(a)||!(null==r?void 0:r.useAdditionalDayOfYearTokens)&&$.test(a))&&function(e,t,r){let n=function(e,t,r){let n="Y"===e[0]?"years":"days of the month";return"Use `".concat(e.toLowerCase(),"` instead of `").concat(e,"` (in `").concat(t,"`) for formatting ").concat(n," to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")}(e,t,r);if(console.warn(n),et.includes(e))throw RangeError(n)}(a,t,String(e)),(0,Z[a[0]])(N,a,k.localize,P)}).join("")}var eu=r(1153);let ed=(0,eu.fn)("DateRangePicker"),ec=(e,t,r,n)=>{var a;if(r&&(e=null===(a=n.get(r))||void 0===a?void 0:a.from),e)return h(e&&!t?e:y([e,t]))},em=(e,t,r,n)=>{var a,o;if(r&&(e=h(null!==(o=null===(a=n.get(r))||void 0===a?void 0:a.to)&&void 0!==o?o:p())),e)return h(e&&!t?e:w([e,t]))},ef=[{value:"tdy",text:"Today",from:p()},{value:"w",text:"Last 7 days",from:N(p(),{days:7})},{value:"t",text:"Last 30 days",from:N(p(),{days:30})},{value:"m",text:"Month to Date",from:v(p())},{value:"y",text:"Year to Date",from:C(p())}],eh=(e,t,r,n)=>{let a=(null==r?void 0:r.code)||"en-US";if(!e&&!t)return"";if(e&&!t)return n?es(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e&&t){if(+(0,f.Q)(e)==+(0,f.Q)(t))return n?es(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear())return n?"".concat(es(e,n)," - ").concat(es(t,n)):"".concat(e.toLocaleDateString(a,{month:"short",day:"numeric"})," - \n ").concat(t.getDate(),", ").concat(t.getFullYear());{if(n)return"".concat(es(e,n)," - ").concat(es(t,n));let r={year:"numeric",month:"short",day:"numeric"};return"".concat(e.toLocaleDateString(a,r)," - \n ").concat(t.toLocaleDateString(a,r))}}return""};var ep=r(57437);function ev(e){let t=(0,f.Q)(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function eb(e,t){let r=(0,f.Q)(e),n=r.getFullYear(),a=r.getDate(),o=(0,E.L)(e,0);o.setFullYear(n,t,15),o.setHours(0,0,0,0);let l=function(e){let t=(0,f.Q)(e),r=t.getFullYear(),n=t.getMonth(),a=(0,E.L)(e,0);return a.setFullYear(r,n+1,0),a.setHours(0,0,0,0),a.getDate()}(o);return r.setMonth(t,Math.min(a,l)),r}function eg(e,t){let r=(0,f.Q)(e);return isNaN(+r)?(0,E.L)(e,NaN):(r.setFullYear(t),r)}function ey(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return 12*(r.getFullYear()-n.getFullYear())+(r.getMonth()-n.getMonth())}function ew(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function ex(e,t){return+(0,f.Q)(e)<+(0,f.Q)(t)}function ek(e,t){return+h(e)==+h(t)}function eM(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return r.getTime()>n.getTime()}function eE(e,t){return(0,x.E)(e,7*t)}function eN(e,t){return(0,M.z)(e,12*t)}function eC(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.weekStartsOn)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.weekStartsOn)&&void 0!==i?i:T.weekStartsOn)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==u?u:0,c=(0,f.Q)(e),m=c.getDay();return c.setDate(c.getDate()+((mey(i,l)&&(l=(0,M.z)(i,-1*((void 0===u?1:u)-1))),s&&0>ey(l,s)&&(l=s),c=v(l),m=t.month,h=(f=(0,d.useState)(c))[0],p=[void 0===m?h:m,f[1]])[0],g=p[1],[b,function(e){if(!t.disableNavigation){var r,n=v(e);g(n),null===(r=t.onMonthChange)||void 0===r||r.call(t,n)}}]),x=w[0],k=w[1],E=function(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=v(e),o=ey(v((0,M.z)(a,n)),a),l=[],i=0;i=ey(o,r)))return(0,M.z)(o,-(n?void 0===a?1:a:1))}}(x,y),P=function(e){return E.some(function(t){return ew(e,t)})};return(0,ep.jsx)(eA.Provider,{value:{currentMonth:x,displayMonths:E,goToMonth:k,goToDate:function(e,t){P(e)||(t&&ex(e,t)?k((0,M.z)(e,1+-1*y.numberOfMonths)):k(e))},previousMonth:C,nextMonth:N,isDateDisplayed:P},children:e.children})}function eZ(){var e=(0,d.useContext)(eA);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}function eQ(e){var t,r=eW(),n=r.classNames,a=r.styles,o=r.components,l=eZ().goToMonth,i=function(t){l((0,M.z)(t,e.displayIndex?-e.displayIndex:0))},s=null!==(t=null==o?void 0:o.CaptionLabel)&&void 0!==t?t:eq,u=(0,ep.jsx)(s,{id:e.id,displayMonth:e.displayMonth});return(0,ep.jsxs)("div",{className:n.caption_dropdowns,style:a.caption_dropdowns,children:[(0,ep.jsx)("div",{className:n.vhidden,children:u}),(0,ep.jsx)(eB,{onChange:i,displayMonth:e.displayMonth}),(0,ep.jsx)(eH,{onChange:i,displayMonth:e.displayMonth})]})}function eG(e){return(0,ep.jsx)("svg",eS({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,ep.jsx)("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function eX(e){return(0,ep.jsx)("svg",eS({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,ep.jsx)("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var eK=(0,d.forwardRef)(function(e,t){var r=eW(),n=r.classNames,a=r.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var l=o.join(" "),i=eS(eS({},a.button_reset),a.button);return e.style&&Object.assign(i,e.style),(0,ep.jsx)("button",eS({},e,{ref:t,type:"button",className:l,style:i}))});function eU(e){var t,r,n=eW(),a=n.dir,o=n.locale,l=n.classNames,i=n.styles,s=n.labels,u=s.labelPrevious,d=s.labelNext,c=n.components;if(!e.nextMonth&&!e.previousMonth)return(0,ep.jsx)(ep.Fragment,{});var m=u(e.previousMonth,{locale:o}),f=[l.nav_button,l.nav_button_previous].join(" "),h=d(e.nextMonth,{locale:o}),p=[l.nav_button,l.nav_button_next].join(" "),v=null!==(t=null==c?void 0:c.IconRight)&&void 0!==t?t:eX,b=null!==(r=null==c?void 0:c.IconLeft)&&void 0!==r?r:eG;return(0,ep.jsxs)("div",{className:l.nav,style:i.nav,children:[!e.hidePrevious&&(0,ep.jsx)(eK,{name:"previous-month","aria-label":m,className:f,style:i.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:"rtl"===a?(0,ep.jsx)(v,{className:l.nav_icon,style:i.nav_icon}):(0,ep.jsx)(b,{className:l.nav_icon,style:i.nav_icon})}),!e.hideNext&&(0,ep.jsx)(eK,{name:"next-month","aria-label":h,className:p,style:i.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:"rtl"===a?(0,ep.jsx)(b,{className:l.nav_icon,style:i.nav_icon}):(0,ep.jsx)(v,{className:l.nav_icon,style:i.nav_icon})})]})}function eJ(e){var t=eW().numberOfMonths,r=eZ(),n=r.previousMonth,a=r.nextMonth,o=r.goToMonth,l=r.displayMonths,i=l.findIndex(function(t){return ew(e.displayMonth,t)}),s=0===i,u=i===l.length-1;return(0,ep.jsx)(eU,{displayMonth:e.displayMonth,hideNext:t>1&&(s||!u),hidePrevious:t>1&&(u||!s),nextMonth:a,previousMonth:n,onPreviousClick:function(){n&&o(n)},onNextClick:function(){a&&o(a)}})}function e$(e){var t,r,n=eW(),a=n.classNames,o=n.disableNavigation,l=n.styles,i=n.captionLayout,s=n.components,u=null!==(t=null==s?void 0:s.CaptionLabel)&&void 0!==t?t:eq;return r=o?(0,ep.jsx)(u,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===i?(0,ep.jsx)(eQ,{displayMonth:e.displayMonth,id:e.id}):"dropdown-buttons"===i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eQ,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),(0,ep.jsx)(eJ,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,ep.jsx)(eJ,{displayMonth:e.displayMonth,id:e.id})]}),(0,ep.jsx)("div",{className:a.caption,style:l.caption,children:r})}function e0(e){var t=eW(),r=t.footer,n=t.styles,a=t.classNames.tfoot;return r?(0,ep.jsx)("tfoot",{className:a,style:n.tfoot,children:(0,ep.jsx)("tr",{children:(0,ep.jsx)("td",{colSpan:8,children:r})})}):(0,ep.jsx)(ep.Fragment,{})}function e1(){var e=eW(),t=e.classNames,r=e.styles,n=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,u=function(e,t,r){for(var n=r?W(new Date):Y(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=(0,x.E)(n,o);a.push(l)}return a}(a,o,l);return(0,ep.jsxs)("tr",{style:r.head_row,className:t.head_row,children:[n&&(0,ep.jsx)("td",{style:r.head_cell,className:t.head_cell}),u.map(function(e,n){return(0,ep.jsx)("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":s(e,{locale:a}),children:i(e,{locale:a})},n)})]})}function e2(){var e,t=eW(),r=t.classNames,n=t.styles,a=t.components,o=null!==(e=null==a?void 0:a.HeadRow)&&void 0!==e?e:e1;return(0,ep.jsx)("thead",{style:n.head,className:r.head,children:(0,ep.jsx)(o,{})})}function e4(e){var t=eW(),r=t.locale,n=t.formatters.formatDay;return(0,ep.jsx)(ep.Fragment,{children:n(e.date,{locale:r})})}var e5=(0,d.createContext)(void 0);function e3(e){return e_(e.initialProps)?(0,ep.jsx)(e8,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(e5.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}function e8(e){var t=e.initialProps,r=e.children,n=t.selected,a=t.min,o=t.max,l={disabled:[]};return n&&l.disabled.push(function(e){var t=o&&n.length>o-1,r=n.some(function(t){return ek(t,e)});return!!(t&&!r)}),(0,ep.jsx)(e5.Provider,{value:{selected:n,onDayClick:function(e,r,l){if(null===(i=t.onDayClick)||void 0===i||i.call(t,e,r,l),(!r.selected||!a||(null==n?void 0:n.length)!==a)&&(r.selected||!o||(null==n?void 0:n.length)!==o)){var i,s,u=n?eD([],n,!0):[];if(r.selected){var d=u.findIndex(function(t){return ek(e,t)});u.splice(d,1)}else u.push(e);null===(s=t.onSelect)||void 0===s||s.call(t,u,e,r,l)}},modifiers:l},children:r})}function e6(){var e=(0,d.useContext)(e5);if(!e)throw Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var e7=(0,d.createContext)(void 0);function e9(e){return eL(e.initialProps)?(0,ep.jsx)(te,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(e7.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}function te(e){var t=e.initialProps,r=e.children,n=t.selected,a=n||{},o=a.from,l=a.to,i=t.min,s=t.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],l?(u.range_end=[l],ek(o,l)||(u.range_middle=[{after:o,before:l}])):u.range_end=[o]):l&&(u.range_start=[l],u.range_end=[l]),i&&(o&&!l&&u.disabled.push({after:k(o,i-1),before:(0,x.E)(o,i-1)}),o&&l&&u.disabled.push({after:o,before:(0,x.E)(o,i-1)}),!o&&l&&u.disabled.push({after:k(l,i-1),before:(0,x.E)(l,i-1)})),s){if(o&&!l&&(u.disabled.push({before:(0,x.E)(o,-s+1)}),u.disabled.push({after:(0,x.E)(o,s-1)})),o&&l){var d=s-(I(l,o)+1);u.disabled.push({before:k(o,d)}),u.disabled.push({after:(0,x.E)(l,d)})}!o&&l&&(u.disabled.push({before:(0,x.E)(l,-s+1)}),u.disabled.push({after:(0,x.E)(l,s-1)}))}return(0,ep.jsx)(e7.Provider,{value:{selected:n,onDayClick:function(e,r,a){null===(s=t.onDayClick)||void 0===s||s.call(t,e,r,a);var o,l,i,s,u,d=(l=(o=n||{}).from,i=o.to,l&&i?ek(i,e)&&ek(l,e)?void 0:ek(i,e)?{from:i,to:void 0}:ek(l,e)?void 0:eM(l,e)?{from:e,to:i}:{from:l,to:e}:i?eM(e,i)?{from:i,to:e}:{from:e,to:i}:l?ex(e,l)?{from:e,to:l}:{from:l,to:e}:{from:e,to:void 0});null===(u=t.onSelect)||void 0===u||u.call(t,d,e,r,a)},modifiers:u},children:r})}function tt(){var e=(0,d.useContext)(e7);if(!e)throw Error("useSelectRange must be used within a SelectRangeProvider");return e}function tr(e){return Array.isArray(e)?eD([],e,!0):void 0!==e?[e]:[]}(i=s||(s={})).Outside="outside",i.Disabled="disabled",i.Selected="selected",i.Hidden="hidden",i.Today="today",i.RangeStart="range_start",i.RangeEnd="range_end",i.RangeMiddle="range_middle";var tn=s.Selected,ta=s.Disabled,to=s.Hidden,tl=s.Today,ti=s.RangeEnd,ts=s.RangeMiddle,tu=s.RangeStart,td=s.Outside,tc=(0,d.createContext)(void 0);function tm(e){var t,r,n,a=eW(),o=e6(),l=tt(),i=((t={})[tn]=tr(a.selected),t[ta]=tr(a.disabled),t[to]=tr(a.hidden),t[tl]=[a.today],t[ti]=[],t[ts]=[],t[tu]=[],t[td]=[],a.fromDate&&t[ta].push({before:a.fromDate}),a.toDate&&t[ta].push({after:a.toDate}),e_(a)?t[ta]=t[ta].concat(o.modifiers[ta]):eL(a)&&(t[ta]=t[ta].concat(l.modifiers[ta]),t[tu]=l.modifiers[tu],t[ts]=l.modifiers[ts],t[ti]=l.modifiers[ti]),t),s=(r=a.modifiers,n={},Object.entries(r).forEach(function(e){var t=e[0],r=e[1];n[t]=tr(r)}),n),u=eS(eS({},i),s);return(0,ep.jsx)(tc.Provider,{value:u,children:e.children})}function tf(){var e=(0,d.useContext)(tc);if(!e)throw Error("useModifiers must be used within a ModifiersProvider");return e}function th(e,t,r){var n=Object.keys(t).reduce(function(r,n){return t[n].some(function(t){if("boolean"==typeof t)return t;if(er(t))return ek(e,t);if(Array.isArray(t)&&t.every(er))return t.includes(e);if(t&&"object"==typeof t&&"from"in t)return n=t.from,a=t.to,n&&a?(0>I(a,n)&&(n=(r=[a,n])[0],a=r[1]),I(e,n)>=0&&I(a,e)>=0):a?ek(a,e):!!n&&ek(n,e);if(t&&"object"==typeof t&&"dayOfWeek"in t)return t.dayOfWeek.includes(e.getDay());if(t&&"object"==typeof t&&"before"in t&&"after"in t){var r,n,a,o=I(t.before,e),l=I(t.after,e),i=o>0,s=l<0;return eM(t.before,t.after)?s&&i:i||s}return t&&"object"==typeof t&&"after"in t?I(e,t.after)>0:t&&"object"==typeof t&&"before"in t?I(t.before,e)>0:"function"==typeof t&&t(e)})&&r.push(n),r},[]),a={};return n.forEach(function(e){return a[e]=!0}),r&&!ew(e,r)&&(a.outside=!0),a}var tp=(0,d.createContext)(void 0);function tv(e){var t=eZ(),r=tf(),n=(0,d.useState)(),a=n[0],o=n[1],l=(0,d.useState)(),i=l[0],s=l[1],u=function(e,t){for(var r,n,a=v(e[0]),o=ev(e[e.length-1]),l=a;l<=o;){var i=th(l,t);if(!(!i.disabled&&!i.hidden)){l=(0,x.E)(l,1);continue}if(i.selected)return l;i.today&&!n&&(n=l),r||(r=l),l=(0,x.E)(l,1)}return n||r}(t.displayMonths,r),c=(null!=a?a:i&&t.isDateDisplayed(i))?i:u,m=function(e){o(e)},f=eW(),h=function(e,n){if(a){var o=function e(t,r){var n=r.moveBy,a=r.direction,o=r.context,l=r.modifiers,i=r.retry,s=void 0===i?{count:0,lastFocused:t}:i,u=o.weekStartsOn,d=o.fromDate,c=o.toDate,m=o.locale,f=({day:x.E,week:eE,month:M.z,year:eN,startOfWeek:function(e){return o.ISOWeek?W(e):Y(e,{locale:m,weekStartsOn:u})},endOfWeek:function(e){return o.ISOWeek?eP(e):eC(e,{locale:m,weekStartsOn:u})}})[n](t,"after"===a?1:-1);"before"===a&&d?f=y([d,f]):"after"===a&&c&&(f=w([c,f]));var h=!0;if(l){var p=th(f,l);h=!p.disabled&&!p.hidden}return h?f:s.count>365?s.lastFocused:e(f,{moveBy:n,direction:a,context:o,modifiers:l,retry:eS(eS({},s),{count:s.count+1})})}(a,{moveBy:e,direction:n,context:f,modifiers:r});ek(a,o)||(t.goToDate(o,a),m(o))}};return(0,ep.jsx)(tp.Provider,{value:{focusedDay:a,focusTarget:c,blur:function(){s(a),o(void 0)},focus:m,focusDayAfter:function(){return h("day","after")},focusDayBefore:function(){return h("day","before")},focusWeekAfter:function(){return h("week","after")},focusWeekBefore:function(){return h("week","before")},focusMonthBefore:function(){return h("month","before")},focusMonthAfter:function(){return h("month","after")},focusYearBefore:function(){return h("year","before")},focusYearAfter:function(){return h("year","after")},focusStartOfWeek:function(){return h("startOfWeek","before")},focusEndOfWeek:function(){return h("endOfWeek","after")}},children:e.children})}function tb(){var e=(0,d.useContext)(tp);if(!e)throw Error("useFocusContext must be used within a FocusProvider");return e}var tg=(0,d.createContext)(void 0);function ty(e){return ej(e.initialProps)?(0,ep.jsx)(tw,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(tg.Provider,{value:{selected:void 0},children:e.children})}function tw(e){var t=e.initialProps,r=e.children,n={selected:t.selected,onDayClick:function(e,r,n){var a,o,l;if(null===(a=t.onDayClick)||void 0===a||a.call(t,e,r,n),r.selected&&!t.required){null===(o=t.onSelect)||void 0===o||o.call(t,void 0,e,r,n);return}null===(l=t.onSelect)||void 0===l||l.call(t,e,e,r,n)}};return(0,ep.jsx)(tg.Provider,{value:n,children:r})}function tx(){var e=(0,d.useContext)(tg);if(!e)throw Error("useSelectSingle must be used within a SelectSingleProvider");return e}function tk(e){var t,r,n,a,o,l,i,u,c,m,f,h,p,v,b,g,y,w,x,k,M,E,N,C,P,S,D,_,L,j,O,T,F,I,Y,W,q,z,R,B,H,A,V=(0,d.useRef)(null),Z=(t=e.date,r=e.displayMonth,l=eW(),i=tb(),u=th(t,tf(),r),c=eW(),m=tx(),f=e6(),h=tt(),v=(p=tb()).focusDayAfter,b=p.focusDayBefore,g=p.focusWeekAfter,y=p.focusWeekBefore,w=p.blur,x=p.focus,k=p.focusMonthBefore,M=p.focusMonthAfter,E=p.focusYearBefore,N=p.focusYearAfter,C=p.focusStartOfWeek,P=p.focusEndOfWeek,S={onClick:function(e){var r,n,a,o;ej(c)?null===(r=m.onDayClick)||void 0===r||r.call(m,t,u,e):e_(c)?null===(n=f.onDayClick)||void 0===n||n.call(f,t,u,e):eL(c)?null===(a=h.onDayClick)||void 0===a||a.call(h,t,u,e):null===(o=c.onDayClick)||void 0===o||o.call(c,t,u,e)},onFocus:function(e){var r;x(t),null===(r=c.onDayFocus)||void 0===r||r.call(c,t,u,e)},onBlur:function(e){var r;w(),null===(r=c.onDayBlur)||void 0===r||r.call(c,t,u,e)},onKeyDown:function(e){var r;switch(e.key){case"ArrowLeft":e.preventDefault(),e.stopPropagation(),"rtl"===c.dir?v():b();break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),"rtl"===c.dir?b():v();break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),g();break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),y();break;case"PageUp":e.preventDefault(),e.stopPropagation(),e.shiftKey?E():k();break;case"PageDown":e.preventDefault(),e.stopPropagation(),e.shiftKey?N():M();break;case"Home":e.preventDefault(),e.stopPropagation(),C();break;case"End":e.preventDefault(),e.stopPropagation(),P()}null===(r=c.onDayKeyDown)||void 0===r||r.call(c,t,u,e)},onKeyUp:function(e){var r;null===(r=c.onDayKeyUp)||void 0===r||r.call(c,t,u,e)},onMouseEnter:function(e){var r;null===(r=c.onDayMouseEnter)||void 0===r||r.call(c,t,u,e)},onMouseLeave:function(e){var r;null===(r=c.onDayMouseLeave)||void 0===r||r.call(c,t,u,e)},onPointerEnter:function(e){var r;null===(r=c.onDayPointerEnter)||void 0===r||r.call(c,t,u,e)},onPointerLeave:function(e){var r;null===(r=c.onDayPointerLeave)||void 0===r||r.call(c,t,u,e)},onTouchCancel:function(e){var r;null===(r=c.onDayTouchCancel)||void 0===r||r.call(c,t,u,e)},onTouchEnd:function(e){var r;null===(r=c.onDayTouchEnd)||void 0===r||r.call(c,t,u,e)},onTouchMove:function(e){var r;null===(r=c.onDayTouchMove)||void 0===r||r.call(c,t,u,e)},onTouchStart:function(e){var r;null===(r=c.onDayTouchStart)||void 0===r||r.call(c,t,u,e)}},D=eW(),_=tx(),L=e6(),j=tt(),O=ej(D)?_.selected:e_(D)?L.selected:eL(D)?j.selected:void 0,T=!!(l.onDayClick||"default"!==l.mode),(0,d.useEffect)(function(){var e;!u.outside&&i.focusedDay&&T&&ek(i.focusedDay,t)&&(null===(e=V.current)||void 0===e||e.focus())},[i.focusedDay,t,V,T,u.outside]),I=(F=[l.classNames.day],Object.keys(u).forEach(function(e){var t=l.modifiersClassNames[e];if(t)F.push(t);else if(Object.values(s).includes(e)){var r=l.classNames["day_".concat(e)];r&&F.push(r)}}),F).join(" "),Y=eS({},l.styles.day),Object.keys(u).forEach(function(e){var t;Y=eS(eS({},Y),null===(t=l.modifiersStyles)||void 0===t?void 0:t[e])}),W=Y,q=!!(u.outside&&!l.showOutsideDays||u.hidden),z=null!==(o=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==o?o:e4,R={style:W,className:I,children:(0,ep.jsx)(z,{date:t,displayMonth:r,activeModifiers:u}),role:"gridcell"},B=i.focusTarget&&ek(i.focusTarget,t)&&!u.outside,H=i.focusedDay&&ek(i.focusedDay,t),A=eS(eS(eS({},R),((n={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,n.tabIndex=H||B?0:-1,n)),S),{isButton:T,isHidden:q,activeModifiers:u,selectedDays:O,buttonProps:A,divProps:R});return Z.isHidden?(0,ep.jsx)("div",{role:"gridcell"}):Z.isButton?(0,ep.jsx)(eK,eS({name:"day",ref:V},Z.buttonProps)):(0,ep.jsx)("div",eS({},Z.divProps))}function tM(e){var t=e.number,r=e.dates,n=eW(),a=n.onWeekNumberClick,o=n.styles,l=n.classNames,i=n.locale,s=n.labels.labelWeekNumber,u=(0,n.formatters.formatWeekNumber)(Number(t),{locale:i});if(!a)return(0,ep.jsx)("span",{className:l.weeknumber,style:o.weeknumber,children:u});var d=s(Number(t),{locale:i});return(0,ep.jsx)(eK,{name:"week-number","aria-label":d,className:l.weeknumber,style:o.weeknumber,onClick:function(e){a(t,r,e)},children:u})}function tE(e){var t,r,n,a=eW(),o=a.styles,l=a.classNames,i=a.showWeekNumber,s=a.components,u=null!==(t=null==s?void 0:s.Day)&&void 0!==t?t:tk,d=null!==(r=null==s?void 0:s.WeekNumber)&&void 0!==r?r:tM;return i&&(n=(0,ep.jsx)("td",{className:l.cell,style:o.cell,children:(0,ep.jsx)(d,{number:e.weekNumber,dates:e.dates})})),(0,ep.jsxs)("tr",{className:l.row,style:o.row,children:[n,e.dates.map(function(t){return(0,ep.jsx)("td",{className:l.cell,style:o.cell,role:"presentation",children:(0,ep.jsx)(u,{displayMonth:e.displayMonth,date:t})},Math.trunc(+(0,f.Q)(t)/1e3))})]})}function tN(e,t,r){for(var n=(null==r?void 0:r.ISOWeek)?eP(t):eC(t,r),a=(null==r?void 0:r.ISOWeek)?W(e):Y(e,r),o=I(n,a),l=[],i=0;i<=o;i++)l.push((0,x.E)(a,i));return l.reduce(function(e,t){var n=(null==r?void 0:r.ISOWeek)?z(t):B(t,r),a=e.find(function(e){return e.weekNumber===n});return a?a.dates.push(t):e.push({weekNumber:n,dates:[t]}),e},[])}function tC(e){var t,r,n,a=eW(),o=a.locale,l=a.classNames,i=a.styles,s=a.hideHead,u=a.fixedWeeks,d=a.components,c=a.weekStartsOn,m=a.firstWeekContainsDate,h=a.ISOWeek,p=function(e,t){var r=tN(v(e),ev(e),t);if(null==t?void 0:t.useFixedWeeks){var n=function(e,t,r){let n=Y(e,r),a=Y(t,r);return Math.round((+n-F(n)-(+a-F(a)))/6048e5)}(function(e){let t=(0,f.Q)(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}(e),v(e),t)+1;if(n<6){var a=r[r.length-1],o=a.dates[a.dates.length-1],l=eE(o,6-n),i=tN(eE(o,1),l,t);r.push.apply(r,i)}}return r}(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:h,locale:o,weekStartsOn:c,firstWeekContainsDate:m}),b=null!==(t=null==d?void 0:d.Head)&&void 0!==t?t:e2,g=null!==(r=null==d?void 0:d.Row)&&void 0!==r?r:tE,y=null!==(n=null==d?void 0:d.Footer)&&void 0!==n?n:e0;return(0,ep.jsxs)("table",{id:e.id,className:l.table,style:i.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!s&&(0,ep.jsx)(b,{}),(0,ep.jsx)("tbody",{className:l.tbody,style:i.tbody,children:p.map(function(t){return(0,ep.jsx)(g,{displayMonth:e.displayMonth,dates:t.dates,weekNumber:t.weekNumber},t.weekNumber)})}),(0,ep.jsx)(y,{displayMonth:e.displayMonth})]})}var tP="undefined"!=typeof window&&window.document&&window.document.createElement?d.useLayoutEffect:d.useEffect,tS=!1,tD=0;function t_(){return"react-day-picker-".concat(++tD)}function tL(e){var t,r,n,a,o,l,i,s,u=eW(),c=u.dir,m=u.classNames,f=u.styles,h=u.components,p=eZ().displayMonths,v=(n=null!=(t=u.id?"".concat(u.id,"-").concat(e.displayIndex):void 0)?t:tS?t_():null,o=(a=(0,d.useState)(n))[0],l=a[1],tP(function(){null===o&&l(t_())},[]),(0,d.useEffect)(function(){!1===tS&&(tS=!0)},[]),null!==(r=null!=t?t:o)&&void 0!==r?r:void 0),b=u.id?"".concat(u.id,"-grid-").concat(e.displayIndex):void 0,g=[m.month],y=f.month,w=0===e.displayIndex,x=e.displayIndex===p.length-1,k=!w&&!x;"rtl"===c&&(x=(i=[w,x])[0],w=i[1]),w&&(g.push(m.caption_start),y=eS(eS({},y),f.caption_start)),x&&(g.push(m.caption_end),y=eS(eS({},y),f.caption_end)),k&&(g.push(m.caption_between),y=eS(eS({},y),f.caption_between));var M=null!==(s=null==h?void 0:h.Caption)&&void 0!==s?s:e$;return(0,ep.jsxs)("div",{className:g.join(" "),style:y,children:[(0,ep.jsx)(M,{id:v,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,ep.jsx)(tC,{id:b,"aria-labelledby":v,displayMonth:e.displayMonth})]},e.displayIndex)}function tj(e){var t=eW(),r=t.classNames,n=t.styles;return(0,ep.jsx)("div",{className:r.months,style:n.months,children:e.children})}function tO(e){var t,r,n=e.initialProps,a=eW(),o=tb(),l=eZ(),i=(0,d.useState)(!1),s=i[0],u=i[1];(0,d.useEffect)(function(){a.initialFocus&&o.focusTarget&&(s||(o.focus(o.focusTarget),u(!0)))},[a.initialFocus,s,o.focus,o.focusTarget,o]);var c=[a.classNames.root,a.className];a.numberOfMonths>1&&c.push(a.classNames.multiple_months),a.showWeekNumber&&c.push(a.classNames.with_weeknumber);var m=eS(eS({},a.styles.root),a.style),f=Object.keys(n).filter(function(e){return e.startsWith("data-")}).reduce(function(e,t){var r;return eS(eS({},e),((r={})[t]=n[t],r))},{}),h=null!==(r=null===(t=n.components)||void 0===t?void 0:t.Months)&&void 0!==r?r:tj;return(0,ep.jsx)("div",eS({className:c.join(" "),style:m,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},f,{children:(0,ep.jsx)(h,{children:l.displayMonths.map(function(e,t){return(0,ep.jsx)(tL,{displayIndex:t,displayMonth:e},t)})})}))}function tT(e){var t=e.children,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}(e,["children"]);return(0,ep.jsx)(eY,{initialProps:r,children:(0,ep.jsx)(eV,{children:(0,ep.jsx)(ty,{initialProps:r,children:(0,ep.jsx)(e3,{initialProps:r,children:(0,ep.jsx)(e9,{initialProps:r,children:(0,ep.jsx)(tm,{children:(0,ep.jsx)(tv,{children:t})})})})})})})}function tF(e){return(0,ep.jsx)(tT,eS({},e,{children:(0,ep.jsx)(tO,{initialProps:e})}))}let tI=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},tY=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},tW=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},tq=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))};var tz=r(84264);r(41649);var tR=r(47187),tB=r(7084),tH=r(26898);let tA={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-1",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-1.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-lg"},xl:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-xl"}},tV={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},tZ={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},tQ={[tB.wu.Increase]:{bgColor:(0,eu.bM)(tB.fr.Emerald,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconRing).ringColor},[tB.wu.ModerateIncrease]:{bgColor:(0,eu.bM)(tB.fr.Emerald,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconRing).ringColor},[tB.wu.Decrease]:{bgColor:(0,eu.bM)(tB.fr.Red,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Red,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Red,tH.K.iconRing).ringColor},[tB.wu.ModerateDecrease]:{bgColor:(0,eu.bM)(tB.fr.Red,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Red,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Red,tH.K.iconRing).ringColor},[tB.wu.Unchanged]:{bgColor:(0,eu.bM)(tB.fr.Orange,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Orange,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Orange,tH.K.iconRing).ringColor}},tG={[tB.wu.Increase]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z"}))},[tB.wu.ModerateIncrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"}))},[tB.wu.Decrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z"}))},[tB.wu.ModerateDecrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M14.5895 16.0032L5.98291 7.39664L7.39712 5.98242L16.0037 14.589V7.00324H18.0037V18.0032H7.00373V16.0032H14.5895Z"}))},[tB.wu.Unchanged]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"}))}},tX=(0,eu.fn)("BadgeDelta");d.forwardRef((e,t)=>{let{deltaType:r=tB.wu.Increase,isIncreasePositive:n=!0,size:a=tB.u8.SM,tooltip:o,children:l,className:i}=e,s=(0,u._T)(e,["deltaType","isIncreasePositive","size","tooltip","children","className"]),c=tG[r],m=(0,eu.Fo)(r,n),f=l?tV:tA,{tooltipProps:h,getReferenceProps:p}=(0,tR.l)();return d.createElement("span",Object.assign({ref:(0,eu.lq)([t,h.refs.setReference]),className:(0,b.q)(tX("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",tQ[m].bgColor,tQ[m].textColor,tQ[m].ringColor,f[a].paddingX,f[a].paddingY,f[a].fontSize,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60",i)},p,s),d.createElement(tR.Z,Object.assign({text:o},h)),d.createElement(c,{className:(0,b.q)(tX("icon"),"shrink-0",l?(0,b.q)("-ml-1 mr-1.5"):tZ[a].height,tZ[a].width)}),l?d.createElement("span",{className:(0,b.q)(tX("text"),"whitespace-nowrap")},l):null)}).displayName="BadgeDelta";var tK=r(47323);let tU=e=>{var{onClick:t,icon:r}=e,n=(0,u._T)(e,["onClick","icon"]);return d.createElement("button",Object.assign({type:"button",className:(0,b.q)("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},n),d.createElement(tK.Z,{onClick:t,icon:r,variant:"simple",color:"slate",size:"sm"}))};function tJ(e){var{mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,enableYearNavigation:i,classNames:s,weekStartsOn:c=0}=e,m=(0,u._T)(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return d.createElement(tF,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,weekStartsOn:c,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},s),components:{IconLeft:e=>{var t=(0,u._T)(e,[]);return d.createElement(tI,Object.assign({className:"h-4 w-4"},t))},IconRight:e=>{var t=(0,u._T)(e,[]);return d.createElement(tY,Object.assign({className:"h-4 w-4"},t))},Caption:e=>{var t=(0,u._T)(e,[]);let{goToMonth:r,nextMonth:n,previousMonth:a,currentMonth:l}=eZ();return d.createElement("div",{className:"flex justify-between items-center"},d.createElement("div",{className:"flex items-center space-x-1"},i&&d.createElement(tU,{onClick:()=>l&&r(eN(l,-1)),icon:tW}),d.createElement(tU,{onClick:()=>a&&r(a),icon:tI})),d.createElement(tz.Z,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},es(t.displayMonth,"LLLL yyy",{locale:o})),d.createElement("div",{className:"flex items-center space-x-1"},d.createElement(tU,{onClick:()=>n&&r(n),icon:tY}),i&&d.createElement(tU,{onClick:()=>l&&r(eN(l,1)),icon:tq})))}}},m))}tJ.displayName="DateRangePicker",r(27281);var t$=r(43227),t0=r(44140),t1=r(71049),t2=r(11323),t4=r(66797),t5=r(86852),t3=r(93980),t8=r(43507),t6=r(73389),t7=r(12315),t9=r(23137),re=r(84574),rt=r(65573),rr=r(65639),rn=r(5664);let ra=(0,d.createContext)(null);function ro(e){let{children:t,node:r}=e,[n,a]=(0,d.useState)(null),o=rl(null!=r?r:n);return d.createElement(ra.Provider,{value:o},t,null===o&&d.createElement(rr._,{features:rr.x.Hidden,ref:e=>{var t,r;if(e){for(let n of null!=(r=null==(t=(0,rn.r)(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(n!==document.body&&n!==document.head&&n instanceof HTMLElement&&null!=n&&n.contains(e)){a(n);break}}}}))}function rl(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!=(e=(0,d.useContext)(ra))?e:t}var ri=r(48852),rs=r(67561),ru=r(26776),rd=((n=rd||{})[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n);function rc(){let e=(0,d.useRef)(0);return(0,ru.s)(!0,"keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}var rm=r(98218),rf=r(33443),rh=r(47506),rp=r(28294),rv=r(31370),rb=r(93698),rg=r(72468),ry=r(38929),rw=r(52724),rx=r(4796),rk=((a=rk||{})[a.Open=0]="Open",a[a.Closed=1]="Closed",a),rM=((o=rM||{})[o.TogglePopover=0]="TogglePopover",o[o.ClosePopover=1]="ClosePopover",o[o.SetButton=2]="SetButton",o[o.SetButtonId=3]="SetButtonId",o[o.SetPanel=4]="SetPanel",o[o.SetPanelId=5]="SetPanelId",o);let rE={0:e=>({...e,popoverState:(0,rg.E)(e.popoverState,{0:1,1:0}),__demoMode:!1}),1:e=>1===e.popoverState?e:{...e,popoverState:1,__demoMode:!1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},rN=(0,d.createContext)(null);function rC(e){let t=(0,d.useContext)(rN);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,rC),t}return t}rN.displayName="PopoverContext";let rP=(0,d.createContext)(null);function rS(e){let t=(0,d.useContext)(rP);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,rS),t}return t}rP.displayName="PopoverAPIContext";let rD=(0,d.createContext)(null);function r_(){return(0,d.useContext)(rD)}rD.displayName="PopoverGroupContext";let rL=(0,d.createContext)(null);function rj(e,t){return(0,rg.E)(t.type,rE,e,t)}rL.displayName="PopoverPanelContext";let rO=ry.VN.RenderStrategy|ry.VN.Static;function rT(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-backdrop-".concat(r),transition:a=!1,...o}=e,[{popoverState:l},i]=rC("Popover.Backdrop"),[s,u]=(0,d.useState)(null),c=(0,rs.T)(t,u),m=(0,rp.oJ)(),[f,h]=(0,rm.Y)(a,s,null!==m?(m&rp.ZM.Open)===rp.ZM.Open:0===l),p=(0,t3.z)(e=>{if((0,rv.P)(e.currentTarget))return e.preventDefault();i({type:1})}),v=(0,d.useMemo)(()=>({open:0===l}),[l]),b={ref:c,id:n,"aria-hidden":!0,onClick:p,...(0,rm.X)(h)};return(0,ry.L6)()({ourProps:b,theirProps:o,slot:v,defaultTag:"div",features:rO,visible:f,name:"Popover.Backdrop"})}let rF=ry.VN.RenderStrategy|ry.VN.Static,rI=(0,ry.yV)(function(e,t){var r,n,a,o;let l;let{__demoMode:i=!1,...s}=e,u=(0,d.useRef)(null),c=(0,rs.T)(t,(0,rs.h)(e=>{u.current=e})),m=(0,d.useRef)([]),f=(0,d.useReducer)(rj,{__demoMode:i,popoverState:i?0:1,buttons:m,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:(0,d.createRef)(),afterPanelSentinel:(0,d.createRef)(),afterButtonSentinel:(0,d.createRef)()}),[{popoverState:h,button:p,buttonId:v,panel:b,panelId:g,beforePanelSentinel:y,afterPanelSentinel:w,afterButtonSentinel:x},k]=f,M=(0,re.i)(null!=(r=u.current)?r:p),E=(0,d.useMemo)(()=>{if(!p||!b)return!1;for(let e of document.querySelectorAll("body > *"))if(Number(null==e?void 0:e.contains(p))^Number(null==e?void 0:e.contains(b)))return!0;let e=(0,rb.GO)(),t=e.indexOf(p),r=(t+e.length-1)%e.length,n=(t+1)%e.length,a=e[r],o=e[n];return!b.contains(a)&&!b.contains(o)},[p,b]),N=(0,t8.E)(v),C=(0,t8.E)(g),P=(0,d.useMemo)(()=>({buttonId:N,panelId:C,close:()=>k({type:1})}),[N,C,k]),S=r_(),D=null==S?void 0:S.registerPopover,_=(0,t3.z)(()=>{var e;return null!=(e=null==S?void 0:S.isFocusWithinPopoverGroup())?e:(null==M?void 0:M.activeElement)&&((null==p?void 0:p.contains(M.activeElement))||(null==b?void 0:b.contains(M.activeElement)))});(0,d.useEffect)(()=>null==D?void 0:D(P),[D,P]);let[L,j]=(0,rx.kF)(),O=rl(p),T=function(){let{defaultContainers:e=[],portals:t,mainTreeNode:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,re.i)(r),a=(0,t3.z)(()=>{var a,o;let l=[];for(let t of e)null!==t&&(t instanceof HTMLElement?l.push(t):"current"in t&&t.current instanceof HTMLElement&&l.push(t.current));if(null!=t&&t.current)for(let e of t.current)l.push(e);for(let e of null!=(a=null==n?void 0:n.querySelectorAll("html > *, body > *"))?a:[])e!==document.body&&e!==document.head&&e instanceof HTMLElement&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(o=null==r?void 0:r.getRootNode())?void 0:o.host))||l.some(t=>e.contains(t))||l.push(e));return l});return{resolveContainers:a,contains:(0,t3.z)(e=>a().some(t=>t.contains(e)))}}({mainTreeNode:O,portals:L,defaultContainers:[p,b]});n=null==M?void 0:M.defaultView,a="focus",o=e=>{var t,r,n,a,o,l;e.target!==window&&e.target instanceof HTMLElement&&0===h&&(_()||p&&b&&(T.contains(e.target)||null!=(r=null==(t=y.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(a=null==(n=w.current)?void 0:n.contains)&&a.call(n,e.target)||null!=(l=null==(o=x.current)?void 0:o.contains)&&l.call(o,e.target)||k({type:1})))},l=(0,t8.E)(o),(0,d.useEffect)(()=>{function e(e){l.current(e)}return(n=null!=n?n:window).addEventListener(a,e,!0),()=>n.removeEventListener(a,e,!0)},[n,a,!0]),(0,t9.O)(0===h,T.resolveContainers,(e,t)=>{k({type:1}),(0,rb.sP)(t,rb.tJ.Loose)||(e.preventDefault(),null==p||p.focus())});let F=(0,t3.z)(e=>{k({type:1});let t=e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:p:p;null==t||t.focus()}),I=(0,d.useMemo)(()=>({close:F,isPortalled:E}),[F,E]),Y=(0,d.useMemo)(()=>({open:0===h,close:F}),[h,F]),W=(0,ry.L6)();return d.createElement(ro,{node:O},d.createElement(rh.HO,null,d.createElement(rL.Provider,{value:null},d.createElement(rN.Provider,{value:f},d.createElement(rP.Provider,{value:I},d.createElement(rf.Z,{value:F},d.createElement(rp.up,{value:(0,rg.E)(h,{0:rp.ZM.Open,1:rp.ZM.Closed})},d.createElement(j,null,W({ourProps:{ref:c},theirProps:s,slot:Y,defaultTag:"div",name:"Popover"})))))))))}),rY=(0,ry.yV)(function(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-button-".concat(r),disabled:a=!1,autoFocus:o=!1,...l}=e,[i,s]=rC("Popover.Button"),{isPortalled:u}=rS("Popover.Button"),c=(0,d.useRef)(null),m="headlessui-focus-sentinel-".concat((0,d.useId)()),f=r_(),h=null==f?void 0:f.closeOthers,p=null!==(0,d.useContext)(rL);(0,d.useEffect)(()=>{if(!p)return s({type:3,buttonId:n}),()=>{s({type:3,buttonId:null})}},[p,n,s]);let[v]=(0,d.useState)(()=>Symbol()),b=(0,rs.T)(c,t,(0,rh.AZ)(),(0,t3.z)(e=>{if(!p){if(e)i.buttons.current.push(v);else{let e=i.buttons.current.indexOf(v);-1!==e&&i.buttons.current.splice(e,1)}i.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),e&&s({type:2,button:e})}})),g=(0,rs.T)(c,t),y=(0,re.i)(c),w=(0,t3.z)(e=>{var t,r,n;if(p){if(1===i.popoverState)return;switch(e.key){case rw.R.Space:case rw.R.Enter:e.preventDefault(),null==(r=(t=e.target).click)||r.call(t),s({type:1}),null==(n=i.button)||n.focus()}}else switch(e.key){case rw.R.Space:case rw.R.Enter:e.preventDefault(),e.stopPropagation(),1===i.popoverState&&(null==h||h(i.buttonId)),s({type:0});break;case rw.R.Escape:if(0!==i.popoverState)return null==h?void 0:h(i.buttonId);if(!c.current||null!=y&&y.activeElement&&!c.current.contains(y.activeElement))return;e.preventDefault(),e.stopPropagation(),s({type:1})}}),x=(0,t3.z)(e=>{p||e.key===rw.R.Space&&e.preventDefault()}),k=(0,t3.z)(e=>{var t,r;(0,rv.P)(e.currentTarget)||a||(p?(s({type:1}),null==(t=i.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),1===i.popoverState&&(null==h||h(i.buttonId)),s({type:0}),null==(r=i.button)||r.focus()))}),M=(0,t3.z)(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:N}=(0,t1.F)({autoFocus:o}),{isHovered:C,hoverProps:P}=(0,t2.X)({isDisabled:a}),{pressed:S,pressProps:D}=(0,t4.x)({disabled:a}),_=0===i.popoverState,L=(0,d.useMemo)(()=>({open:_,active:S||_,disabled:a,hover:C,focus:E,autofocus:o}),[_,C,E,S,a,o]),j=(0,rt.f)(e,i.button),O=p?(0,ry.dG)({ref:g,type:j,onKeyDown:w,onClick:k,disabled:a||void 0,autoFocus:o},N,P,D):(0,ry.dG)({ref:b,id:i.buttonId,type:j,"aria-expanded":0===i.popoverState,"aria-controls":i.panel?i.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:w,onKeyUp:x,onClick:k,onMouseDown:M},N,P,D),T=rc(),F=(0,t3.z)(()=>{let e=i.panel;e&&(0,rg.E)(T.current,{[rd.Forwards]:()=>(0,rb.jA)(e,rb.TO.First),[rd.Backwards]:()=>(0,rb.jA)(e,rb.TO.Last)})===rb.fE.Error&&(0,rb.jA)((0,rb.GO)().filter(e=>"true"!==e.dataset.headlessuiFocusGuard),(0,rg.E)(T.current,{[rd.Forwards]:rb.TO.Next,[rd.Backwards]:rb.TO.Previous}),{relativeTo:i.button})}),I=(0,ry.L6)();return d.createElement(d.Fragment,null,I({ourProps:O,theirProps:l,slot:L,defaultTag:"button",name:"Popover.Button"}),_&&!p&&u&&d.createElement(rr._,{id:m,ref:i.afterButtonSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F}))}),rW=(0,ry.yV)(rT),rq=(0,ry.yV)(rT),rz=(0,ry.yV)(function(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-panel-".concat(r),focus:a=!1,anchor:o,portal:l=!1,modal:i=!1,transition:s=!1,...u}=e,[c,m]=rC("Popover.Panel"),{close:f,isPortalled:h}=rS("Popover.Panel"),p="headlessui-focus-sentinel-before-".concat(r),v="headlessui-focus-sentinel-after-".concat(r),b=(0,d.useRef)(null),g=(0,rh.Vy)(o),[y,w]=(0,rh.ES)(g),x=(0,rh.U8)();g&&(l=!0);let[k,M]=(0,d.useState)(null),E=(0,rs.T)(b,t,g?y:null,(0,t3.z)(e=>m({type:4,panel:e})),M),N=(0,re.i)(b);(0,t6.e)(()=>(m({type:5,panelId:n}),()=>{m({type:5,panelId:null})}),[n,m]);let C=(0,rp.oJ)(),[P,S]=(0,rm.Y)(s,k,null!==C?(C&rp.ZM.Open)===rp.ZM.Open:0===c.popoverState);(0,t7.m)(P,c.button,()=>{m({type:1})});let D=!c.__demoMode&&i&&P;(0,ri.P)(D,N);let _=(0,t3.z)(e=>{var t;if(e.key===rw.R.Escape){if(0!==c.popoverState||!b.current||null!=N&&N.activeElement&&!b.current.contains(N.activeElement))return;e.preventDefault(),e.stopPropagation(),m({type:1}),null==(t=c.button)||t.focus()}});(0,d.useEffect)(()=>{var t;e.static||1===c.popoverState&&(null==(t=e.unmount)||t)&&m({type:4,panel:null})},[c.popoverState,e.unmount,e.static,m]),(0,d.useEffect)(()=>{if(c.__demoMode||!a||0!==c.popoverState||!b.current)return;let e=null==N?void 0:N.activeElement;b.current.contains(e)||(0,rb.jA)(b.current,rb.TO.First)},[c.__demoMode,a,b.current,c.popoverState]);let L=(0,d.useMemo)(()=>({open:0===c.popoverState,close:f}),[c.popoverState,f]),j=(0,ry.dG)(g?x():{},{ref:E,id:n,onKeyDown:_,onBlur:a&&0===c.popoverState?e=>{var t,r,n,a,o;let l=e.relatedTarget;l&&b.current&&(null!=(t=b.current)&&t.contains(l)||(m({type:1}),(null!=(n=null==(r=c.beforePanelSentinel.current)?void 0:r.contains)&&n.call(r,l)||null!=(o=null==(a=c.afterPanelSentinel.current)?void 0:a.contains)&&o.call(a,l))&&l.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...w,"--button-width":(0,t5.h)(c.button,!0).width},...(0,rm.X)(S)}),O=rc(),T=(0,t3.z)(()=>{let e=b.current;e&&(0,rg.E)(O.current,{[rd.Forwards]:()=>{var t;(0,rb.jA)(e,rb.TO.First)===rb.fE.Error&&(null==(t=c.afterPanelSentinel.current)||t.focus())},[rd.Backwards]:()=>{var e;null==(e=c.button)||e.focus({preventScroll:!0})}})}),F=(0,t3.z)(()=>{let e=b.current;e&&(0,rg.E)(O.current,{[rd.Forwards]:()=>{if(!c.button)return;let e=(0,rb.GO)(),t=e.indexOf(c.button),r=e.slice(0,t+1),n=[...e.slice(t+1),...r];for(let e of n.slice())if("true"===e.dataset.headlessuiFocusGuard||null!=k&&k.contains(e)){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}(0,rb.jA)(n,rb.TO.First,{sorted:!1})},[rd.Backwards]:()=>{var t;(0,rb.jA)(e,rb.TO.Previous)===rb.fE.Error&&(null==(t=c.button)||t.focus())}})}),I=(0,ry.L6)();return d.createElement(rp.uu,null,d.createElement(rL.Provider,{value:n},d.createElement(rP.Provider,{value:{close:f,isPortalled:h}},d.createElement(rx.h_,{enabled:!!l&&(e.static||P)},P&&h&&d.createElement(rr._,{id:p,ref:c.beforePanelSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}),I({ourProps:j,theirProps:u,slot:L,defaultTag:"div",features:rF,visible:P,name:"Popover.Panel"}),P&&h&&d.createElement(rr._,{id:v,ref:c.afterPanelSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F})))))}),rR=Object.assign(rI,{Button:rY,Backdrop:rq,Overlay:rW,Panel:rz,Group:(0,ry.yV)(function(e,t){let r=(0,d.useRef)(null),n=(0,rs.T)(r,t),[a,o]=(0,d.useState)([]),l=(0,t3.z)(e=>{o(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),i=(0,t3.z)(e=>(o(t=>[...t,e]),()=>l(e))),s=(0,t3.z)(()=>{var e;let t=(0,rn.r)(r);if(!t)return!1;let n=t.activeElement;return!!(null!=(e=r.current)&&e.contains(n))||a.some(e=>{var r,a;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(a=t.getElementById(e.panelId.current))?void 0:a.contains(n))})}),u=(0,t3.z)(e=>{for(let t of a)t.buttonId.current!==e&&t.close()}),c=(0,d.useMemo)(()=>({registerPopover:i,unregisterPopover:l,isFocusWithinPopoverGroup:s,closeOthers:u}),[i,l,s,u]),m=(0,d.useMemo)(()=>({}),[]),f=(0,ry.L6)();return d.createElement(ro,null,d.createElement(rD.Provider,{value:c},f({ourProps:{ref:n},theirProps:e,slot:m,defaultTag:"div",name:"Popover.Group"})))})});var rB=r(85238),rH=r(51975);let rA=p(),rV=d.forwardRef((e,t)=>{var r,n;let{value:a,defaultValue:o,onValueChange:l,enableSelect:i=!0,minDate:s,maxDate:f,placeholder:h="Select range",selectPlaceholder:p="Select range",disabled:y=!1,locale:w=O,enableClear:x=!0,displayFormat:k,children:M,className:E,enableYearNavigation:N=!1,weekStartsOn:C=0,disabledDates:P}=e,S=(0,u._T)(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[D,_]=(0,t0.Z)(o,a),[L,j]=(0,d.useState)(!1),[T,F]=(0,d.useState)(!1),I=(0,d.useMemo)(()=>{let e=[];return s&&e.push({before:s}),f&&e.push({after:f}),[...e,...null!=P?P:[]]},[s,f,P]),Y=(0,d.useMemo)(()=>{let e=new Map;return M?d.Children.forEach(M,t=>{var r;e.set(t.props.value,{text:null!==(r=(0,g.qg)(t))&&void 0!==r?r:t.props.value,from:t.props.from,to:t.props.to})}):ef.forEach(t=>{e.set(t.value,{text:t.text,from:t.from,to:rA})}),e},[M]),W=(0,d.useMemo)(()=>{if(M)return(0,g.sl)(M);let e=new Map;return ef.forEach(t=>e.set(t.value,t.text)),e},[M]),q=(null==D?void 0:D.selectValue)||"",z=ec(null==D?void 0:D.from,s,q,Y),R=em(null==D?void 0:D.to,f,q,Y),B=z||R?eh(z,R,w,k):h,H=v(null!==(n=null!==(r=null!=R?R:z)&&void 0!==r?r:f)&&void 0!==n?n:rA),A=x&&!y;return d.createElement("div",Object.assign({ref:t,className:(0,b.q)("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",E)},S),d.createElement(rR,{as:"div",className:(0,b.q)("w-full",i?"rounded-l-tremor-default":"rounded-tremor-default",L&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},d.createElement("div",{className:"relative w-full"},d.createElement(rY,{onFocus:()=>j(!0),onBlur:()=>j(!1),disabled:y,className:(0,b.q)("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",i?"rounded-l-tremor-default":"rounded-tremor-default",A?"pr-8":"pr-4",(0,g.um)((0,g.Uh)(z||R),y))},d.createElement(c,{className:(0,b.q)(ed("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),d.createElement("p",{className:"truncate"},B)),A&&z?d.createElement("button",{type:"button",className:(0,b.q)("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:e=>{e.preventDefault(),null==l||l({}),_({})}},d.createElement(m.Z,{className:(0,b.q)(ed("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),d.createElement(rB.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},d.createElement(rz,{anchor:"bottom start",focus:!0,className:(0,b.q)("min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},d.createElement(tJ,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:H,selected:{from:z,to:R},onSelect:e=>{null==l||l({from:null==e?void 0:e.from,to:null==e?void 0:e.to}),_({from:null==e?void 0:e.from,to:null==e?void 0:e.to})},locale:w,disabled:I,enableYearNavigation:N,classNames:{day_range_middle:(0,b.q)("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:C},e))))),i&&d.createElement(rH.Ri,{as:"div",className:(0,b.q)("w-48 -ml-px rounded-r-tremor-default",T&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:q,onChange:e=>{let{from:t,to:r}=Y.get(e),n=null!=r?r:rA;null==l||l({from:t,to:n,selectValue:e}),_({from:t,to:n,selectValue:e})},disabled:y},e=>{var t;let{value:r}=e;return d.createElement(d.Fragment,null,d.createElement(rH.Y4,{onFocus:()=>F(!0),onBlur:()=>F(!1),className:(0,b.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",(0,g.um)((0,g.Uh)(r),y))},r&&null!==(t=W.get(r))&&void 0!==t?t:p),d.createElement(rB.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},d.createElement(rH.O_,{anchor:"bottom end",className:(0,b.q)("[--anchor-gap:4px] divide-y overflow-y-auto outline-none border min-w-44","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},null!=M?M:ef.map(e=>d.createElement(t$.Z,{key:e.value,value:e.value},e.text)))))}))});rV.displayName="DateRangePicker"},92414:function(e,t,r){r.d(t,{Z:function(){return b}});var n=r(5853),a=r(2265);r(42698),r(64016),r(8710);var o=r(33232),l=r(44140),i=r(58747);let s=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))};var u=r(4537);let d=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))};var c=r(13241),m=r(1153),f=r(96398),h=r(51975),p=r(85238);let v=(0,m.fn)("MultiSelect"),b=a.forwardRef((e,t)=>{let{defaultValue:r=[],value:m,onValueChange:b,placeholder:g="Select...",placeholderSearch:y="Search",disabled:w=!1,icon:x,children:k,className:M,required:E,name:N,error:C=!1,errorMessage:P,id:S}=e,D=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),_=(0,a.useRef)(null),[L,j]=(0,l.Z)(r,m),{reactElementChildren:O,optionsAvailable:T}=(0,a.useMemo)(()=>{let e=a.Children.toArray(k).filter(a.isValidElement);return{reactElementChildren:e,optionsAvailable:(0,f.n0)("",e)}},[k]),[F,I]=(0,a.useState)(""),Y=(null!=L?L:[]).length>0,W=(0,a.useMemo)(()=>F?(0,f.n0)(F,O):T,[F,O,T]),q=()=>{I("")};return a.createElement("div",{className:(0,c.q)("w-full min-w-[10rem] text-tremor-default",M)},a.createElement("div",{className:"relative"},a.createElement("select",{title:"multi-select-hidden",required:E,className:(0,c.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:L,onChange:e=>{e.preventDefault()},name:N,disabled:w,multiple:!0,id:S,onFocus:()=>{let e=_.current;e&&e.focus()}},a.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),W.map(e=>{let t=e.props.value,r=e.props.children;return a.createElement("option",{className:"hidden",key:t,value:t},r)})),a.createElement(h.Ri,Object.assign({as:"div",ref:t,defaultValue:L,value:L,onChange:e=>{null==b||b(e),j(e)},disabled:w,id:S,multiple:!0},D),e=>{let{value:t}=e;return a.createElement(a.Fragment,null,a.createElement(h.Y4,{className:(0,c.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",x?"pl-11 -ml-0.5":"pl-3",(0,f.um)(t.length>0,w,C)),ref:_},x&&a.createElement("span",{className:(0,c.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},a.createElement(x,{className:(0,c.q)(v("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("div",{className:"h-6 flex items-center"},t.length>0?a.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},T.filter(e=>t.includes(e.props.value)).map((e,r)=>{var n;return a.createElement("div",{key:r,className:(0,c.q)("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},a.createElement("div",{className:"text-xs truncate "},null!==(n=e.props.children)&&void 0!==n?n:e.props.value),a.createElement("div",{onClick:r=>{r.preventDefault();let n=t.filter(t=>t!==e.props.value);null==b||b(n),j(n)}},a.createElement(d,{className:(0,c.q)(v("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):a.createElement("span",null,g)),a.createElement("span",{className:(0,c.q)("absolute inset-y-0 right-0 flex items-center mr-2.5")},a.createElement(i.Z,{className:(0,c.q)(v("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),Y&&!w?a.createElement("button",{type:"button",className:(0,c.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),j([]),null==b||b([])}},a.createElement(u.Z,{className:(0,c.q)(v("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,a.createElement(p.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},a.createElement(h.O_,{anchor:"bottom start",className:(0,c.q)("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},a.createElement("div",{className:(0,c.q)("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},a.createElement("span",null,a.createElement(s,{className:(0,c.q)("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:y,className:(0,c.q)("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:e=>{"Space"===e.code&&""!==e.target.value&&e.stopPropagation()},onChange:e=>I(e.target.value),value:F})),a.createElement(o.Z.Provider,Object.assign({},{onBlur:{handleResetSearch:q}},{value:{selectedValue:t}}),W))))})),C&&P?a.createElement("p",{className:(0,c.q)("errorMessage","text-sm text-rose-500 mt-1")},P):null)});b.displayName="MultiSelect"},46030:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853);r(42698),r(64016),r(8710);var a=r(33232),o=r(2265),l=r(13241),i=r(1153),s=r(51975);let u=(0,i.fn)("MultiSelectItem"),d=o.forwardRef((e,t)=>{let{value:r,className:d,children:c}=e,m=(0,n._T)(e,["value","className","children"]),{selectedValue:f}=(0,o.useContext)(a.Z),h=(0,i.NZ)(r,f);return o.createElement(s.wt,Object.assign({className:(0,l.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",d),ref:t,key:r,value:r},m),o.createElement("input",{type:"checkbox",className:(0,l.q)(u("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:h,readOnly:!0}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:r))});d.displayName="MultiSelectItem"},27281:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),a=r(58747),o=r(2265),l=r(4537),i=r(13241),s=r(1153),u=r(96398),d=r(51975),c=r(85238),m=r(44140);let f=(0,s.fn)("Select"),h=o.forwardRef((e,t)=>{let{defaultValue:r="",value:s,onValueChange:h,placeholder:p="Select...",disabled:v=!1,icon:b,enableClear:g=!1,required:y,children:w,name:x,error:k=!1,errorMessage:M,className:E,id:N}=e,C=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),P=(0,o.useRef)(null),S=o.Children.toArray(w),[D,_]=(0,m.Z)(r,s),L=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return(0,u.sl)(e)},[w]);return o.createElement("div",{className:(0,i.q)("w-full min-w-[10rem] text-tremor-default",E)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"select-hidden",required:y,className:(0,i.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:D,onChange:e=>{e.preventDefault()},name:x,disabled:v,id:N,onFocus:()=>{let e=P.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),S.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(d.Ri,Object.assign({as:"div",ref:t,defaultValue:D,value:D,onChange:e=>{null==h||h(e),_(e)},disabled:v,id:N},C),e=>{var t;let{value:r}=e;return o.createElement(o.Fragment,null,o.createElement(d.Y4,{ref:P,className:(0,i.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",b?"pl-10":"pl-3",(0,u.um)((0,u.Uh)(r),v,k))},b&&o.createElement("span",{className:(0,i.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(b,{className:(0,i.q)(f("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=L.get(r))&&void 0!==t?t:p),o.createElement("span",{className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-3")},o.createElement(a.Z,{className:(0,i.q)(f("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),g&&D?o.createElement("button",{type:"button",className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),_(""),null==h||h("")}},o.createElement(l.Z,{className:(0,i.q)(f("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(c.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(d.O_,{anchor:"bottom start",className:(0,i.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},w)))})),k&&M?o.createElement("p",{className:(0,i.q)("errorMessage","text-sm text-rose-500 mt-1")},M):null)});h.displayName="Select"},85238:function(e,t,r){let n;r.d(t,{u:function(){return S}});var a=r(2265),o=r(59456),l=r(93980),i=r(25289),s=r(73389),u=r(43507),d=r(180),c=r(67561),m=r(98218),f=r(28294),h=r(95504),p=r(72468),v=r(38929);function b(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:M)!==a.Fragment||1===a.Children.count(e.children)}let g=(0,a.createContext)(null);g.displayName="TransitionContext";var y=((n=y||{}).Visible="visible",n.Hidden="hidden",n);let w=(0,a.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function k(e,t){let r=(0,u.E)(e),n=(0,a.useRef)([]),s=(0,i.t)(),d=(0,o.G)(),c=(0,l.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[v.l4.Unmount](){n.current.splice(a,1)},[v.l4.Hidden](){n.current[a].state="hidden"}}),d.microTask(()=>{var e;!x(n)&&s.current&&(null==(e=r.current)||e.call(r))}))}),m=(0,l.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>c(e,v.l4.Unmount)}),f=(0,a.useRef)([]),h=(0,a.useRef)(Promise.resolve()),b=(0,a.useRef)({enter:[],leave:[]}),g=(0,l.z)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(b.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?h.current=h.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),y=(0,l.z)((e,t,r)=>{Promise.all(b.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:m,unregister:c,onStart:g,onStop:y,wait:h,chains:b}),[m,c,n,g,y,b,h])}w.displayName="NestingContext";let M=a.Fragment,E=v.VN.RenderStrategy,N=(0,v.yV)(function(e,t){let{show:r,appear:n=!1,unmount:o=!0,...i}=e,u=(0,a.useRef)(null),m=b(e),h=(0,c.T)(...m?[u,t]:null===t?[]:[t]);(0,d.H)();let p=(0,f.oJ)();if(void 0===r&&null!==p&&(r=(p&f.ZM.Open)===f.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[y,M]=(0,a.useState)(r?"visible":"hidden"),N=k(()=>{r||M("hidden")}),[P,S]=(0,a.useState)(!0),D=(0,a.useRef)([r]);(0,s.e)(()=>{!1!==P&&D.current[D.current.length-1]!==r&&(D.current.push(r),S(!1))},[D,r]);let _=(0,a.useMemo)(()=>({show:r,appear:n,initial:P}),[r,n,P]);(0,s.e)(()=>{r?M("visible"):x(N)||null===u.current||M("hidden")},[r,N]);let L={unmount:o},j=(0,l.z)(()=>{var t;P&&S(!1),null==(t=e.beforeEnter)||t.call(e)}),O=(0,l.z)(()=>{var t;P&&S(!1),null==(t=e.beforeLeave)||t.call(e)}),T=(0,v.L6)();return a.createElement(w.Provider,{value:N},a.createElement(g.Provider,{value:_},T({ourProps:{...L,as:a.Fragment,children:a.createElement(C,{ref:h,...L,...i,beforeEnter:j,beforeLeave:O})},theirProps:{},defaultTag:a.Fragment,features:E,visible:"visible"===y,name:"Transition"})))}),C=(0,v.yV)(function(e,t){var r,n;let{transition:o=!0,beforeEnter:i,afterEnter:u,beforeLeave:y,afterLeave:N,enter:C,enterFrom:P,enterTo:S,entered:D,leave:_,leaveFrom:L,leaveTo:j,...O}=e,[T,F]=(0,a.useState)(null),I=(0,a.useRef)(null),Y=b(e),W=(0,c.T)(...Y?[I,t,F]:null===t?[]:[t]),q=null==(r=O.unmount)||r?v.l4.Unmount:v.l4.Hidden,{show:z,appear:R,initial:B}=function(){let e=(0,a.useContext)(g);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[H,A]=(0,a.useState)(z?"visible":"hidden"),V=function(){let e=(0,a.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:Z,unregister:Q}=V;(0,s.e)(()=>Z(I),[Z,I]),(0,s.e)(()=>{if(q===v.l4.Hidden&&I.current){if(z&&"visible"!==H){A("visible");return}return(0,p.E)(H,{hidden:()=>Q(I),visible:()=>Z(I)})}},[H,I,Z,Q,z,q]);let G=(0,d.H)();(0,s.e)(()=>{if(Y&&G&&"visible"===H&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,H,G,Y]);let X=B&&!R,K=R&&z&&B,U=(0,a.useRef)(!1),J=k(()=>{U.current||(A("hidden"),Q(I))},V),$=(0,l.z)(e=>{U.current=!0,J.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==y||y())})}),ee=(0,l.z)(e=>{let t=e?"enter":"leave";U.current=!1,J.onStop(I,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==N||N())}),"leave"!==t||x(J)||(A("hidden"),Q(I))});(0,a.useEffect)(()=>{Y&&o||($(z),ee(z))},[z,Y,o]);let et=!(!o||!Y||!G||X),[,er]=(0,m.Y)(et,T,z,{start:$,end:ee}),en=(0,v.oA)({ref:W,className:(null==(n=(0,h.A)(O.className,K&&C,K&&P,er.enter&&C,er.enter&&er.closed&&P,er.enter&&!er.closed&&S,er.leave&&_,er.leave&&!er.closed&&L,er.leave&&er.closed&&j,!er.transition&&z&&D))?void 0:n.trim())||void 0,...(0,m.X)(er)}),ea=0;"visible"===H&&(ea|=f.ZM.Open),"hidden"===H&&(ea|=f.ZM.Closed),er.enter&&(ea|=f.ZM.Opening),er.leave&&(ea|=f.ZM.Closing);let eo=(0,v.L6)();return a.createElement(w.Provider,{value:J},a.createElement(f.up,{value:ea},eo({ourProps:en,theirProps:O,defaultTag:M,features:E,visible:"visible"===H,name:"Transition.Child"})))}),P=(0,v.yV)(function(e,t){let r=null!==(0,a.useContext)(g),n=null!==(0,f.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(N,{ref:t,...e}):a.createElement(C,{ref:t,...e}))}),S=Object.assign(N,{Child:P,Root:N})}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5733],{58747:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(5853),a=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},88237:function(e,t,r){let n,a,o;r.d(t,{Z:function(){return rV}});var l,i,s,u=r(5853),d=r(2265);let c=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),d.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var m=r(4537),f=r(99649);function h(e){let t=(0,f.Q)(e);return t.setHours(0,0,0,0),t}function p(){return h(Date.now())}function v(e){let t=(0,f.Q)(e);return t.setDate(1),t.setHours(0,0,0,0),t}var b=r(13241),g=r(96398);function y(e){let t;return e.forEach(function(e){let r=(0,f.Q)(e);(void 0===t||t{let r=(0,f.Q)(e);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}var x=r(59121);function k(e,t){return(0,x.E)(e,-t)}var M=r(31091),E=r(63497);function N(e,t){var r;let{years:n=0,months:a=0,weeks:o=0,days:l=0,hours:i=0,minutes:s=0,seconds:u=0}=t,d=k((r=a+12*n,(0,M.z)(e,-r)),l+7*o);return(0,E.L)(e,d.getTime()-1e3*(u+60*(s+60*i)))}function C(e){let t=(0,f.Q)(e),r=(0,E.L)(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}let P={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function S(e){return function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}let D={date:S({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:S({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:S({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function L(e){return(t,r)=>{let n;if("formatting"===((null==r?void 0:r.context)?String(r.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,a=(null==r?void 0:r.width)?String(r.width):t;n=e.formattingValues[a]||e.formattingValues[t]}else{let t=e.defaultWidth,a=(null==r?void 0:r.width)?String(r.width):e.defaultWidth;n=e.values[a]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function j(e){return function(t){let r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,o=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;let i=l[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?function(e,t){for(let r=0;re.test(i)):function(e,t){for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}(s,e=>e.test(i));return r=e.valueCallback?e.valueCallback(u):u,{value:r=n.valueCallback?n.valueCallback(r):r,rest:t.slice(i.length)}}}let O={code:"en-US",formatDistance:(e,t,r)=>{let n;let a=P[e];return(n="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null==r?void 0:r.addSuffix)?r.comparison&&r.comparison>0?"in "+n:n+" ago":n},formatLong:D,formatRelative:(e,t,r,n)=>_[e],localize:{ordinalNumber:(e,t)=>{let r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:L({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:L({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:L({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:L({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:L({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(l={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(l.matchPattern);if(!r)return null;let n=r[0],a=e.match(l.parsePattern);if(!a)return null;let o=l.valueCallback?l.valueCallback(a[0]):a[0];return{value:o=t.valueCallback?t.valueCallback(o):o,rest:e.slice(n.length)}}),era:j({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:j({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:j({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:j({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:j({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},T={};function F(e){let t=(0,f.Q)(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function I(e,t){let r=h(e),n=h(t);return Math.round((+r-F(r)-(+n-F(n)))/864e5)}function Y(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.weekStartsOn)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.weekStartsOn)&&void 0!==i?i:T.weekStartsOn)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==u?u:0,c=(0,f.Q)(e),m=c.getDay();return c.setDate(c.getDate()-((m=a.getTime()?r+1:t.getTime()>=l.getTime()?r:r-1}function z(e){let t=(0,f.Q)(e);return Math.round((+W(t)-+function(e){let t=q(e),r=(0,E.L)(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),W(r)}(t))/6048e5)+1}function R(e,t){var r,n,a,o,l,i,s,u;let d=(0,f.Q)(e),c=d.getFullYear(),m=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.firstWeekContainsDate)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.firstWeekContainsDate)&&void 0!==i?i:T.firstWeekContainsDate)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==u?u:1,h=(0,E.L)(e,0);h.setFullYear(c+1,0,m),h.setHours(0,0,0,0);let p=Y(h,t),v=(0,E.L)(e,0);v.setFullYear(c,0,m),v.setHours(0,0,0,0);let b=Y(v,t);return d.getTime()>=p.getTime()?c+1:d.getTime()>=b.getTime()?c:c-1}function B(e,t){let r=(0,f.Q)(e);return Math.round((+Y(r,t)-+function(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.firstWeekContainsDate)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.firstWeekContainsDate)&&void 0!==i?i:T.firstWeekContainsDate)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.firstWeekContainsDate)&&void 0!==u?u:1,c=R(e,t),m=(0,E.L)(e,0);return m.setFullYear(c,0,d),m.setHours(0,0,0,0),Y(m,t)}(r,t))/6048e5)+1}function H(e,t){let r=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+r}let A={y(e,t){let r=e.getFullYear(),n=r>0?r:1-r;return H("yy"===t?n%100:n,t.length)},M(e,t){let r=e.getMonth();return"M"===t?String(r+1):H(r+1,2)},d:(e,t)=>H(e.getDate(),t.length),a(e,t){let r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:(e,t)=>H(e.getHours()%12||12,t.length),H:(e,t)=>H(e.getHours(),t.length),m:(e,t)=>H(e.getMinutes(),t.length),s:(e,t)=>H(e.getSeconds(),t.length),S(e,t){let r=t.length;return H(Math.trunc(e.getMilliseconds()*Math.pow(10,r-3)),t.length)}},V={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Z={G:function(e,t,r){let n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){let t=e.getFullYear();return r.ordinalNumber(t>0?t:1-t,{unit:"year"})}return A.y(e,t)},Y:function(e,t,r,n){let a=R(e,n),o=a>0?a:1-a;return"YY"===t?H(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):H(o,t.length)},R:function(e,t){return H(q(e),t.length)},u:function(e,t){return H(e.getFullYear(),t.length)},Q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return H(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return H(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){let n=e.getMonth();switch(t){case"M":case"MM":return A.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){let n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return H(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){let a=B(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):H(a,t.length)},I:function(e,t,r){let n=z(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):H(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getDate(),{unit:"date"}):A.d(e,t)},D:function(e,t,r){let n=function(e){let t=(0,f.Q)(e);return I(t,C(t))+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):H(n,t.length)},E:function(e,t,r){let n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return H(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return H(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){let n=e.getDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return H(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){let n;let a=e.getHours();switch(n=12===a?V.noon:0===a?V.midnight:a/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){let n;let a=e.getHours();switch(n=a>=17?V.evening:a>=12?V.afternoon:a>=4?V.morning:V.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),r.ordinalNumber(t,{unit:"hour"})}return A.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getHours(),{unit:"hour"}):A.H(e,t)},K:function(e,t,r){let n=e.getHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):H(n,t.length)},k:function(e,t,r){let n=e.getHours();return(0===n&&(n=24),"ko"===t)?r.ordinalNumber(n,{unit:"hour"}):H(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):A.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getSeconds(),{unit:"second"}):A.s(e,t)},S:function(e,t){return A.S(e,t)},X:function(e,t,r){let n=e.getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return G(n);case"XXXX":case"XX":return X(n);default:return X(n,":")}},x:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"x":return G(n);case"xxxx":case"xx":return X(n);default:return X(n,":")}},O:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Q(n,":");default:return"GMT"+X(n,":")}},z:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Q(n,":");default:return"GMT"+X(n,":")}},t:function(e,t,r){return H(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,r){return H(e.getTime(),t.length)}};function Q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return 0===o?r+String(a):r+String(a)+t+H(o,2)}function G(e,t){return e%60==0?(e>0?"-":"+")+H(Math.abs(e)/60,2):X(e,t)}function X(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=Math.abs(e);return(e>0?"-":"+")+H(Math.trunc(r/60),2)+t+H(r%60,2)}let K=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},U=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},J={p:U,P:(e,t)=>{let r;let n=e.match(/(P+)(p+)?/)||[],a=n[1],o=n[2];if(!o)return K(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",K(a,t)).replace("{{time}}",U(o,t))}},$=/^D+$/,ee=/^Y+$/,et=["D","DD","YY","YYYY"];function er(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}let en=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ea=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eo=/^'([^]*?)'?$/,el=/''/g,ei=/[a-zA-Z]/;function es(e,t,r){var n,a,o,l,i,s,u,d,c,m,h,p,v,b,g,y,w,x;let k=null!==(m=null!==(c=null==r?void 0:r.locale)&&void 0!==c?c:T.locale)&&void 0!==m?m:O,M=null!==(b=null!==(v=null!==(p=null!==(h=null==r?void 0:r.firstWeekContainsDate)&&void 0!==h?h:null==r?void 0:null===(a=r.locale)||void 0===a?void 0:null===(n=a.options)||void 0===n?void 0:n.firstWeekContainsDate)&&void 0!==p?p:T.firstWeekContainsDate)&&void 0!==v?v:null===(l=T.locale)||void 0===l?void 0:null===(o=l.options)||void 0===o?void 0:o.firstWeekContainsDate)&&void 0!==b?b:1,E=null!==(x=null!==(w=null!==(y=null!==(g=null==r?void 0:r.weekStartsOn)&&void 0!==g?g:null==r?void 0:null===(s=r.locale)||void 0===s?void 0:null===(i=s.options)||void 0===i?void 0:i.weekStartsOn)&&void 0!==y?y:T.weekStartsOn)&&void 0!==w?w:null===(d=T.locale)||void 0===d?void 0:null===(u=d.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==x?x:0,N=(0,f.Q)(e);if(!((er(N)||"number"==typeof N)&&!isNaN(Number((0,f.Q)(N)))))throw RangeError("Invalid time value");let C=t.match(ea).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,J[t])(e,k.formatLong):e}).join("").match(en).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t)return{isToken:!1,value:function(e){let t=e.match(eo);return t?t[1].replace(el,"'"):e}(e)};if(Z[t])return{isToken:!0,value:e};if(t.match(ei))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});k.localize.preprocessor&&(C=k.localize.preprocessor(N,C));let P={firstWeekContainsDate:M,weekStartsOn:E,locale:k};return C.map(n=>{if(!n.isToken)return n.value;let a=n.value;return(!(null==r?void 0:r.useAdditionalWeekYearTokens)&&ee.test(a)||!(null==r?void 0:r.useAdditionalDayOfYearTokens)&&$.test(a))&&function(e,t,r){let n=function(e,t,r){let n="Y"===e[0]?"years":"days of the month";return"Use `".concat(e.toLowerCase(),"` instead of `").concat(e,"` (in `").concat(t,"`) for formatting ").concat(n," to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")}(e,t,r);if(console.warn(n),et.includes(e))throw RangeError(n)}(a,t,String(e)),(0,Z[a[0]])(N,a,k.localize,P)}).join("")}var eu=r(1153);let ed=(0,eu.fn)("DateRangePicker"),ec=(e,t,r,n)=>{var a;if(r&&(e=null===(a=n.get(r))||void 0===a?void 0:a.from),e)return h(e&&!t?e:y([e,t]))},em=(e,t,r,n)=>{var a,o;if(r&&(e=h(null!==(o=null===(a=n.get(r))||void 0===a?void 0:a.to)&&void 0!==o?o:p())),e)return h(e&&!t?e:w([e,t]))},ef=[{value:"tdy",text:"Today",from:p()},{value:"w",text:"Last 7 days",from:N(p(),{days:7})},{value:"t",text:"Last 30 days",from:N(p(),{days:30})},{value:"m",text:"Month to Date",from:v(p())},{value:"y",text:"Year to Date",from:C(p())}],eh=(e,t,r,n)=>{let a=(null==r?void 0:r.code)||"en-US";if(!e&&!t)return"";if(e&&!t)return n?es(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e&&t){if(+(0,f.Q)(e)==+(0,f.Q)(t))return n?es(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear())return n?"".concat(es(e,n)," - ").concat(es(t,n)):"".concat(e.toLocaleDateString(a,{month:"short",day:"numeric"})," - \n ").concat(t.getDate(),", ").concat(t.getFullYear());{if(n)return"".concat(es(e,n)," - ").concat(es(t,n));let r={year:"numeric",month:"short",day:"numeric"};return"".concat(e.toLocaleDateString(a,r)," - \n ").concat(t.toLocaleDateString(a,r))}}return""};var ep=r(57437);function ev(e){let t=(0,f.Q)(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function eb(e,t){let r=(0,f.Q)(e),n=r.getFullYear(),a=r.getDate(),o=(0,E.L)(e,0);o.setFullYear(n,t,15),o.setHours(0,0,0,0);let l=function(e){let t=(0,f.Q)(e),r=t.getFullYear(),n=t.getMonth(),a=(0,E.L)(e,0);return a.setFullYear(r,n+1,0),a.setHours(0,0,0,0),a.getDate()}(o);return r.setMonth(t,Math.min(a,l)),r}function eg(e,t){let r=(0,f.Q)(e);return isNaN(+r)?(0,E.L)(e,NaN):(r.setFullYear(t),r)}function ey(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return 12*(r.getFullYear()-n.getFullYear())+(r.getMonth()-n.getMonth())}function ew(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function ex(e,t){return+(0,f.Q)(e)<+(0,f.Q)(t)}function ek(e,t){return+h(e)==+h(t)}function eM(e,t){let r=(0,f.Q)(e),n=(0,f.Q)(t);return r.getTime()>n.getTime()}function eE(e,t){return(0,x.E)(e,7*t)}function eN(e,t){return(0,M.z)(e,12*t)}function eC(e,t){var r,n,a,o,l,i,s,u;let d=null!==(u=null!==(s=null!==(i=null!==(l=null==t?void 0:t.weekStartsOn)&&void 0!==l?l:null==t?void 0:null===(n=t.locale)||void 0===n?void 0:null===(r=n.options)||void 0===r?void 0:r.weekStartsOn)&&void 0!==i?i:T.weekStartsOn)&&void 0!==s?s:null===(o=T.locale)||void 0===o?void 0:null===(a=o.options)||void 0===a?void 0:a.weekStartsOn)&&void 0!==u?u:0,c=(0,f.Q)(e),m=c.getDay();return c.setDate(c.getDate()+((mey(i,l)&&(l=(0,M.z)(i,-1*((void 0===u?1:u)-1))),s&&0>ey(l,s)&&(l=s),c=v(l),m=t.month,h=(f=(0,d.useState)(c))[0],p=[void 0===m?h:m,f[1]])[0],g=p[1],[b,function(e){if(!t.disableNavigation){var r,n=v(e);g(n),null===(r=t.onMonthChange)||void 0===r||r.call(t,n)}}]),x=w[0],k=w[1],E=function(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=v(e),o=ey(v((0,M.z)(a,n)),a),l=[],i=0;i=ey(o,r)))return(0,M.z)(o,-(n?void 0===a?1:a:1))}}(x,y),P=function(e){return E.some(function(t){return ew(e,t)})};return(0,ep.jsx)(eA.Provider,{value:{currentMonth:x,displayMonths:E,goToMonth:k,goToDate:function(e,t){P(e)||(t&&ex(e,t)?k((0,M.z)(e,1+-1*y.numberOfMonths)):k(e))},previousMonth:C,nextMonth:N,isDateDisplayed:P},children:e.children})}function eZ(){var e=(0,d.useContext)(eA);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}function eQ(e){var t,r=eW(),n=r.classNames,a=r.styles,o=r.components,l=eZ().goToMonth,i=function(t){l((0,M.z)(t,e.displayIndex?-e.displayIndex:0))},s=null!==(t=null==o?void 0:o.CaptionLabel)&&void 0!==t?t:eq,u=(0,ep.jsx)(s,{id:e.id,displayMonth:e.displayMonth});return(0,ep.jsxs)("div",{className:n.caption_dropdowns,style:a.caption_dropdowns,children:[(0,ep.jsx)("div",{className:n.vhidden,children:u}),(0,ep.jsx)(eB,{onChange:i,displayMonth:e.displayMonth}),(0,ep.jsx)(eH,{onChange:i,displayMonth:e.displayMonth})]})}function eG(e){return(0,ep.jsx)("svg",eS({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,ep.jsx)("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function eX(e){return(0,ep.jsx)("svg",eS({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,ep.jsx)("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var eK=(0,d.forwardRef)(function(e,t){var r=eW(),n=r.classNames,a=r.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var l=o.join(" "),i=eS(eS({},a.button_reset),a.button);return e.style&&Object.assign(i,e.style),(0,ep.jsx)("button",eS({},e,{ref:t,type:"button",className:l,style:i}))});function eU(e){var t,r,n=eW(),a=n.dir,o=n.locale,l=n.classNames,i=n.styles,s=n.labels,u=s.labelPrevious,d=s.labelNext,c=n.components;if(!e.nextMonth&&!e.previousMonth)return(0,ep.jsx)(ep.Fragment,{});var m=u(e.previousMonth,{locale:o}),f=[l.nav_button,l.nav_button_previous].join(" "),h=d(e.nextMonth,{locale:o}),p=[l.nav_button,l.nav_button_next].join(" "),v=null!==(t=null==c?void 0:c.IconRight)&&void 0!==t?t:eX,b=null!==(r=null==c?void 0:c.IconLeft)&&void 0!==r?r:eG;return(0,ep.jsxs)("div",{className:l.nav,style:i.nav,children:[!e.hidePrevious&&(0,ep.jsx)(eK,{name:"previous-month","aria-label":m,className:f,style:i.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:"rtl"===a?(0,ep.jsx)(v,{className:l.nav_icon,style:i.nav_icon}):(0,ep.jsx)(b,{className:l.nav_icon,style:i.nav_icon})}),!e.hideNext&&(0,ep.jsx)(eK,{name:"next-month","aria-label":h,className:p,style:i.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:"rtl"===a?(0,ep.jsx)(b,{className:l.nav_icon,style:i.nav_icon}):(0,ep.jsx)(v,{className:l.nav_icon,style:i.nav_icon})})]})}function eJ(e){var t=eW().numberOfMonths,r=eZ(),n=r.previousMonth,a=r.nextMonth,o=r.goToMonth,l=r.displayMonths,i=l.findIndex(function(t){return ew(e.displayMonth,t)}),s=0===i,u=i===l.length-1;return(0,ep.jsx)(eU,{displayMonth:e.displayMonth,hideNext:t>1&&(s||!u),hidePrevious:t>1&&(u||!s),nextMonth:a,previousMonth:n,onPreviousClick:function(){n&&o(n)},onNextClick:function(){a&&o(a)}})}function e$(e){var t,r,n=eW(),a=n.classNames,o=n.disableNavigation,l=n.styles,i=n.captionLayout,s=n.components,u=null!==(t=null==s?void 0:s.CaptionLabel)&&void 0!==t?t:eq;return r=o?(0,ep.jsx)(u,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===i?(0,ep.jsx)(eQ,{displayMonth:e.displayMonth,id:e.id}):"dropdown-buttons"===i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eQ,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),(0,ep.jsx)(eJ,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,ep.jsx)(eJ,{displayMonth:e.displayMonth,id:e.id})]}),(0,ep.jsx)("div",{className:a.caption,style:l.caption,children:r})}function e0(e){var t=eW(),r=t.footer,n=t.styles,a=t.classNames.tfoot;return r?(0,ep.jsx)("tfoot",{className:a,style:n.tfoot,children:(0,ep.jsx)("tr",{children:(0,ep.jsx)("td",{colSpan:8,children:r})})}):(0,ep.jsx)(ep.Fragment,{})}function e1(){var e=eW(),t=e.classNames,r=e.styles,n=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,u=function(e,t,r){for(var n=r?W(new Date):Y(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=(0,x.E)(n,o);a.push(l)}return a}(a,o,l);return(0,ep.jsxs)("tr",{style:r.head_row,className:t.head_row,children:[n&&(0,ep.jsx)("td",{style:r.head_cell,className:t.head_cell}),u.map(function(e,n){return(0,ep.jsx)("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":s(e,{locale:a}),children:i(e,{locale:a})},n)})]})}function e2(){var e,t=eW(),r=t.classNames,n=t.styles,a=t.components,o=null!==(e=null==a?void 0:a.HeadRow)&&void 0!==e?e:e1;return(0,ep.jsx)("thead",{style:n.head,className:r.head,children:(0,ep.jsx)(o,{})})}function e4(e){var t=eW(),r=t.locale,n=t.formatters.formatDay;return(0,ep.jsx)(ep.Fragment,{children:n(e.date,{locale:r})})}var e5=(0,d.createContext)(void 0);function e3(e){return e_(e.initialProps)?(0,ep.jsx)(e8,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(e5.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}function e8(e){var t=e.initialProps,r=e.children,n=t.selected,a=t.min,o=t.max,l={disabled:[]};return n&&l.disabled.push(function(e){var t=o&&n.length>o-1,r=n.some(function(t){return ek(t,e)});return!!(t&&!r)}),(0,ep.jsx)(e5.Provider,{value:{selected:n,onDayClick:function(e,r,l){if(null===(i=t.onDayClick)||void 0===i||i.call(t,e,r,l),(!r.selected||!a||(null==n?void 0:n.length)!==a)&&(r.selected||!o||(null==n?void 0:n.length)!==o)){var i,s,u=n?eD([],n,!0):[];if(r.selected){var d=u.findIndex(function(t){return ek(e,t)});u.splice(d,1)}else u.push(e);null===(s=t.onSelect)||void 0===s||s.call(t,u,e,r,l)}},modifiers:l},children:r})}function e6(){var e=(0,d.useContext)(e5);if(!e)throw Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var e7=(0,d.createContext)(void 0);function e9(e){return eL(e.initialProps)?(0,ep.jsx)(te,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(e7.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}function te(e){var t=e.initialProps,r=e.children,n=t.selected,a=n||{},o=a.from,l=a.to,i=t.min,s=t.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],l?(u.range_end=[l],ek(o,l)||(u.range_middle=[{after:o,before:l}])):u.range_end=[o]):l&&(u.range_start=[l],u.range_end=[l]),i&&(o&&!l&&u.disabled.push({after:k(o,i-1),before:(0,x.E)(o,i-1)}),o&&l&&u.disabled.push({after:o,before:(0,x.E)(o,i-1)}),!o&&l&&u.disabled.push({after:k(l,i-1),before:(0,x.E)(l,i-1)})),s){if(o&&!l&&(u.disabled.push({before:(0,x.E)(o,-s+1)}),u.disabled.push({after:(0,x.E)(o,s-1)})),o&&l){var d=s-(I(l,o)+1);u.disabled.push({before:k(o,d)}),u.disabled.push({after:(0,x.E)(l,d)})}!o&&l&&(u.disabled.push({before:(0,x.E)(l,-s+1)}),u.disabled.push({after:(0,x.E)(l,s-1)}))}return(0,ep.jsx)(e7.Provider,{value:{selected:n,onDayClick:function(e,r,a){null===(s=t.onDayClick)||void 0===s||s.call(t,e,r,a);var o,l,i,s,u,d=(l=(o=n||{}).from,i=o.to,l&&i?ek(i,e)&&ek(l,e)?void 0:ek(i,e)?{from:i,to:void 0}:ek(l,e)?void 0:eM(l,e)?{from:e,to:i}:{from:l,to:e}:i?eM(e,i)?{from:i,to:e}:{from:e,to:i}:l?ex(e,l)?{from:e,to:l}:{from:l,to:e}:{from:e,to:void 0});null===(u=t.onSelect)||void 0===u||u.call(t,d,e,r,a)},modifiers:u},children:r})}function tt(){var e=(0,d.useContext)(e7);if(!e)throw Error("useSelectRange must be used within a SelectRangeProvider");return e}function tr(e){return Array.isArray(e)?eD([],e,!0):void 0!==e?[e]:[]}(i=s||(s={})).Outside="outside",i.Disabled="disabled",i.Selected="selected",i.Hidden="hidden",i.Today="today",i.RangeStart="range_start",i.RangeEnd="range_end",i.RangeMiddle="range_middle";var tn=s.Selected,ta=s.Disabled,to=s.Hidden,tl=s.Today,ti=s.RangeEnd,ts=s.RangeMiddle,tu=s.RangeStart,td=s.Outside,tc=(0,d.createContext)(void 0);function tm(e){var t,r,n,a=eW(),o=e6(),l=tt(),i=((t={})[tn]=tr(a.selected),t[ta]=tr(a.disabled),t[to]=tr(a.hidden),t[tl]=[a.today],t[ti]=[],t[ts]=[],t[tu]=[],t[td]=[],a.fromDate&&t[ta].push({before:a.fromDate}),a.toDate&&t[ta].push({after:a.toDate}),e_(a)?t[ta]=t[ta].concat(o.modifiers[ta]):eL(a)&&(t[ta]=t[ta].concat(l.modifiers[ta]),t[tu]=l.modifiers[tu],t[ts]=l.modifiers[ts],t[ti]=l.modifiers[ti]),t),s=(r=a.modifiers,n={},Object.entries(r).forEach(function(e){var t=e[0],r=e[1];n[t]=tr(r)}),n),u=eS(eS({},i),s);return(0,ep.jsx)(tc.Provider,{value:u,children:e.children})}function tf(){var e=(0,d.useContext)(tc);if(!e)throw Error("useModifiers must be used within a ModifiersProvider");return e}function th(e,t,r){var n=Object.keys(t).reduce(function(r,n){return t[n].some(function(t){if("boolean"==typeof t)return t;if(er(t))return ek(e,t);if(Array.isArray(t)&&t.every(er))return t.includes(e);if(t&&"object"==typeof t&&"from"in t)return n=t.from,a=t.to,n&&a?(0>I(a,n)&&(n=(r=[a,n])[0],a=r[1]),I(e,n)>=0&&I(a,e)>=0):a?ek(a,e):!!n&&ek(n,e);if(t&&"object"==typeof t&&"dayOfWeek"in t)return t.dayOfWeek.includes(e.getDay());if(t&&"object"==typeof t&&"before"in t&&"after"in t){var r,n,a,o=I(t.before,e),l=I(t.after,e),i=o>0,s=l<0;return eM(t.before,t.after)?s&&i:i||s}return t&&"object"==typeof t&&"after"in t?I(e,t.after)>0:t&&"object"==typeof t&&"before"in t?I(t.before,e)>0:"function"==typeof t&&t(e)})&&r.push(n),r},[]),a={};return n.forEach(function(e){return a[e]=!0}),r&&!ew(e,r)&&(a.outside=!0),a}var tp=(0,d.createContext)(void 0);function tv(e){var t=eZ(),r=tf(),n=(0,d.useState)(),a=n[0],o=n[1],l=(0,d.useState)(),i=l[0],s=l[1],u=function(e,t){for(var r,n,a=v(e[0]),o=ev(e[e.length-1]),l=a;l<=o;){var i=th(l,t);if(!(!i.disabled&&!i.hidden)){l=(0,x.E)(l,1);continue}if(i.selected)return l;i.today&&!n&&(n=l),r||(r=l),l=(0,x.E)(l,1)}return n||r}(t.displayMonths,r),c=(null!=a?a:i&&t.isDateDisplayed(i))?i:u,m=function(e){o(e)},f=eW(),h=function(e,n){if(a){var o=function e(t,r){var n=r.moveBy,a=r.direction,o=r.context,l=r.modifiers,i=r.retry,s=void 0===i?{count:0,lastFocused:t}:i,u=o.weekStartsOn,d=o.fromDate,c=o.toDate,m=o.locale,f=({day:x.E,week:eE,month:M.z,year:eN,startOfWeek:function(e){return o.ISOWeek?W(e):Y(e,{locale:m,weekStartsOn:u})},endOfWeek:function(e){return o.ISOWeek?eP(e):eC(e,{locale:m,weekStartsOn:u})}})[n](t,"after"===a?1:-1);"before"===a&&d?f=y([d,f]):"after"===a&&c&&(f=w([c,f]));var h=!0;if(l){var p=th(f,l);h=!p.disabled&&!p.hidden}return h?f:s.count>365?s.lastFocused:e(f,{moveBy:n,direction:a,context:o,modifiers:l,retry:eS(eS({},s),{count:s.count+1})})}(a,{moveBy:e,direction:n,context:f,modifiers:r});ek(a,o)||(t.goToDate(o,a),m(o))}};return(0,ep.jsx)(tp.Provider,{value:{focusedDay:a,focusTarget:c,blur:function(){s(a),o(void 0)},focus:m,focusDayAfter:function(){return h("day","after")},focusDayBefore:function(){return h("day","before")},focusWeekAfter:function(){return h("week","after")},focusWeekBefore:function(){return h("week","before")},focusMonthBefore:function(){return h("month","before")},focusMonthAfter:function(){return h("month","after")},focusYearBefore:function(){return h("year","before")},focusYearAfter:function(){return h("year","after")},focusStartOfWeek:function(){return h("startOfWeek","before")},focusEndOfWeek:function(){return h("endOfWeek","after")}},children:e.children})}function tb(){var e=(0,d.useContext)(tp);if(!e)throw Error("useFocusContext must be used within a FocusProvider");return e}var tg=(0,d.createContext)(void 0);function ty(e){return ej(e.initialProps)?(0,ep.jsx)(tw,{initialProps:e.initialProps,children:e.children}):(0,ep.jsx)(tg.Provider,{value:{selected:void 0},children:e.children})}function tw(e){var t=e.initialProps,r=e.children,n={selected:t.selected,onDayClick:function(e,r,n){var a,o,l;if(null===(a=t.onDayClick)||void 0===a||a.call(t,e,r,n),r.selected&&!t.required){null===(o=t.onSelect)||void 0===o||o.call(t,void 0,e,r,n);return}null===(l=t.onSelect)||void 0===l||l.call(t,e,e,r,n)}};return(0,ep.jsx)(tg.Provider,{value:n,children:r})}function tx(){var e=(0,d.useContext)(tg);if(!e)throw Error("useSelectSingle must be used within a SelectSingleProvider");return e}function tk(e){var t,r,n,a,o,l,i,u,c,m,f,h,p,v,b,g,y,w,x,k,M,E,N,C,P,S,D,_,L,j,O,T,F,I,Y,W,q,z,R,B,H,A,V=(0,d.useRef)(null),Z=(t=e.date,r=e.displayMonth,l=eW(),i=tb(),u=th(t,tf(),r),c=eW(),m=tx(),f=e6(),h=tt(),v=(p=tb()).focusDayAfter,b=p.focusDayBefore,g=p.focusWeekAfter,y=p.focusWeekBefore,w=p.blur,x=p.focus,k=p.focusMonthBefore,M=p.focusMonthAfter,E=p.focusYearBefore,N=p.focusYearAfter,C=p.focusStartOfWeek,P=p.focusEndOfWeek,S={onClick:function(e){var r,n,a,o;ej(c)?null===(r=m.onDayClick)||void 0===r||r.call(m,t,u,e):e_(c)?null===(n=f.onDayClick)||void 0===n||n.call(f,t,u,e):eL(c)?null===(a=h.onDayClick)||void 0===a||a.call(h,t,u,e):null===(o=c.onDayClick)||void 0===o||o.call(c,t,u,e)},onFocus:function(e){var r;x(t),null===(r=c.onDayFocus)||void 0===r||r.call(c,t,u,e)},onBlur:function(e){var r;w(),null===(r=c.onDayBlur)||void 0===r||r.call(c,t,u,e)},onKeyDown:function(e){var r;switch(e.key){case"ArrowLeft":e.preventDefault(),e.stopPropagation(),"rtl"===c.dir?v():b();break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),"rtl"===c.dir?b():v();break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),g();break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),y();break;case"PageUp":e.preventDefault(),e.stopPropagation(),e.shiftKey?E():k();break;case"PageDown":e.preventDefault(),e.stopPropagation(),e.shiftKey?N():M();break;case"Home":e.preventDefault(),e.stopPropagation(),C();break;case"End":e.preventDefault(),e.stopPropagation(),P()}null===(r=c.onDayKeyDown)||void 0===r||r.call(c,t,u,e)},onKeyUp:function(e){var r;null===(r=c.onDayKeyUp)||void 0===r||r.call(c,t,u,e)},onMouseEnter:function(e){var r;null===(r=c.onDayMouseEnter)||void 0===r||r.call(c,t,u,e)},onMouseLeave:function(e){var r;null===(r=c.onDayMouseLeave)||void 0===r||r.call(c,t,u,e)},onPointerEnter:function(e){var r;null===(r=c.onDayPointerEnter)||void 0===r||r.call(c,t,u,e)},onPointerLeave:function(e){var r;null===(r=c.onDayPointerLeave)||void 0===r||r.call(c,t,u,e)},onTouchCancel:function(e){var r;null===(r=c.onDayTouchCancel)||void 0===r||r.call(c,t,u,e)},onTouchEnd:function(e){var r;null===(r=c.onDayTouchEnd)||void 0===r||r.call(c,t,u,e)},onTouchMove:function(e){var r;null===(r=c.onDayTouchMove)||void 0===r||r.call(c,t,u,e)},onTouchStart:function(e){var r;null===(r=c.onDayTouchStart)||void 0===r||r.call(c,t,u,e)}},D=eW(),_=tx(),L=e6(),j=tt(),O=ej(D)?_.selected:e_(D)?L.selected:eL(D)?j.selected:void 0,T=!!(l.onDayClick||"default"!==l.mode),(0,d.useEffect)(function(){var e;!u.outside&&i.focusedDay&&T&&ek(i.focusedDay,t)&&(null===(e=V.current)||void 0===e||e.focus())},[i.focusedDay,t,V,T,u.outside]),I=(F=[l.classNames.day],Object.keys(u).forEach(function(e){var t=l.modifiersClassNames[e];if(t)F.push(t);else if(Object.values(s).includes(e)){var r=l.classNames["day_".concat(e)];r&&F.push(r)}}),F).join(" "),Y=eS({},l.styles.day),Object.keys(u).forEach(function(e){var t;Y=eS(eS({},Y),null===(t=l.modifiersStyles)||void 0===t?void 0:t[e])}),W=Y,q=!!(u.outside&&!l.showOutsideDays||u.hidden),z=null!==(o=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==o?o:e4,R={style:W,className:I,children:(0,ep.jsx)(z,{date:t,displayMonth:r,activeModifiers:u}),role:"gridcell"},B=i.focusTarget&&ek(i.focusTarget,t)&&!u.outside,H=i.focusedDay&&ek(i.focusedDay,t),A=eS(eS(eS({},R),((n={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,n.tabIndex=H||B?0:-1,n)),S),{isButton:T,isHidden:q,activeModifiers:u,selectedDays:O,buttonProps:A,divProps:R});return Z.isHidden?(0,ep.jsx)("div",{role:"gridcell"}):Z.isButton?(0,ep.jsx)(eK,eS({name:"day",ref:V},Z.buttonProps)):(0,ep.jsx)("div",eS({},Z.divProps))}function tM(e){var t=e.number,r=e.dates,n=eW(),a=n.onWeekNumberClick,o=n.styles,l=n.classNames,i=n.locale,s=n.labels.labelWeekNumber,u=(0,n.formatters.formatWeekNumber)(Number(t),{locale:i});if(!a)return(0,ep.jsx)("span",{className:l.weeknumber,style:o.weeknumber,children:u});var d=s(Number(t),{locale:i});return(0,ep.jsx)(eK,{name:"week-number","aria-label":d,className:l.weeknumber,style:o.weeknumber,onClick:function(e){a(t,r,e)},children:u})}function tE(e){var t,r,n,a=eW(),o=a.styles,l=a.classNames,i=a.showWeekNumber,s=a.components,u=null!==(t=null==s?void 0:s.Day)&&void 0!==t?t:tk,d=null!==(r=null==s?void 0:s.WeekNumber)&&void 0!==r?r:tM;return i&&(n=(0,ep.jsx)("td",{className:l.cell,style:o.cell,children:(0,ep.jsx)(d,{number:e.weekNumber,dates:e.dates})})),(0,ep.jsxs)("tr",{className:l.row,style:o.row,children:[n,e.dates.map(function(t){return(0,ep.jsx)("td",{className:l.cell,style:o.cell,role:"presentation",children:(0,ep.jsx)(u,{displayMonth:e.displayMonth,date:t})},Math.trunc(+(0,f.Q)(t)/1e3))})]})}function tN(e,t,r){for(var n=(null==r?void 0:r.ISOWeek)?eP(t):eC(t,r),a=(null==r?void 0:r.ISOWeek)?W(e):Y(e,r),o=I(n,a),l=[],i=0;i<=o;i++)l.push((0,x.E)(a,i));return l.reduce(function(e,t){var n=(null==r?void 0:r.ISOWeek)?z(t):B(t,r),a=e.find(function(e){return e.weekNumber===n});return a?a.dates.push(t):e.push({weekNumber:n,dates:[t]}),e},[])}function tC(e){var t,r,n,a=eW(),o=a.locale,l=a.classNames,i=a.styles,s=a.hideHead,u=a.fixedWeeks,d=a.components,c=a.weekStartsOn,m=a.firstWeekContainsDate,h=a.ISOWeek,p=function(e,t){var r=tN(v(e),ev(e),t);if(null==t?void 0:t.useFixedWeeks){var n=function(e,t,r){let n=Y(e,r),a=Y(t,r);return Math.round((+n-F(n)-(+a-F(a)))/6048e5)}(function(e){let t=(0,f.Q)(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}(e),v(e),t)+1;if(n<6){var a=r[r.length-1],o=a.dates[a.dates.length-1],l=eE(o,6-n),i=tN(eE(o,1),l,t);r.push.apply(r,i)}}return r}(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:h,locale:o,weekStartsOn:c,firstWeekContainsDate:m}),b=null!==(t=null==d?void 0:d.Head)&&void 0!==t?t:e2,g=null!==(r=null==d?void 0:d.Row)&&void 0!==r?r:tE,y=null!==(n=null==d?void 0:d.Footer)&&void 0!==n?n:e0;return(0,ep.jsxs)("table",{id:e.id,className:l.table,style:i.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!s&&(0,ep.jsx)(b,{}),(0,ep.jsx)("tbody",{className:l.tbody,style:i.tbody,children:p.map(function(t){return(0,ep.jsx)(g,{displayMonth:e.displayMonth,dates:t.dates,weekNumber:t.weekNumber},t.weekNumber)})}),(0,ep.jsx)(y,{displayMonth:e.displayMonth})]})}var tP="undefined"!=typeof window&&window.document&&window.document.createElement?d.useLayoutEffect:d.useEffect,tS=!1,tD=0;function t_(){return"react-day-picker-".concat(++tD)}function tL(e){var t,r,n,a,o,l,i,s,u=eW(),c=u.dir,m=u.classNames,f=u.styles,h=u.components,p=eZ().displayMonths,v=(n=null!=(t=u.id?"".concat(u.id,"-").concat(e.displayIndex):void 0)?t:tS?t_():null,o=(a=(0,d.useState)(n))[0],l=a[1],tP(function(){null===o&&l(t_())},[]),(0,d.useEffect)(function(){!1===tS&&(tS=!0)},[]),null!==(r=null!=t?t:o)&&void 0!==r?r:void 0),b=u.id?"".concat(u.id,"-grid-").concat(e.displayIndex):void 0,g=[m.month],y=f.month,w=0===e.displayIndex,x=e.displayIndex===p.length-1,k=!w&&!x;"rtl"===c&&(x=(i=[w,x])[0],w=i[1]),w&&(g.push(m.caption_start),y=eS(eS({},y),f.caption_start)),x&&(g.push(m.caption_end),y=eS(eS({},y),f.caption_end)),k&&(g.push(m.caption_between),y=eS(eS({},y),f.caption_between));var M=null!==(s=null==h?void 0:h.Caption)&&void 0!==s?s:e$;return(0,ep.jsxs)("div",{className:g.join(" "),style:y,children:[(0,ep.jsx)(M,{id:v,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,ep.jsx)(tC,{id:b,"aria-labelledby":v,displayMonth:e.displayMonth})]},e.displayIndex)}function tj(e){var t=eW(),r=t.classNames,n=t.styles;return(0,ep.jsx)("div",{className:r.months,style:n.months,children:e.children})}function tO(e){var t,r,n=e.initialProps,a=eW(),o=tb(),l=eZ(),i=(0,d.useState)(!1),s=i[0],u=i[1];(0,d.useEffect)(function(){a.initialFocus&&o.focusTarget&&(s||(o.focus(o.focusTarget),u(!0)))},[a.initialFocus,s,o.focus,o.focusTarget,o]);var c=[a.classNames.root,a.className];a.numberOfMonths>1&&c.push(a.classNames.multiple_months),a.showWeekNumber&&c.push(a.classNames.with_weeknumber);var m=eS(eS({},a.styles.root),a.style),f=Object.keys(n).filter(function(e){return e.startsWith("data-")}).reduce(function(e,t){var r;return eS(eS({},e),((r={})[t]=n[t],r))},{}),h=null!==(r=null===(t=n.components)||void 0===t?void 0:t.Months)&&void 0!==r?r:tj;return(0,ep.jsx)("div",eS({className:c.join(" "),style:m,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},f,{children:(0,ep.jsx)(h,{children:l.displayMonths.map(function(e,t){return(0,ep.jsx)(tL,{displayIndex:t,displayMonth:e},t)})})}))}function tT(e){var t=e.children,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}(e,["children"]);return(0,ep.jsx)(eY,{initialProps:r,children:(0,ep.jsx)(eV,{children:(0,ep.jsx)(ty,{initialProps:r,children:(0,ep.jsx)(e3,{initialProps:r,children:(0,ep.jsx)(e9,{initialProps:r,children:(0,ep.jsx)(tm,{children:(0,ep.jsx)(tv,{children:t})})})})})})})}function tF(e){return(0,ep.jsx)(tT,eS({},e,{children:(0,ep.jsx)(tO,{initialProps:e})}))}let tI=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},tY=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},tW=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},tq=e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))};var tz=r(84264);r(41649);var tR=r(47187),tB=r(7084),tH=r(26898);let tA={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-1",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-1.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-lg"},xl:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-xl"}},tV={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},tZ={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},tQ={[tB.wu.Increase]:{bgColor:(0,eu.bM)(tB.fr.Emerald,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconRing).ringColor},[tB.wu.ModerateIncrease]:{bgColor:(0,eu.bM)(tB.fr.Emerald,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Emerald,tH.K.iconRing).ringColor},[tB.wu.Decrease]:{bgColor:(0,eu.bM)(tB.fr.Red,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Red,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Red,tH.K.iconRing).ringColor},[tB.wu.ModerateDecrease]:{bgColor:(0,eu.bM)(tB.fr.Red,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Red,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Red,tH.K.iconRing).ringColor},[tB.wu.Unchanged]:{bgColor:(0,eu.bM)(tB.fr.Orange,tH.K.background).bgColor,textColor:(0,eu.bM)(tB.fr.Orange,tH.K.iconText).textColor,ringColor:(0,eu.bM)(tB.fr.Orange,tH.K.iconRing).ringColor}},tG={[tB.wu.Increase]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z"}))},[tB.wu.ModerateIncrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"}))},[tB.wu.Decrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z"}))},[tB.wu.ModerateDecrease]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M14.5895 16.0032L5.98291 7.39664L7.39712 5.98242L16.0037 14.589V7.00324H18.0037V18.0032H7.00373V16.0032H14.5895Z"}))},[tB.wu.Unchanged]:e=>{var t=(0,u._T)(e,[]);return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),d.createElement("path",{d:"M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"}))}},tX=(0,eu.fn)("BadgeDelta");d.forwardRef((e,t)=>{let{deltaType:r=tB.wu.Increase,isIncreasePositive:n=!0,size:a=tB.u8.SM,tooltip:o,children:l,className:i}=e,s=(0,u._T)(e,["deltaType","isIncreasePositive","size","tooltip","children","className"]),c=tG[r],m=(0,eu.Fo)(r,n),f=l?tV:tA,{tooltipProps:h,getReferenceProps:p}=(0,tR.l)();return d.createElement("span",Object.assign({ref:(0,eu.lq)([t,h.refs.setReference]),className:(0,b.q)(tX("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",tQ[m].bgColor,tQ[m].textColor,tQ[m].ringColor,f[a].paddingX,f[a].paddingY,f[a].fontSize,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60",i)},p,s),d.createElement(tR.Z,Object.assign({text:o},h)),d.createElement(c,{className:(0,b.q)(tX("icon"),"shrink-0",l?(0,b.q)("-ml-1 mr-1.5"):tZ[a].height,tZ[a].width)}),l?d.createElement("span",{className:(0,b.q)(tX("text"),"whitespace-nowrap")},l):null)}).displayName="BadgeDelta";var tK=r(47323);let tU=e=>{var{onClick:t,icon:r}=e,n=(0,u._T)(e,["onClick","icon"]);return d.createElement("button",Object.assign({type:"button",className:(0,b.q)("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},n),d.createElement(tK.Z,{onClick:t,icon:r,variant:"simple",color:"slate",size:"sm"}))};function tJ(e){var{mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,enableYearNavigation:i,classNames:s,weekStartsOn:c=0}=e,m=(0,u._T)(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return d.createElement(tF,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,weekStartsOn:c,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},s),components:{IconLeft:e=>{var t=(0,u._T)(e,[]);return d.createElement(tI,Object.assign({className:"h-4 w-4"},t))},IconRight:e=>{var t=(0,u._T)(e,[]);return d.createElement(tY,Object.assign({className:"h-4 w-4"},t))},Caption:e=>{var t=(0,u._T)(e,[]);let{goToMonth:r,nextMonth:n,previousMonth:a,currentMonth:l}=eZ();return d.createElement("div",{className:"flex justify-between items-center"},d.createElement("div",{className:"flex items-center space-x-1"},i&&d.createElement(tU,{onClick:()=>l&&r(eN(l,-1)),icon:tW}),d.createElement(tU,{onClick:()=>a&&r(a),icon:tI})),d.createElement(tz.Z,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},es(t.displayMonth,"LLLL yyy",{locale:o})),d.createElement("div",{className:"flex items-center space-x-1"},d.createElement(tU,{onClick:()=>n&&r(n),icon:tY}),i&&d.createElement(tU,{onClick:()=>l&&r(eN(l,1)),icon:tq})))}}},m))}tJ.displayName="DateRangePicker",r(27281);var t$=r(57365),t0=r(44140),t1=r(71049),t2=r(11323),t4=r(66797),t5=r(86852),t3=r(93980),t8=r(43507),t6=r(73389),t7=r(12315),t9=r(23137),re=r(84574),rt=r(65573),rr=r(65639),rn=r(5664);let ra=(0,d.createContext)(null);function ro(e){let{children:t,node:r}=e,[n,a]=(0,d.useState)(null),o=rl(null!=r?r:n);return d.createElement(ra.Provider,{value:o},t,null===o&&d.createElement(rr._,{features:rr.x.Hidden,ref:e=>{var t,r;if(e){for(let n of null!=(r=null==(t=(0,rn.r)(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(n!==document.body&&n!==document.head&&n instanceof HTMLElement&&null!=n&&n.contains(e)){a(n);break}}}}))}function rl(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!=(e=(0,d.useContext)(ra))?e:t}var ri=r(48852),rs=r(67561),ru=r(26776),rd=((n=rd||{})[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n);function rc(){let e=(0,d.useRef)(0);return(0,ru.s)(!0,"keydown",t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)},!0),e}var rm=r(98218),rf=r(33443),rh=r(47506),rp=r(28294),rv=r(31370),rb=r(93698),rg=r(72468),ry=r(38929),rw=r(52724),rx=r(4796),rk=((a=rk||{})[a.Open=0]="Open",a[a.Closed=1]="Closed",a),rM=((o=rM||{})[o.TogglePopover=0]="TogglePopover",o[o.ClosePopover=1]="ClosePopover",o[o.SetButton=2]="SetButton",o[o.SetButtonId=3]="SetButtonId",o[o.SetPanel=4]="SetPanel",o[o.SetPanelId=5]="SetPanelId",o);let rE={0:e=>({...e,popoverState:(0,rg.E)(e.popoverState,{0:1,1:0}),__demoMode:!1}),1:e=>1===e.popoverState?e:{...e,popoverState:1,__demoMode:!1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},rN=(0,d.createContext)(null);function rC(e){let t=(0,d.useContext)(rN);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,rC),t}return t}rN.displayName="PopoverContext";let rP=(0,d.createContext)(null);function rS(e){let t=(0,d.useContext)(rP);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,rS),t}return t}rP.displayName="PopoverAPIContext";let rD=(0,d.createContext)(null);function r_(){return(0,d.useContext)(rD)}rD.displayName="PopoverGroupContext";let rL=(0,d.createContext)(null);function rj(e,t){return(0,rg.E)(t.type,rE,e,t)}rL.displayName="PopoverPanelContext";let rO=ry.VN.RenderStrategy|ry.VN.Static;function rT(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-backdrop-".concat(r),transition:a=!1,...o}=e,[{popoverState:l},i]=rC("Popover.Backdrop"),[s,u]=(0,d.useState)(null),c=(0,rs.T)(t,u),m=(0,rp.oJ)(),[f,h]=(0,rm.Y)(a,s,null!==m?(m&rp.ZM.Open)===rp.ZM.Open:0===l),p=(0,t3.z)(e=>{if((0,rv.P)(e.currentTarget))return e.preventDefault();i({type:1})}),v=(0,d.useMemo)(()=>({open:0===l}),[l]),b={ref:c,id:n,"aria-hidden":!0,onClick:p,...(0,rm.X)(h)};return(0,ry.L6)()({ourProps:b,theirProps:o,slot:v,defaultTag:"div",features:rO,visible:f,name:"Popover.Backdrop"})}let rF=ry.VN.RenderStrategy|ry.VN.Static,rI=(0,ry.yV)(function(e,t){var r,n,a,o;let l;let{__demoMode:i=!1,...s}=e,u=(0,d.useRef)(null),c=(0,rs.T)(t,(0,rs.h)(e=>{u.current=e})),m=(0,d.useRef)([]),f=(0,d.useReducer)(rj,{__demoMode:i,popoverState:i?0:1,buttons:m,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:(0,d.createRef)(),afterPanelSentinel:(0,d.createRef)(),afterButtonSentinel:(0,d.createRef)()}),[{popoverState:h,button:p,buttonId:v,panel:b,panelId:g,beforePanelSentinel:y,afterPanelSentinel:w,afterButtonSentinel:x},k]=f,M=(0,re.i)(null!=(r=u.current)?r:p),E=(0,d.useMemo)(()=>{if(!p||!b)return!1;for(let e of document.querySelectorAll("body > *"))if(Number(null==e?void 0:e.contains(p))^Number(null==e?void 0:e.contains(b)))return!0;let e=(0,rb.GO)(),t=e.indexOf(p),r=(t+e.length-1)%e.length,n=(t+1)%e.length,a=e[r],o=e[n];return!b.contains(a)&&!b.contains(o)},[p,b]),N=(0,t8.E)(v),C=(0,t8.E)(g),P=(0,d.useMemo)(()=>({buttonId:N,panelId:C,close:()=>k({type:1})}),[N,C,k]),S=r_(),D=null==S?void 0:S.registerPopover,_=(0,t3.z)(()=>{var e;return null!=(e=null==S?void 0:S.isFocusWithinPopoverGroup())?e:(null==M?void 0:M.activeElement)&&((null==p?void 0:p.contains(M.activeElement))||(null==b?void 0:b.contains(M.activeElement)))});(0,d.useEffect)(()=>null==D?void 0:D(P),[D,P]);let[L,j]=(0,rx.kF)(),O=rl(p),T=function(){let{defaultContainers:e=[],portals:t,mainTreeNode:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,re.i)(r),a=(0,t3.z)(()=>{var a,o;let l=[];for(let t of e)null!==t&&(t instanceof HTMLElement?l.push(t):"current"in t&&t.current instanceof HTMLElement&&l.push(t.current));if(null!=t&&t.current)for(let e of t.current)l.push(e);for(let e of null!=(a=null==n?void 0:n.querySelectorAll("html > *, body > *"))?a:[])e!==document.body&&e!==document.head&&e instanceof HTMLElement&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(o=null==r?void 0:r.getRootNode())?void 0:o.host))||l.some(t=>e.contains(t))||l.push(e));return l});return{resolveContainers:a,contains:(0,t3.z)(e=>a().some(t=>t.contains(e)))}}({mainTreeNode:O,portals:L,defaultContainers:[p,b]});n=null==M?void 0:M.defaultView,a="focus",o=e=>{var t,r,n,a,o,l;e.target!==window&&e.target instanceof HTMLElement&&0===h&&(_()||p&&b&&(T.contains(e.target)||null!=(r=null==(t=y.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(a=null==(n=w.current)?void 0:n.contains)&&a.call(n,e.target)||null!=(l=null==(o=x.current)?void 0:o.contains)&&l.call(o,e.target)||k({type:1})))},l=(0,t8.E)(o),(0,d.useEffect)(()=>{function e(e){l.current(e)}return(n=null!=n?n:window).addEventListener(a,e,!0),()=>n.removeEventListener(a,e,!0)},[n,a,!0]),(0,t9.O)(0===h,T.resolveContainers,(e,t)=>{k({type:1}),(0,rb.sP)(t,rb.tJ.Loose)||(e.preventDefault(),null==p||p.focus())});let F=(0,t3.z)(e=>{k({type:1});let t=e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:p:p;null==t||t.focus()}),I=(0,d.useMemo)(()=>({close:F,isPortalled:E}),[F,E]),Y=(0,d.useMemo)(()=>({open:0===h,close:F}),[h,F]),W=(0,ry.L6)();return d.createElement(ro,{node:O},d.createElement(rh.HO,null,d.createElement(rL.Provider,{value:null},d.createElement(rN.Provider,{value:f},d.createElement(rP.Provider,{value:I},d.createElement(rf.Z,{value:F},d.createElement(rp.up,{value:(0,rg.E)(h,{0:rp.ZM.Open,1:rp.ZM.Closed})},d.createElement(j,null,W({ourProps:{ref:c},theirProps:s,slot:Y,defaultTag:"div",name:"Popover"})))))))))}),rY=(0,ry.yV)(function(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-button-".concat(r),disabled:a=!1,autoFocus:o=!1,...l}=e,[i,s]=rC("Popover.Button"),{isPortalled:u}=rS("Popover.Button"),c=(0,d.useRef)(null),m="headlessui-focus-sentinel-".concat((0,d.useId)()),f=r_(),h=null==f?void 0:f.closeOthers,p=null!==(0,d.useContext)(rL);(0,d.useEffect)(()=>{if(!p)return s({type:3,buttonId:n}),()=>{s({type:3,buttonId:null})}},[p,n,s]);let[v]=(0,d.useState)(()=>Symbol()),b=(0,rs.T)(c,t,(0,rh.AZ)(),(0,t3.z)(e=>{if(!p){if(e)i.buttons.current.push(v);else{let e=i.buttons.current.indexOf(v);-1!==e&&i.buttons.current.splice(e,1)}i.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),e&&s({type:2,button:e})}})),g=(0,rs.T)(c,t),y=(0,re.i)(c),w=(0,t3.z)(e=>{var t,r,n;if(p){if(1===i.popoverState)return;switch(e.key){case rw.R.Space:case rw.R.Enter:e.preventDefault(),null==(r=(t=e.target).click)||r.call(t),s({type:1}),null==(n=i.button)||n.focus()}}else switch(e.key){case rw.R.Space:case rw.R.Enter:e.preventDefault(),e.stopPropagation(),1===i.popoverState&&(null==h||h(i.buttonId)),s({type:0});break;case rw.R.Escape:if(0!==i.popoverState)return null==h?void 0:h(i.buttonId);if(!c.current||null!=y&&y.activeElement&&!c.current.contains(y.activeElement))return;e.preventDefault(),e.stopPropagation(),s({type:1})}}),x=(0,t3.z)(e=>{p||e.key===rw.R.Space&&e.preventDefault()}),k=(0,t3.z)(e=>{var t,r;(0,rv.P)(e.currentTarget)||a||(p?(s({type:1}),null==(t=i.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),1===i.popoverState&&(null==h||h(i.buttonId)),s({type:0}),null==(r=i.button)||r.focus()))}),M=(0,t3.z)(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:E,focusProps:N}=(0,t1.F)({autoFocus:o}),{isHovered:C,hoverProps:P}=(0,t2.X)({isDisabled:a}),{pressed:S,pressProps:D}=(0,t4.x)({disabled:a}),_=0===i.popoverState,L=(0,d.useMemo)(()=>({open:_,active:S||_,disabled:a,hover:C,focus:E,autofocus:o}),[_,C,E,S,a,o]),j=(0,rt.f)(e,i.button),O=p?(0,ry.dG)({ref:g,type:j,onKeyDown:w,onClick:k,disabled:a||void 0,autoFocus:o},N,P,D):(0,ry.dG)({ref:b,id:i.buttonId,type:j,"aria-expanded":0===i.popoverState,"aria-controls":i.panel?i.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:w,onKeyUp:x,onClick:k,onMouseDown:M},N,P,D),T=rc(),F=(0,t3.z)(()=>{let e=i.panel;e&&(0,rg.E)(T.current,{[rd.Forwards]:()=>(0,rb.jA)(e,rb.TO.First),[rd.Backwards]:()=>(0,rb.jA)(e,rb.TO.Last)})===rb.fE.Error&&(0,rb.jA)((0,rb.GO)().filter(e=>"true"!==e.dataset.headlessuiFocusGuard),(0,rg.E)(T.current,{[rd.Forwards]:rb.TO.Next,[rd.Backwards]:rb.TO.Previous}),{relativeTo:i.button})}),I=(0,ry.L6)();return d.createElement(d.Fragment,null,I({ourProps:O,theirProps:l,slot:L,defaultTag:"button",name:"Popover.Button"}),_&&!p&&u&&d.createElement(rr._,{id:m,ref:i.afterButtonSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F}))}),rW=(0,ry.yV)(rT),rq=(0,ry.yV)(rT),rz=(0,ry.yV)(function(e,t){let r=(0,d.useId)(),{id:n="headlessui-popover-panel-".concat(r),focus:a=!1,anchor:o,portal:l=!1,modal:i=!1,transition:s=!1,...u}=e,[c,m]=rC("Popover.Panel"),{close:f,isPortalled:h}=rS("Popover.Panel"),p="headlessui-focus-sentinel-before-".concat(r),v="headlessui-focus-sentinel-after-".concat(r),b=(0,d.useRef)(null),g=(0,rh.Vy)(o),[y,w]=(0,rh.ES)(g),x=(0,rh.U8)();g&&(l=!0);let[k,M]=(0,d.useState)(null),E=(0,rs.T)(b,t,g?y:null,(0,t3.z)(e=>m({type:4,panel:e})),M),N=(0,re.i)(b);(0,t6.e)(()=>(m({type:5,panelId:n}),()=>{m({type:5,panelId:null})}),[n,m]);let C=(0,rp.oJ)(),[P,S]=(0,rm.Y)(s,k,null!==C?(C&rp.ZM.Open)===rp.ZM.Open:0===c.popoverState);(0,t7.m)(P,c.button,()=>{m({type:1})});let D=!c.__demoMode&&i&&P;(0,ri.P)(D,N);let _=(0,t3.z)(e=>{var t;if(e.key===rw.R.Escape){if(0!==c.popoverState||!b.current||null!=N&&N.activeElement&&!b.current.contains(N.activeElement))return;e.preventDefault(),e.stopPropagation(),m({type:1}),null==(t=c.button)||t.focus()}});(0,d.useEffect)(()=>{var t;e.static||1===c.popoverState&&(null==(t=e.unmount)||t)&&m({type:4,panel:null})},[c.popoverState,e.unmount,e.static,m]),(0,d.useEffect)(()=>{if(c.__demoMode||!a||0!==c.popoverState||!b.current)return;let e=null==N?void 0:N.activeElement;b.current.contains(e)||(0,rb.jA)(b.current,rb.TO.First)},[c.__demoMode,a,b.current,c.popoverState]);let L=(0,d.useMemo)(()=>({open:0===c.popoverState,close:f}),[c.popoverState,f]),j=(0,ry.dG)(g?x():{},{ref:E,id:n,onKeyDown:_,onBlur:a&&0===c.popoverState?e=>{var t,r,n,a,o;let l=e.relatedTarget;l&&b.current&&(null!=(t=b.current)&&t.contains(l)||(m({type:1}),(null!=(n=null==(r=c.beforePanelSentinel.current)?void 0:r.contains)&&n.call(r,l)||null!=(o=null==(a=c.afterPanelSentinel.current)?void 0:a.contains)&&o.call(a,l))&&l.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...u.style,...w,"--button-width":(0,t5.h)(c.button,!0).width},...(0,rm.X)(S)}),O=rc(),T=(0,t3.z)(()=>{let e=b.current;e&&(0,rg.E)(O.current,{[rd.Forwards]:()=>{var t;(0,rb.jA)(e,rb.TO.First)===rb.fE.Error&&(null==(t=c.afterPanelSentinel.current)||t.focus())},[rd.Backwards]:()=>{var e;null==(e=c.button)||e.focus({preventScroll:!0})}})}),F=(0,t3.z)(()=>{let e=b.current;e&&(0,rg.E)(O.current,{[rd.Forwards]:()=>{if(!c.button)return;let e=(0,rb.GO)(),t=e.indexOf(c.button),r=e.slice(0,t+1),n=[...e.slice(t+1),...r];for(let e of n.slice())if("true"===e.dataset.headlessuiFocusGuard||null!=k&&k.contains(e)){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}(0,rb.jA)(n,rb.TO.First,{sorted:!1})},[rd.Backwards]:()=>{var t;(0,rb.jA)(e,rb.TO.Previous)===rb.fE.Error&&(null==(t=c.button)||t.focus())}})}),I=(0,ry.L6)();return d.createElement(rp.uu,null,d.createElement(rL.Provider,{value:n},d.createElement(rP.Provider,{value:{close:f,isPortalled:h}},d.createElement(rx.h_,{enabled:!!l&&(e.static||P)},P&&h&&d.createElement(rr._,{id:p,ref:c.beforePanelSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}),I({ourProps:j,theirProps:u,slot:L,defaultTag:"div",features:rF,visible:P,name:"Popover.Panel"}),P&&h&&d.createElement(rr._,{id:v,ref:c.afterPanelSentinel,features:rr.x.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F})))))}),rR=Object.assign(rI,{Button:rY,Backdrop:rq,Overlay:rW,Panel:rz,Group:(0,ry.yV)(function(e,t){let r=(0,d.useRef)(null),n=(0,rs.T)(r,t),[a,o]=(0,d.useState)([]),l=(0,t3.z)(e=>{o(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),i=(0,t3.z)(e=>(o(t=>[...t,e]),()=>l(e))),s=(0,t3.z)(()=>{var e;let t=(0,rn.r)(r);if(!t)return!1;let n=t.activeElement;return!!(null!=(e=r.current)&&e.contains(n))||a.some(e=>{var r,a;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(a=t.getElementById(e.panelId.current))?void 0:a.contains(n))})}),u=(0,t3.z)(e=>{for(let t of a)t.buttonId.current!==e&&t.close()}),c=(0,d.useMemo)(()=>({registerPopover:i,unregisterPopover:l,isFocusWithinPopoverGroup:s,closeOthers:u}),[i,l,s,u]),m=(0,d.useMemo)(()=>({}),[]),f=(0,ry.L6)();return d.createElement(ro,null,d.createElement(rD.Provider,{value:c},f({ourProps:{ref:n},theirProps:e,slot:m,defaultTag:"div",name:"Popover.Group"})))})});var rB=r(85238),rH=r(51975);let rA=p(),rV=d.forwardRef((e,t)=>{var r,n;let{value:a,defaultValue:o,onValueChange:l,enableSelect:i=!0,minDate:s,maxDate:f,placeholder:h="Select range",selectPlaceholder:p="Select range",disabled:y=!1,locale:w=O,enableClear:x=!0,displayFormat:k,children:M,className:E,enableYearNavigation:N=!1,weekStartsOn:C=0,disabledDates:P}=e,S=(0,u._T)(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[D,_]=(0,t0.Z)(o,a),[L,j]=(0,d.useState)(!1),[T,F]=(0,d.useState)(!1),I=(0,d.useMemo)(()=>{let e=[];return s&&e.push({before:s}),f&&e.push({after:f}),[...e,...null!=P?P:[]]},[s,f,P]),Y=(0,d.useMemo)(()=>{let e=new Map;return M?d.Children.forEach(M,t=>{var r;e.set(t.props.value,{text:null!==(r=(0,g.qg)(t))&&void 0!==r?r:t.props.value,from:t.props.from,to:t.props.to})}):ef.forEach(t=>{e.set(t.value,{text:t.text,from:t.from,to:rA})}),e},[M]),W=(0,d.useMemo)(()=>{if(M)return(0,g.sl)(M);let e=new Map;return ef.forEach(t=>e.set(t.value,t.text)),e},[M]),q=(null==D?void 0:D.selectValue)||"",z=ec(null==D?void 0:D.from,s,q,Y),R=em(null==D?void 0:D.to,f,q,Y),B=z||R?eh(z,R,w,k):h,H=v(null!==(n=null!==(r=null!=R?R:z)&&void 0!==r?r:f)&&void 0!==n?n:rA),A=x&&!y;return d.createElement("div",Object.assign({ref:t,className:(0,b.q)("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",E)},S),d.createElement(rR,{as:"div",className:(0,b.q)("w-full",i?"rounded-l-tremor-default":"rounded-tremor-default",L&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},d.createElement("div",{className:"relative w-full"},d.createElement(rY,{onFocus:()=>j(!0),onBlur:()=>j(!1),disabled:y,className:(0,b.q)("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",i?"rounded-l-tremor-default":"rounded-tremor-default",A?"pr-8":"pr-4",(0,g.um)((0,g.Uh)(z||R),y))},d.createElement(c,{className:(0,b.q)(ed("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),d.createElement("p",{className:"truncate"},B)),A&&z?d.createElement("button",{type:"button",className:(0,b.q)("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:e=>{e.preventDefault(),null==l||l({}),_({})}},d.createElement(m.Z,{className:(0,b.q)(ed("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),d.createElement(rB.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},d.createElement(rz,{anchor:"bottom start",focus:!0,className:(0,b.q)("min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},d.createElement(tJ,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:H,selected:{from:z,to:R},onSelect:e=>{null==l||l({from:null==e?void 0:e.from,to:null==e?void 0:e.to}),_({from:null==e?void 0:e.from,to:null==e?void 0:e.to})},locale:w,disabled:I,enableYearNavigation:N,classNames:{day_range_middle:(0,b.q)("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:C},e))))),i&&d.createElement(rH.Ri,{as:"div",className:(0,b.q)("w-48 -ml-px rounded-r-tremor-default",T&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:q,onChange:e=>{let{from:t,to:r}=Y.get(e),n=null!=r?r:rA;null==l||l({from:t,to:n,selectValue:e}),_({from:t,to:n,selectValue:e})},disabled:y},e=>{var t;let{value:r}=e;return d.createElement(d.Fragment,null,d.createElement(rH.Y4,{onFocus:()=>F(!0),onBlur:()=>F(!1),className:(0,b.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",(0,g.um)((0,g.Uh)(r),y))},r&&null!==(t=W.get(r))&&void 0!==t?t:p),d.createElement(rB.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},d.createElement(rH.O_,{anchor:"bottom end",className:(0,b.q)("[--anchor-gap:4px] divide-y overflow-y-auto outline-none border min-w-44","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},null!=M?M:ef.map(e=>d.createElement(t$.Z,{key:e.value,value:e.value},e.text)))))}))});rV.displayName="DateRangePicker"},92414:function(e,t,r){r.d(t,{Z:function(){return b}});var n=r(5853),a=r(2265);r(42698),r(64016),r(8710);var o=r(33232),l=r(44140),i=r(58747);let s=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),a.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))};var u=r(4537);let d=e=>{var t=(0,n._T)(e,[]);return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))};var c=r(13241),m=r(1153),f=r(96398),h=r(51975),p=r(85238);let v=(0,m.fn)("MultiSelect"),b=a.forwardRef((e,t)=>{let{defaultValue:r=[],value:m,onValueChange:b,placeholder:g="Select...",placeholderSearch:y="Search",disabled:w=!1,icon:x,children:k,className:M,required:E,name:N,error:C=!1,errorMessage:P,id:S}=e,D=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),_=(0,a.useRef)(null),[L,j]=(0,l.Z)(r,m),{reactElementChildren:O,optionsAvailable:T}=(0,a.useMemo)(()=>{let e=a.Children.toArray(k).filter(a.isValidElement);return{reactElementChildren:e,optionsAvailable:(0,f.n0)("",e)}},[k]),[F,I]=(0,a.useState)(""),Y=(null!=L?L:[]).length>0,W=(0,a.useMemo)(()=>F?(0,f.n0)(F,O):T,[F,O,T]),q=()=>{I("")};return a.createElement("div",{className:(0,c.q)("w-full min-w-[10rem] text-tremor-default",M)},a.createElement("div",{className:"relative"},a.createElement("select",{title:"multi-select-hidden",required:E,className:(0,c.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:L,onChange:e=>{e.preventDefault()},name:N,disabled:w,multiple:!0,id:S,onFocus:()=>{let e=_.current;e&&e.focus()}},a.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),W.map(e=>{let t=e.props.value,r=e.props.children;return a.createElement("option",{className:"hidden",key:t,value:t},r)})),a.createElement(h.Ri,Object.assign({as:"div",ref:t,defaultValue:L,value:L,onChange:e=>{null==b||b(e),j(e)},disabled:w,id:S,multiple:!0},D),e=>{let{value:t}=e;return a.createElement(a.Fragment,null,a.createElement(h.Y4,{className:(0,c.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",x?"pl-11 -ml-0.5":"pl-3",(0,f.um)(t.length>0,w,C)),ref:_},x&&a.createElement("span",{className:(0,c.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},a.createElement(x,{className:(0,c.q)(v("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("div",{className:"h-6 flex items-center"},t.length>0?a.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},T.filter(e=>t.includes(e.props.value)).map((e,r)=>{var n;return a.createElement("div",{key:r,className:(0,c.q)("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},a.createElement("div",{className:"text-xs truncate "},null!==(n=e.props.children)&&void 0!==n?n:e.props.value),a.createElement("div",{onClick:r=>{r.preventDefault();let n=t.filter(t=>t!==e.props.value);null==b||b(n),j(n)}},a.createElement(d,{className:(0,c.q)(v("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):a.createElement("span",null,g)),a.createElement("span",{className:(0,c.q)("absolute inset-y-0 right-0 flex items-center mr-2.5")},a.createElement(i.Z,{className:(0,c.q)(v("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),Y&&!w?a.createElement("button",{type:"button",className:(0,c.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),j([]),null==b||b([])}},a.createElement(u.Z,{className:(0,c.q)(v("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,a.createElement(p.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},a.createElement(h.O_,{anchor:"bottom start",className:(0,c.q)("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},a.createElement("div",{className:(0,c.q)("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},a.createElement("span",null,a.createElement(s,{className:(0,c.q)("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:y,className:(0,c.q)("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:e=>{"Space"===e.code&&""!==e.target.value&&e.stopPropagation()},onChange:e=>I(e.target.value),value:F})),a.createElement(o.Z.Provider,Object.assign({},{onBlur:{handleResetSearch:q}},{value:{selectedValue:t}}),W))))})),C&&P?a.createElement("p",{className:(0,c.q)("errorMessage","text-sm text-rose-500 mt-1")},P):null)});b.displayName="MultiSelect"},46030:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853);r(42698),r(64016),r(8710);var a=r(33232),o=r(2265),l=r(13241),i=r(1153),s=r(51975);let u=(0,i.fn)("MultiSelectItem"),d=o.forwardRef((e,t)=>{let{value:r,className:d,children:c}=e,m=(0,n._T)(e,["value","className","children"]),{selectedValue:f}=(0,o.useContext)(a.Z),h=(0,i.NZ)(r,f);return o.createElement(s.wt,Object.assign({className:(0,l.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",d),ref:t,key:r,value:r},m),o.createElement("input",{type:"checkbox",className:(0,l.q)(u("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:h,readOnly:!0}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:r))});d.displayName="MultiSelectItem"},27281:function(e,t,r){r.d(t,{Z:function(){return h}});var n=r(5853),a=r(58747),o=r(2265),l=r(4537),i=r(13241),s=r(1153),u=r(96398),d=r(51975),c=r(85238),m=r(44140);let f=(0,s.fn)("Select"),h=o.forwardRef((e,t)=>{let{defaultValue:r="",value:s,onValueChange:h,placeholder:p="Select...",disabled:v=!1,icon:b,enableClear:g=!1,required:y,children:w,name:x,error:k=!1,errorMessage:M,className:E,id:N}=e,C=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),P=(0,o.useRef)(null),S=o.Children.toArray(w),[D,_]=(0,m.Z)(r,s),L=(0,o.useMemo)(()=>{let e=o.Children.toArray(w).filter(o.isValidElement);return(0,u.sl)(e)},[w]);return o.createElement("div",{className:(0,i.q)("w-full min-w-[10rem] text-tremor-default",E)},o.createElement("div",{className:"relative"},o.createElement("select",{title:"select-hidden",required:y,className:(0,i.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:D,onChange:e=>{e.preventDefault()},name:x,disabled:v,id:N,onFocus:()=>{let e=P.current;e&&e.focus()}},o.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},p),S.map(e=>{let t=e.props.value,r=e.props.children;return o.createElement("option",{className:"hidden",key:t,value:t},r)})),o.createElement(d.Ri,Object.assign({as:"div",ref:t,defaultValue:D,value:D,onChange:e=>{null==h||h(e),_(e)},disabled:v,id:N},C),e=>{var t;let{value:r}=e;return o.createElement(o.Fragment,null,o.createElement(d.Y4,{ref:P,className:(0,i.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",b?"pl-10":"pl-3",(0,u.um)((0,u.Uh)(r),v,k))},b&&o.createElement("span",{className:(0,i.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},o.createElement(b,{className:(0,i.q)(f("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),o.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=L.get(r))&&void 0!==t?t:p),o.createElement("span",{className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-3")},o.createElement(a.Z,{className:(0,i.q)(f("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),g&&D?o.createElement("button",{type:"button",className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),_(""),null==h||h("")}},o.createElement(l.Z,{className:(0,i.q)(f("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,o.createElement(c.u,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},o.createElement(d.O_,{anchor:"bottom start",className:(0,i.q)("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},w)))})),k&&M?o.createElement("p",{className:(0,i.q)("errorMessage","text-sm text-rose-500 mt-1")},M):null)});h.displayName="Select"},85238:function(e,t,r){let n;r.d(t,{u:function(){return S}});var a=r(2265),o=r(59456),l=r(93980),i=r(25289),s=r(73389),u=r(43507),d=r(180),c=r(67561),m=r(98218),f=r(28294),h=r(95504),p=r(72468),v=r(38929);function b(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:M)!==a.Fragment||1===a.Children.count(e.children)}let g=(0,a.createContext)(null);g.displayName="TransitionContext";var y=((n=y||{}).Visible="visible",n.Hidden="hidden",n);let w=(0,a.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function k(e,t){let r=(0,u.E)(e),n=(0,a.useRef)([]),s=(0,i.t)(),d=(0,o.G)(),c=(0,l.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.l4.Hidden,a=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==a&&((0,p.E)(t,{[v.l4.Unmount](){n.current.splice(a,1)},[v.l4.Hidden](){n.current[a].state="hidden"}}),d.microTask(()=>{var e;!x(n)&&s.current&&(null==(e=r.current)||e.call(r))}))}),m=(0,l.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>c(e,v.l4.Unmount)}),f=(0,a.useRef)([]),h=(0,a.useRef)(Promise.resolve()),b=(0,a.useRef)({enter:[],leave:[]}),g=(0,l.z)((e,r,n)=>{f.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{f.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(b.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?h.current=h.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),y=(0,l.z)((e,t,r)=>{Promise.all(b.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=f.current.shift())||e()}).then(()=>r(t))});return(0,a.useMemo)(()=>({children:n,register:m,unregister:c,onStart:g,onStop:y,wait:h,chains:b}),[m,c,n,g,y,b,h])}w.displayName="NestingContext";let M=a.Fragment,E=v.VN.RenderStrategy,N=(0,v.yV)(function(e,t){let{show:r,appear:n=!1,unmount:o=!0,...i}=e,u=(0,a.useRef)(null),m=b(e),h=(0,c.T)(...m?[u,t]:null===t?[]:[t]);(0,d.H)();let p=(0,f.oJ)();if(void 0===r&&null!==p&&(r=(p&f.ZM.Open)===f.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[y,M]=(0,a.useState)(r?"visible":"hidden"),N=k(()=>{r||M("hidden")}),[P,S]=(0,a.useState)(!0),D=(0,a.useRef)([r]);(0,s.e)(()=>{!1!==P&&D.current[D.current.length-1]!==r&&(D.current.push(r),S(!1))},[D,r]);let _=(0,a.useMemo)(()=>({show:r,appear:n,initial:P}),[r,n,P]);(0,s.e)(()=>{r?M("visible"):x(N)||null===u.current||M("hidden")},[r,N]);let L={unmount:o},j=(0,l.z)(()=>{var t;P&&S(!1),null==(t=e.beforeEnter)||t.call(e)}),O=(0,l.z)(()=>{var t;P&&S(!1),null==(t=e.beforeLeave)||t.call(e)}),T=(0,v.L6)();return a.createElement(w.Provider,{value:N},a.createElement(g.Provider,{value:_},T({ourProps:{...L,as:a.Fragment,children:a.createElement(C,{ref:h,...L,...i,beforeEnter:j,beforeLeave:O})},theirProps:{},defaultTag:a.Fragment,features:E,visible:"visible"===y,name:"Transition"})))}),C=(0,v.yV)(function(e,t){var r,n;let{transition:o=!0,beforeEnter:i,afterEnter:u,beforeLeave:y,afterLeave:N,enter:C,enterFrom:P,enterTo:S,entered:D,leave:_,leaveFrom:L,leaveTo:j,...O}=e,[T,F]=(0,a.useState)(null),I=(0,a.useRef)(null),Y=b(e),W=(0,c.T)(...Y?[I,t,F]:null===t?[]:[t]),q=null==(r=O.unmount)||r?v.l4.Unmount:v.l4.Hidden,{show:z,appear:R,initial:B}=function(){let e=(0,a.useContext)(g);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[H,A]=(0,a.useState)(z?"visible":"hidden"),V=function(){let e=(0,a.useContext)(w);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:Z,unregister:Q}=V;(0,s.e)(()=>Z(I),[Z,I]),(0,s.e)(()=>{if(q===v.l4.Hidden&&I.current){if(z&&"visible"!==H){A("visible");return}return(0,p.E)(H,{hidden:()=>Q(I),visible:()=>Z(I)})}},[H,I,Z,Q,z,q]);let G=(0,d.H)();(0,s.e)(()=>{if(Y&&G&&"visible"===H&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,H,G,Y]);let X=B&&!R,K=R&&z&&B,U=(0,a.useRef)(!1),J=k(()=>{U.current||(A("hidden"),Q(I))},V),$=(0,l.z)(e=>{U.current=!0,J.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==y||y())})}),ee=(0,l.z)(e=>{let t=e?"enter":"leave";U.current=!1,J.onStop(I,t,e=>{"enter"===e?null==u||u():"leave"===e&&(null==N||N())}),"leave"!==t||x(J)||(A("hidden"),Q(I))});(0,a.useEffect)(()=>{Y&&o||($(z),ee(z))},[z,Y,o]);let et=!(!o||!Y||!G||X),[,er]=(0,m.Y)(et,T,z,{start:$,end:ee}),en=(0,v.oA)({ref:W,className:(null==(n=(0,h.A)(O.className,K&&C,K&&P,er.enter&&C,er.enter&&er.closed&&P,er.enter&&!er.closed&&S,er.leave&&_,er.leave&&!er.closed&&L,er.leave&&er.closed&&j,!er.transition&&z&&D))?void 0:n.trim())||void 0,...(0,m.X)(er)}),ea=0;"visible"===H&&(ea|=f.ZM.Open),"hidden"===H&&(ea|=f.ZM.Closed),er.enter&&(ea|=f.ZM.Opening),er.leave&&(ea|=f.ZM.Closing);let eo=(0,v.L6)();return a.createElement(w.Provider,{value:J},a.createElement(f.up,{value:ea},eo({ourProps:en,theirProps:O,defaultTag:M,features:E,visible:"visible"===H,name:"Transition.Child"})))}),P=(0,v.yV)(function(e,t){let r=null!==(0,a.useContext)(g),n=null!==(0,f.oJ)();return a.createElement(a.Fragment,null,!r&&n?a.createElement(N,{ref:t,...e}):a.createElement(C,{ref:t,...e}))}),S=Object.assign(N,{Child:P,Root:N})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5767-ebd4372d304c7936.js b/litellm/proxy/_experimental/out/_next/static/chunks/5767-b9e6413b33909bd8.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5767-ebd4372d304c7936.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5767-b9e6413b33909bd8.js index 1b113dc417..2b988dfb33 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5767-ebd4372d304c7936.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5767-b9e6413b33909bd8.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5767,1623],{69993:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(1119),a=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},i=r(55015),s=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},47323:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(5853),a=r(2265),o=r(47187),i=r(7084),s=r(13241),u=r(1153),l=r(26898);let c={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},h={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,u.bM)(t,l.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,u.bM)(t,l.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,u.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:l="simple",tooltip:p,size:g=i.u8.SM,color:b,className:y}=e,v=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),w=f(l,b),{tooltipProps:k,getReferenceProps:C}=(0,o.l)();return a.createElement("span",Object.assign({ref:(0,u.lq)([t,k.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",w.bgColor,w.textColor,w.borderColor,w.ringColor,h[l].rounded,h[l].border,h[l].shadow,h[l].ring,c[g].paddingX,c[g].paddingY,y)},C,v),a.createElement(o.Z,Object.assign({text:p},k)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",d[g].height,d[g].width)}))});p.displayName="Icon"},59341:function(e,t,r){r.d(t,{Z:function(){return N}});var n=r(5853),a=r(71049),o=r(11323),i=r(2265),s=r(66797),u=r(40099),l=r(74275),c=r(59456),d=r(93980),h=r(65573),f=r(67561),m=r(87550),p=r(628),g=r(80281),b=r(31370),y=r(20131),v=r(38929),w=r(52307),k=r(52724),C=r(7935);let x=(0,i.createContext)(null);x.displayName="GroupContext";let M=i.Fragment,q=Object.assign((0,v.yV)(function(e,t){var r;let n=(0,i.useId)(),M=(0,g.Q)(),q=(0,m.B)(),{id:E=M||"headlessui-switch-".concat(n),disabled:O=q||!1,checked:P,defaultChecked:j,onChange:L,name:S,value:N,form:D,autoFocus:R=!1,...Q}=e,Z=(0,i.useContext)(x),[K,T]=(0,i.useState)(null),A=(0,i.useRef)(null),F=(0,f.T)(A,t,null===Z?null:Z.setSwitch,T),z=(0,l.L)(j),[V,H]=(0,u.q)(P,L,null!=z&&z),B=(0,c.G)(),[I,_]=(0,i.useState)(!1),W=(0,d.z)(()=>{_(!0),null==H||H(!V),B.nextFrame(()=>{_(!1)})}),G=(0,d.z)(e=>{if((0,b.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),W()}),X=(0,d.z)(e=>{e.key===k.R.Space?(e.preventDefault(),W()):e.key===k.R.Enter&&(0,y.g)(e.currentTarget)}),Y=(0,d.z)(e=>e.preventDefault()),U=(0,C.wp)(),J=(0,w.zH)(),{isFocusVisible:$,focusProps:ee}=(0,a.F)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,o.X)({isDisabled:O}),{pressed:en,pressProps:ea}=(0,s.x)({disabled:O}),eo=(0,i.useMemo)(()=>({checked:V,disabled:O,hover:et,focus:$,active:en,autofocus:R,changing:I}),[V,et,$,en,O,I,R]),ei=(0,v.dG)({id:E,ref:F,role:"switch",type:(0,h.f)(e,K),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":V,"aria-labelledby":U,"aria-describedby":J,disabled:O||void 0,autoFocus:R,onClick:G,onKeyUp:X,onKeyPress:Y},ee,er,ea),es=(0,i.useCallback)(()=>{if(void 0!==z)return null==H?void 0:H(z)},[H,z]),eu=(0,v.L6)();return i.createElement(i.Fragment,null,null!=S&&i.createElement(p.Mt,{disabled:O,data:{[S]:N||"on"},overrides:{type:"checkbox",checked:V},form:D,onReset:es}),eu({ourProps:ei,theirProps:Q,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[a,o]=(0,C.bE)(),[s,u]=(0,w.fw)(),l=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,v.L6)();return i.createElement(u,{name:"Switch.Description",value:s},i.createElement(o,{name:"Switch.Label",value:a,props:{htmlFor:null==(t=l.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.createElement(x.Provider,{value:l},c({ourProps:{},theirProps:e,slot:{},defaultTag:M,name:"Switch.Group"}))))},Label:C.__,Description:w.dk});var E=r(44140),O=r(26898),P=r(13241),j=r(1153),L=r(47187);let S=(0,j.fn)("Switch"),N=i.forwardRef((e,t)=>{let{checked:r,defaultChecked:a=!1,onChange:o,color:s,name:u,error:l,errorMessage:c,disabled:d,required:h,tooltip:f,id:m}=e,p=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:s?(0,j.bM)(s,O.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,j.bM)(s,O.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[b,y]=(0,E.Z)(a,r),[v,w]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:C}=(0,L.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(L.Z,Object.assign({text:f},k)),i.createElement("div",Object.assign({ref:(0,j.lq)([t,k.refs.setReference]),className:(0,P.q)(S("root"),"flex flex-row relative h-5")},p,C),i.createElement("input",{type:"checkbox",className:(0,P.q)(S("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:u,required:h,checked:b,onChange:e=>{e.preventDefault()}}),i.createElement(q,{checked:b,onChange:e=>{y(e),null==o||o(e)},disabled:d,className:(0,P.q)(S("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",d?"cursor-not-allowed":""),onFocus:()=>w(!0),onBlur:()=>w(!1),id:m},i.createElement("span",{className:(0,P.q)(S("sr-only"),"sr-only")},"Switch ",b?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(S("background"),b?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(S("round"),b?(0,P.q)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",v?(0,P.q)("ring-2",g.ringColor):"")}))),l&&c?i.createElement("p",{className:(0,P.q)(S("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});N.displayName="Switch"},49804:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),o=r(1153),i=r(2265),s=r(9496);let u=(0,o.fn)("Col"),l=i.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:o,numColSpanMd:l,numColSpanLg:c,children:d,className:h}=e,f=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.createElement("div",Object.assign({ref:t,className:(0,a.q)(u("root"),(()=>{let e=m(r,s.PT),t=m(o,s.SP),n=m(l,s.VS),i=m(c,s._w);return(0,a.q)(e,t,n,i)})(),h)},f),d)});l.displayName="Col"},94789:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),o=r(26898),i=r(13241),s=r(1153);let u=(0,s.fn)("Callout"),l=a.forwardRef((e,t)=>{let{title:r,icon:l,color:c,className:d,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,i.q)(u("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",c?(0,i.q)((0,s.bM)(c,o.K.background).bgColor,(0,s.bM)(c,o.K.darkBorder).borderColor,(0,s.bM)(c,o.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,i.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),d)},f),a.createElement("div",{className:(0,i.q)(u("header"),"flex items-start")},l?a.createElement(l,{className:(0,i.q)(u("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,i.q)(u("title"),"font-semibold")},r)),a.createElement("p",{className:(0,i.q)(u("body"),"overflow-y-auto",h?"mt-2":"")},h))});l.displayName="Callout"},15051:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},49322:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},99397:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},77331:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},91777:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return i}});var n=r(18238),a=r(7989),o=r(11255),i=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let o=await this.#n.start();return await this.#r.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#a({type:"success",data:o}),o}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),o=r(18238),i=r(24112),s=class extends i.l{constructor(e={}){super(),this.config=e,this.#o=new Map}#o;build(e,t,r){let o=t.queryKey,i=t.queryHash??(0,n.Rm)(o,t),s=this.get(i);return s||(s=new a.A({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#o.has(e.queryHash)||(this.#o.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#o.get(e.queryHash);t&&(e.destroy(),t===e&&this.#o.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#o.get(e)}getAll(){return[...this.#o.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#s=new Map,this.#u=0}#i;#s;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=c(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#s.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,o)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:o?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await d(i),{maxPages:u}=t.options,l=o?n.Ht:n.VX;return{pages:l(e.pages,s,u),pageParams:l(e.pageParams,a,u)}};if(o&&i.length){let e="backward"===o,t={pages:i,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);u=await h(t,r,e)}else{let t=e??i.length;do{let e=0===l?s[0]??a.initialPageParam:m(a,u);if(l>0&&null==e)break;u=await h(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#l;#r;#c;#d;#h;#f;#m;#p;constructor(e={}){this.#l=e.queryCache||new s,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),o=this.#l.get(a.queryHash),i=o?.state.data,s=(0,n.SE)(t,i);if(void 0!==s)return this.#l.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),o=r(63497),i=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:u=0,days:l=0,hours:c=0,minutes:d=0,seconds:h=0}=t,f=(0,i.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=l||u?(0,n.E)(m,l+7*u):m;return(0,o.L)(e,p.getTime()+1e3*(h+60*(d+60*c)))}},59121:function(e,t,r){r.d(t,{E:function(){return o}});var n=r(99649),a=r(63497);function o(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return o}});var n=r(99649),a=r(63497);function o(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let o=r.getDate(),i=(0,a.L)(e,r.getTime());return(i.setMonth(r.getMonth()+t+1,0),o>=i.getDate())?i:(r.setFullYear(i.getFullYear(),i.getMonth(),o),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5767,1623],{69993:function(e,t,r){r.d(t,{Z:function(){return s}});var n=r(1119),a=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},i=r(55015),s=a.forwardRef(function(e,t){return a.createElement(i.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},47323:function(e,t,r){r.d(t,{Z:function(){return p}});var n=r(5853),a=r(2265),o=r(47187),i=r(7084),s=r(13241),u=r(1153),l=r(26898);let c={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},h={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},f=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,u.bM)(t,l.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,u.bM)(t,l.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,u.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:l="simple",tooltip:p,size:g=i.u8.SM,color:b,className:y}=e,v=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),w=f(l,b),{tooltipProps:k,getReferenceProps:C}=(0,o.l)();return a.createElement("span",Object.assign({ref:(0,u.lq)([t,k.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",w.bgColor,w.textColor,w.borderColor,w.ringColor,h[l].rounded,h[l].border,h[l].shadow,h[l].ring,c[g].paddingX,c[g].paddingY,y)},C,v),a.createElement(o.Z,Object.assign({text:p},k)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",d[g].height,d[g].width)}))});p.displayName="Icon"},59341:function(e,t,r){r.d(t,{Z:function(){return N}});var n=r(5853),a=r(71049),o=r(11323),i=r(2265),s=r(66797),u=r(40099),l=r(74275),c=r(59456),d=r(93980),h=r(65573),f=r(67561),m=r(87550),p=r(628),g=r(80281),b=r(31370),y=r(20131),v=r(38929),w=r(52307),k=r(52724),C=r(7935);let x=(0,i.createContext)(null);x.displayName="GroupContext";let M=i.Fragment,q=Object.assign((0,v.yV)(function(e,t){var r;let n=(0,i.useId)(),M=(0,g.Q)(),q=(0,m.B)(),{id:E=M||"headlessui-switch-".concat(n),disabled:O=q||!1,checked:P,defaultChecked:j,onChange:L,name:S,value:N,form:D,autoFocus:R=!1,...Q}=e,Z=(0,i.useContext)(x),[K,T]=(0,i.useState)(null),A=(0,i.useRef)(null),F=(0,f.T)(A,t,null===Z?null:Z.setSwitch,T),z=(0,l.L)(j),[V,H]=(0,u.q)(P,L,null!=z&&z),B=(0,c.G)(),[I,_]=(0,i.useState)(!1),W=(0,d.z)(()=>{_(!0),null==H||H(!V),B.nextFrame(()=>{_(!1)})}),G=(0,d.z)(e=>{if((0,b.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),W()}),X=(0,d.z)(e=>{e.key===k.R.Space?(e.preventDefault(),W()):e.key===k.R.Enter&&(0,y.g)(e.currentTarget)}),Y=(0,d.z)(e=>e.preventDefault()),U=(0,C.wp)(),J=(0,w.zH)(),{isFocusVisible:$,focusProps:ee}=(0,a.F)({autoFocus:R}),{isHovered:et,hoverProps:er}=(0,o.X)({isDisabled:O}),{pressed:en,pressProps:ea}=(0,s.x)({disabled:O}),eo=(0,i.useMemo)(()=>({checked:V,disabled:O,hover:et,focus:$,active:en,autofocus:R,changing:I}),[V,et,$,en,O,I,R]),ei=(0,v.dG)({id:E,ref:F,role:"switch",type:(0,h.f)(e,K),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":V,"aria-labelledby":U,"aria-describedby":J,disabled:O||void 0,autoFocus:R,onClick:G,onKeyUp:X,onKeyPress:Y},ee,er,ea),es=(0,i.useCallback)(()=>{if(void 0!==z)return null==H?void 0:H(z)},[H,z]),eu=(0,v.L6)();return i.createElement(i.Fragment,null,null!=S&&i.createElement(p.Mt,{disabled:O,data:{[S]:N||"on"},overrides:{type:"checkbox",checked:V},form:D,onReset:es}),eu({ourProps:ei,theirProps:Q,slot:eo,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,i.useState)(null),[a,o]=(0,C.bE)(),[s,u]=(0,w.fw)(),l=(0,i.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,v.L6)();return i.createElement(u,{name:"Switch.Description",value:s},i.createElement(o,{name:"Switch.Label",value:a,props:{htmlFor:null==(t=l.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},i.createElement(x.Provider,{value:l},c({ourProps:{},theirProps:e,slot:{},defaultTag:M,name:"Switch.Group"}))))},Label:C.__,Description:w.dk});var E=r(44140),O=r(26898),P=r(13241),j=r(1153),L=r(47187);let S=(0,j.fn)("Switch"),N=i.forwardRef((e,t)=>{let{checked:r,defaultChecked:a=!1,onChange:o,color:s,name:u,error:l,errorMessage:c,disabled:d,required:h,tooltip:f,id:m}=e,p=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:s?(0,j.bM)(s,O.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:s?(0,j.bM)(s,O.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[b,y]=(0,E.Z)(a,r),[v,w]=(0,i.useState)(!1),{tooltipProps:k,getReferenceProps:C}=(0,L.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(L.Z,Object.assign({text:f},k)),i.createElement("div",Object.assign({ref:(0,j.lq)([t,k.refs.setReference]),className:(0,P.q)(S("root"),"flex flex-row relative h-5")},p,C),i.createElement("input",{type:"checkbox",className:(0,P.q)(S("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:u,required:h,checked:b,onChange:e=>{e.preventDefault()}}),i.createElement(q,{checked:b,onChange:e=>{y(e),null==o||o(e)},disabled:d,className:(0,P.q)(S("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",d?"cursor-not-allowed":""),onFocus:()=>w(!0),onBlur:()=>w(!1),id:m},i.createElement("span",{className:(0,P.q)(S("sr-only"),"sr-only")},"Switch ",b?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(S("background"),b?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(S("round"),b?(0,P.q)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",v?(0,P.q)("ring-2",g.ringColor):"")}))),l&&c?i.createElement("p",{className:(0,P.q)(S("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});N.displayName="Switch"},49804:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),o=r(1153),i=r(2265),s=r(9496);let u=(0,o.fn)("Col"),l=i.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:o,numColSpanMd:l,numColSpanLg:c,children:d,className:h}=e,f=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return i.createElement("div",Object.assign({ref:t,className:(0,a.q)(u("root"),(()=>{let e=m(r,s.PT),t=m(o,s.SP),n=m(l,s.VS),i=m(c,s._w);return(0,a.q)(e,t,n,i)})(),h)},f),d)});l.displayName="Col"},94789:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),o=r(26898),i=r(13241),s=r(1153);let u=(0,s.fn)("Callout"),l=a.forwardRef((e,t)=>{let{title:r,icon:l,color:c,className:d,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,i.q)(u("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",c?(0,i.q)((0,s.bM)(c,o.K.background).bgColor,(0,s.bM)(c,o.K.darkBorder).borderColor,(0,s.bM)(c,o.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,i.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),d)},f),a.createElement("div",{className:(0,i.q)(u("header"),"flex items-start")},l?a.createElement(l,{className:(0,i.q)(u("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,i.q)(u("title"),"font-semibold")},r)),a.createElement("p",{className:(0,i.q)(u("body"),"overflow-y-auto",h?"mt-2":"")},h))});l.displayName="Callout"},15051:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},49322:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},99397:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=a},91777:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return i}});var n=r(18238),a=r(7989),o=r(11255),i=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let o=await this.#n.start();return await this.#r.config.onSuccess?.(o,e,this.state.context,this,r),await this.options.onSuccess?.(o,e,this.state.context,r),await this.#r.config.onSettled?.(o,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(o,null,e,this.state.context,r),this.#a({type:"success",data:o}),o}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),o=r(18238),i=r(24112),s=class extends i.l{constructor(e={}){super(),this.config=e,this.#o=new Map}#o;build(e,t,r){let o=t.queryKey,i=t.queryHash??(0,n.Rm)(o,t),s=this.get(i);return s||(s=new a.A({client:e,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(s)),s}add(e){this.#o.has(e.queryHash)||(this.#o.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#o.get(e.queryHash);t&&(e.destroy(),t===e&&this.#o.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#o.get(e)}getAll(){return[...this.#o.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){o.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#s=new Map,this.#u=0}#i;#s;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#i.add(e);let t=c(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){o.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#s.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){o.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return o.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,o)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:o?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await d(i),{maxPages:u}=t.options,l=o?n.Ht:n.VX;return{pages:l(e.pages,s,u),pageParams:l(e.pageParams,a,u)}};if(o&&i.length){let e="backward"===o,t={pages:i,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);u=await h(t,r,e)}else{let t=e??i.length;do{let e=0===l?s[0]??a.initialPageParam:m(a,u);if(l>0&&null==e)break;u=await h(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#l;#r;#c;#d;#h;#f;#m;#p;constructor(e={}){this.#l=e.queryCache||new s,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),o=this.#l.get(a.queryHash),i=o?.state.data,s=(0,n.SE)(t,i);if(void 0!==s)return this.#l.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return o.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;o.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return o.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(o.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return o.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(o.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),o=r(63497),i=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:u=0,days:l=0,hours:c=0,minutes:d=0,seconds:h=0}=t,f=(0,i.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=l||u?(0,n.E)(m,l+7*u):m;return(0,o.L)(e,p.getTime()+1e3*(h+60*(d+60*c)))}},59121:function(e,t,r){r.d(t,{E:function(){return o}});var n=r(99649),a=r(63497);function o(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return o}});var n=r(99649),a=r(63497);function o(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let o=r.getDate(),i=(0,a.L)(e,r.getTime());return(i.setMonth(r.getMonth()+t+1,0),o>=i.getDate())?i:(r.setFullYear(i.getFullYear(),i.getMonth(),o),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5992-5807a2ecc6fb3ea0.js b/litellm/proxy/_experimental/out/_next/static/chunks/5992-b6f4cbb3c0f62c93.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5992-5807a2ecc6fb3ea0.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5992-b6f4cbb3c0f62c93.js index 4917f7736f..24659f51eb 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5992-5807a2ecc6fb3ea0.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5992-b6f4cbb3c0f62c93.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5992],{19046:function(e,t,s){s.d(t,{Dx:function(){return n.Z},Zb:function(){return r.Z},oi:function(){return o.Z},xv:function(){return l.Z},zx:function(){return a.Z}});var a=s(78489),r=s(12514),l=s(84264),o=s(49566),n=s(96761)},88712:function(e,t,s){var a=s(57437);s(2265);var r=s(33145),l=s(66830),o=s(50010);t.Z=e=>{let{message:t}=e;if(!(0,l.br)(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(o.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)(r.default,{src:t.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})}},27930:function(e,t,s){var a=s(57437);s(2265);var r=s(65319),l=s(99981),o=s(53508);let{Dragger:n}=r.default;t.Z=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:r,onRemoveImage:i}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(n,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(l.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(o.Z,{style:{fontSize:"16px"}})})})})})}},66830:function(e,t,s){s.d(t,{Hk:function(){return l},Sn:function(){return r},br:function(){return o}});let a=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result)},a.onerror=s,a.readAsDataURL(e)}),r=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await a(t)}}]}),l=(e,t,s,a)=>{let r="";t&&a&&(r=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let l={role:"user",content:t?"".concat(e," ").concat(r):e};return t&&s&&(l.imagePreviewUrl=s),l},o=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl},25992:function(e,t,s){s.d(t,{Z:function(){return e6}});var a=s(57437),r=s(61935),l=s(92403),o=s(55322),n=s(62272),i=s(26430),c=s(12660),d=s(25980),m=s(69993),u=s(71891),x=s(58630),g=s(15424),p=s(44625),h=s(57400),f=s(11894),v=s(15883),b=s(99890),y=s(26349),j=s(50010),N=s(79276),w=s(19046),S=s(4260),_=s(65319),k=s(57840),P=s(37592),C=s(5545),A=s(79326),I=s(99981),E=s(10353),Z=s(22116),T=s(2265),L=s(62831),R=s(17906),O=s(57365),U=s(93837),M=s(9309),K=s(67479),D=s(87972),B=s(9114),z=s(19250),H=s(99020),F=s(97415),G=s(26832),W=s(85498);async function J(e,t,s,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,n=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=(arguments.length>13&&arguments[13],arguments.length>14?arguments[14]:void 0);if(!a)throw Error("Virtual Key is required");console.log=function(){};let g=x||(0,z.getProxyBaseUrl)(),p={};r&&r.length>0&&(p["x-litellm-tags"]=r.join(","));let h=new W.ZP({apiKey:a,baseURL:g,dangerouslyAllowBrowser:!0,defaultHeaders:p});try{let a=Date.now(),r=!1,x={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(x.vector_store_ids=d),m&&(x.guardrails=m),u&&(x.policies=u),h.messages.stream(x,{signal:l}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let l=e.delta;if(!r){r=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),n&&n(e)}"text_delta"===l.type?t("assistant",l.text,s):"reasoning_delta"===l.type&&o&&o(l.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==l?void 0:l.aborted)?console.log("Anthropic messages request was cancelled"):B.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var q=s(7271);async function V(e,t,s,a,r,l,o,n,i,c){console.log=function(){},console.log("isLocal:",!1);let d=c||(0,z.getProxyBaseUrl)(),m=new q.ZP.OpenAI({apiKey:r,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:l&&l.length>0?{"x-litellm-tags":l.join(",")}:void 0});try{let r=await m.audio.speech.create({model:a,input:e,voice:t,...n?{response_format:n}:{},...i?{speed:i}:{}},{signal:o}),l=await r.blob(),c=URL.createObjectURL(l);s(c,a)}catch(e){throw(null==o?void 0:o.aborted)?console.log("Audio speech request was cancelled"):B.Z.fromBackend("Error occurred while generating speech. Please try again. Error: ".concat(e)),e}}async function Y(e,t,s,a,r,l,o,n,i,c,d){console.log=function(){},console.log("isLocal:",!1);let m=d||(0,z.getProxyBaseUrl)(),u=new q.ZP.OpenAI({apiKey:a,baseURL:m,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let a=await u.audio.transcriptions.create({model:s,file:e,...o?{language:o}:{},...n?{prompt:n}:{},...i?{response_format:i}:{},...void 0!==c?{temperature:c}:{}},{signal:l});if(console.log("Transcription response:",a),a&&a.text)t(a.text,s),B.Z.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),null==l?void 0:l.aborted)console.log("Audio transcription request was cancelled");else{var x;let t="Failed to transcribe audio";(null==e?void 0:null===(x=e.error)||void 0===x?void 0:x.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),B.Z.fromBackend("Audio transcription failed: ".concat(t))}throw e}}var X=s(95459);async function $(e,t,s,a,r,l){if(!a)throw Error("Virtual Key is required");console.log=function(){};let o=l||(0,z.getProxyBaseUrl)(),n={};r&&r.length>0&&(n["x-litellm-tags"]=r.join(","));try{var i,c,d;let r=o.endsWith("/")?o.slice(0,-1):o,l=await fetch("".concat(r,"/embeddings"),{method:"POST",headers:{"Content-Type":"application/json",[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(a),...n},body:JSON.stringify({model:s,input:e})});if(!l.ok){let e=await l.text();throw Error(e||"Request failed with status ".concat(l.status))}let m=await l.json(),u=null==m?void 0:null===(c=m.data)||void 0===c?void 0:null===(i=c[0])||void 0===i?void 0:i.embedding;if(!u)throw Error("No embedding returned from server");t(JSON.stringify(u),null!==(d=null==m?void 0:m.model)&&void 0!==d?d:s)}catch(e){throw B.Z.fromBackend("Error occurred while making embeddings request. Please try again. Error: ".concat(e)),e}}var Q=s(91643),ee=s(10703);async function et(e,t,s,a,r,l,o,n){console.log=function(){},console.log("isLocal:",!1);let i=n||(0,z.getProxyBaseUrl)(),c=new q.ZP.OpenAI({apiKey:r,baseURL:i,dangerouslyAllowBrowser:!0,defaultHeaders:l&&l.length>0?{"x-litellm-tags":l.join(",")}:void 0});try{let r=Array.isArray(e)?e:[e],l=[];for(let e=0;e1&&B.Z.success("Successfully processed ".concat(l.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==o?void 0:o.aborted)console.log("Image edits request was cancelled");else{var d;let t="Failed to edit image(s)";(null==e?void 0:null===(d=e.error)||void 0===d?void 0:d.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),B.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function es(e,t,s,a,r,l,o){console.log=function(){},console.log("isLocal:",!1);let n=o||(0,z.getProxyBaseUrl)(),i=new q.ZP.OpenAI({apiKey:a,baseURL:n,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let a=await i.images.generate({model:s,prompt:e},{signal:l});if(console.log(a.data),a.data&&a.data[0]){if(a.data[0].url)t(a.data[0].url,s);else if(a.data[0].b64_json){let e=a.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==l?void 0:l.aborted)?console.log("Image generation request was cancelled"):B.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function ea(e,t,s,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,n=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=arguments.length>13?arguments[13]:void 0,g=arguments.length>14?arguments[14]:void 0,p=arguments.length>15?arguments[15]:void 0,h=arguments.length>16?arguments[16]:void 0,f=arguments.length>17?arguments[17]:void 0,v=arguments.length>18?arguments[18]:void 0,b=arguments.length>19?arguments[19]:void 0,y=arguments.length>20?arguments[20]:void 0,j=arguments.length>21?arguments[21]:void 0;if(!a)throw Error("Virtual Key is required");if(!s||""===s.trim())throw Error("Model is required. Please select a model before sending a request.");console.log=function(){};let N=b||(0,z.getProxyBaseUrl)(),w={};r&&r.length>0&&(w["x-litellm-tags"]=r.join(","));let S=new q.ZP.OpenAI({apiKey:a,baseURL:N,dangerouslyAllowBrowser:!0,defaultHeaders:w});try{let a=Date.now(),r=!1,b=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),N=[];x&&x.length>0&&(x.includes("__all__")?N.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):x.forEach(e=>{let t=null==y?void 0:y.find(t=>t.server_id===e),s=(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,a=(null==j?void 0:j[e])||[];N.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp/".concat(s),require_approval:"never",...a.length>0?{allowed_tools:a}:{}})})),f&&N.push({type:"code_interpreter",container:{type:"auto"}});let w=await S.responses.create({model:s,input:b,stream:!0,litellm_trace_id:c,...g?{previous_response_id:g}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...u?{policies:u}:{},...N.length>0?{tools:N,tool_choice:"auto"}:{}},{signal:l}),Z="",T={code:"",containerId:""};for await(let e of w)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var _,k,P,C,A,I,E;if(((null===(_=e.type)||void 0===_?void 0:_.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(k=e.item)||void 0===k?void 0:k.type)==="mcp_list_tools"||(null===(P=e.item)||void 0===P?void 0:P.type)==="mcp_call"))&&(console.log("MCP event received:",e),h)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(I=e.item)||void 0===I?void 0:I.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};h(t)}if("response.output_item.done"===e.type&&(null===(C=e.item)||void 0===C?void 0:C.type)==="mcp_call"&&(null===(A=e.item)||void 0===A?void 0:A.name)&&(Z=e.item.name,console.log("MCP tool used:",Z)),T=function(e,t){var s;return"response.output_item.done"===e.type&&(null===(s=e.item)||void 0===s?void 0:s.type)==="code_interpreter_call"?(console.log("Code interpreter call completed:",e.item),{code:e.item.code||"",containerId:e.item.container_id||""}):t}(e,T),!function(e,t,s){var a,r;if("response.output_item.done"===e.type&&(null===(a=e.item)||void 0===a?void 0:a.type)==="message"&&(null===(r=e.item)||void 0===r?void 0:r.content)&&s){for(let a of e.item.content)if("output_text"===a.type&&a.annotations){let e=a.annotations.filter(e=>"container_file_citation"===e.type);(e.length>0||t.code)&&s({code:t.code,containerId:t.containerId,annotations:e})}}}(e,T,v),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let l=e.delta;if(console.log("Text delta",l),l.trim().length>0&&(t("assistant",l,s),!r)){r=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),n&&n(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&o&&o(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&p&&(console.log("Response ID for session management:",t.id),p(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(E=s.completion_tokens_details)||void 0===E?void 0:E.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,Z)}}}return w}catch(e){throw(null==l?void 0:l.aborted)?console.log("Responses API request was cancelled"):B.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var er=s(83669),el=s(29271),eo=s(5540),en=s(38434),ei=s(23639),ec=s(70464),ed=s(77565);let em=e=>{switch(e){case"completed":return(0,a.jsx)(er.Z,{className:"text-green-500"});case"working":case"submitted":return(0,a.jsx)(r.Z,{className:"text-blue-500"});case"failed":case"canceled":return(0,a.jsx)(el.Z,{className:"text-red-500"});default:return(0,a.jsx)(eo.Z,{className:"text-gray-500"})}},eu=e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}},ex=e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch(t){return e}},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.length>t?"".concat(e.substring(0,t),"…"):e:null},ep=e=>{navigator.clipboard.writeText(e)};var eh=e=>{let{a2aMetadata:t,timeToFirstToken:s,totalLatency:r}=e,[l,o]=(0,T.useState)(!1);if(!t&&!s&&!r)return null;let{taskId:i,contextId:c,status:d,metadata:u}=t||{},x=ex(null==d?void 0:d.timestamp);return(0,a.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,a.jsx)(m.Z,{className:"mr-1.5 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[(null==d?void 0:d.state)&&(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat(eu(d.state)),children:[em(d.state),(0,a.jsx)("span",{className:"ml-1 capitalize",children:d.state})]}),x&&(0,a.jsx)(I.Z,{title:null==d?void 0:d.timestamp,children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(eo.Z,{className:"mr-1"}),x]})}),void 0!==r&&(0,a.jsx)(I.Z,{title:"Total latency",children:(0,a.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,a.jsx)(eo.Z,{className:"mr-1"}),(r/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,a.jsx)(I.Z,{title:"Time to first token",children:(0,a.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[i&&(0,a.jsx)(I.Z,{title:"Click to copy: ".concat(i),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>ep(i),children:[(0,a.jsx)(en.Z,{className:"mr-1"}),"Task: ",eg(i),(0,a.jsx)(ei.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),c&&(0,a.jsx)(I.Z,{title:"Click to copy: ".concat(c),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>ep(c),children:[(0,a.jsx)(n.Z,{className:"mr-1"}),"Session: ",eg(c),(0,a.jsx)(ei.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(u||(null==d?void 0:d.message))&&(0,a.jsxs)(C.ZP,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>o(!l),children:[l?(0,a.jsx)(ec.Z,{}):(0,a.jsx)(ed.Z,{}),(0,a.jsx)("span",{className:"ml-1",children:"Details"})]})]}),l&&(0,a.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[(null==d?void 0:d.message)&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,a.jsx)("span",{className:"ml-2",children:d.message})]}),i&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:i}),(0,a.jsx)(ei.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>ep(i)})]}),c&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:c}),(0,a.jsx)(ei.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>ep(c)})]}),u&&Object.keys(u).length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,a.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(u,null,2)})]})]})]})},ef=s(92280),ev=s(61994),eb=s(19015),ey=s(85847),ej=e=>{let{temperature:t=1,maxTokens:s=2048,useAdvancedParams:r,onTemperatureChange:l,onMaxTokensChange:o,onUseAdvancedParamsChange:n}=e,[i,c]=(0,T.useState)(!1),d=void 0!==r?r:i,[m,u]=(0,T.useState)(t),[x,p]=(0,T.useState)(s);(0,T.useEffect)(()=>{u(t)},[t]),(0,T.useEffect)(()=>{p(s)},[s]);let h=e=>{let t=null!=e?e:1;u(t),null==l||l(t)},f=e=>{let t=null!=e?e:1e3;p(t),null==o||o(t)},v=d?"text-gray-700":"text-gray-400",b=e=>{n?n(e):c(e)};return(0,a.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,a.jsx)(ev.Z,{checked:d,onChange:e=>b(e.target.checked),children:(0,a.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),(0,a.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:d?1:.4},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(ef.x,{className:"text-sm ".concat(v),children:"Temperature"}),(0,a.jsx)(I.Z,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,a.jsx)(g.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(eb.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,precision:1,className:"w-20"})]}),(0,a.jsx)(ey.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(ef.x,{className:"text-sm ".concat(v),children:"Max Tokens"}),(0,a.jsx)(I.Z,{title:"Maximum number of tokens to generate in the response.",children:(0,a.jsx)(g.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(eb.Z,{min:1,max:32768,step:1,value:x,onChange:f,disabled:!d})]}),(0,a.jsx)(ey.Z,{min:1,max:32768,step:1,value:x,onChange:f,disabled:!d,marks:{1:"1",32768:"32768"}})]})]})]})},eN=e=>{let{message:t}=e;return t.isAudio&&"string"==typeof t.content?(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("audio",{controls:!0,src:t.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null},ew=s(8443);let eS={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},e_=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(e=>{let[t,s]=e;return{value:s,label:eS[t]}}),ek=[{value:ew.KP.CHAT,label:"/v1/chat/completions"},{value:ew.KP.RESPONSES,label:"/v1/responses"},{value:ew.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:ew.KP.IMAGE,label:"/v1/images/generations"},{value:ew.KP.IMAGE_EDITS,label:"/v1/images/edits"},{value:ew.KP.EMBEDDINGS,label:"/v1/embeddings"},{value:ew.KP.SPEECH,label:"/v1/audio/speech"},{value:ew.KP.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:ew.KP.A2A_AGENTS,label:"/v1/a2a/message/send"}];var eP=s(88712),eC=s(27930),eA=s(66830),eI=s(44851),eE=s(41589),eZ=s(73879),eT=e=>{let{code:t,containerId:s,annotations:l=[],accessToken:o}=e,[n,i]=(0,T.useState)({}),[c,d]=(0,T.useState)({}),m=(0,z.getProxyBaseUrl)();(0,T.useEffect)(()=>{let e=async()=>{for(let r of l){var e,t,s,a;if(((null===(e=r.filename)||void 0===e?void 0:e.toLowerCase().endsWith(".png"))||(null===(t=r.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".jpg"))||(null===(s=r.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpeg"))||(null===(a=r.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".gif")))&&r.container_id&&r.file_id){d(e=>({...e,[r.file_id]:!0}));try{let e=await fetch("".concat(m,"/v1/containers/").concat(r.container_id,"/files/").concat(r.file_id,"/content"),{headers:{[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o)}});if(e.ok){let t=await e.blob(),s=URL.createObjectURL(t);i(e=>({...e,[r.file_id]:s}))}}catch(e){console.error("Error fetching image:",e)}finally{d(e=>({...e,[r.file_id]:!1}))}}}};return l.length>0&&o&&e(),()=>{Object.values(n).forEach(e=>URL.revokeObjectURL(e))}},[l,o,m]);let u=async e=>{try{let t=await fetch("".concat(m,"/v1/containers/").concat(e.container_id,"/files/").concat(e.file_id,"/content"),{headers:{[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o)}});if(t.ok){let s=await t.blob(),a=URL.createObjectURL(s),r=document.createElement("a");r.href=a,r.download=e.filename||"file_".concat(e.file_id),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)}}catch(e){console.error("Error downloading file:",e)}},x=l.filter(e=>{var t,s,a,r;return(null===(t=e.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".png"))||(null===(s=e.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpg"))||(null===(a=e.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".jpeg"))||(null===(r=e.filename)||void 0===r?void 0:r.toLowerCase().endsWith(".gif"))}),g=l.filter(e=>{var t,s,a,r;return!(null===(t=e.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".png"))&&!(null===(s=e.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpg"))&&!(null===(a=e.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".jpeg"))&&!(null===(r=e.filename)||void 0===r?void 0:r.toLowerCase().endsWith(".gif"))});return t||0!==l.length?(0,a.jsxs)("div",{className:"mt-3 space-y-3",children:[t&&(0,a.jsx)(eI.default,{size:"small",items:[{key:"code",label:(0,a.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(f.Z,{})," Python Code Executed"]}),children:(0,a.jsx)(R.Z,{language:"python",style:O.Z,customStyle:{margin:0,borderRadius:"6px",fontSize:"12px",maxHeight:"300px",overflow:"auto"},children:t})}]}),x.map(e=>(0,a.jsx)("div",{className:"rounded-lg border border-gray-200 overflow-hidden",children:c[e.file_id]?(0,a.jsxs)("div",{className:"flex items-center justify-center p-8 bg-gray-50",children:[(0,a.jsx)(E.Z,{indicator:(0,a.jsx)(r.Z,{spin:!0})}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:"Loading image..."})]}):n[e.file_id]?(0,a.jsxs)("div",{children:[(0,a.jsx)("img",{src:n[e.file_id],alt:e.filename||"Generated chart",className:"max-w-full",style:{maxHeight:"400px"}}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 border-t border-gray-200",children:[(0,a.jsxs)("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,a.jsx)(eE.Z,{})," ",e.filename]}),(0,a.jsxs)("button",{onClick:()=>u(e),className:"text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1",children:[(0,a.jsx)(eZ.Z,{})," Download"]})]})]}):(0,a.jsx)("div",{className:"flex items-center justify-center p-4 bg-gray-50",children:(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Image not available"})})},e.file_id)),g.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,a.jsxs)("button",{onClick:()=>u(e),className:"flex items-center gap-2 px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 transition-colors",children:[(0,a.jsx)(en.Z,{className:"text-blue-500"}),(0,a.jsx)("span",{className:"text-sm",children:e.filename}),(0,a.jsx)(eZ.Z,{className:"text-gray-400"})]},e.file_id))})]}):null},eL=s(42264),eR=s(63709);let eO=e=>{if(!e)return!1;let t=e.toLowerCase();return t.startsWith("openai/")||t.startsWith("gpt-")||t.startsWith("o1")||t.startsWith("o3")||t.includes("openai")};var eU=e=>{let{enabled:t,onEnabledChange:s,selectedModel:r,disabled:l=!1}=e,o=eO(r);return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-lg p-3 bg-gradient-to-r from-blue-50 to-purple-50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(f.Z,{className:"text-blue-500"}),(0,a.jsx)(ef.x,{className:"font-medium text-gray-700",children:"Code Interpreter"}),(0,a.jsx)(I.Z,{title:"Run Python code to generate files, charts, and analyze data. Container is created automatically.",children:(0,a.jsx)(g.Z,{className:"text-gray-400 text-xs"})})]}),(0,a.jsx)(eR.Z,{checked:t&&o,onChange:e=>{if(e&&!o){eL.ZP.warning("Code Interpreter is only available for OpenAI models");return}s(e)},disabled:l||!o,size:"small",className:t&&o?"bg-blue-500":""})]}),!o&&(0,a.jsx)("div",{className:"mt-2 pt-2 border-t border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(el.Z,{className:"text-amber-500 mt-0.5"}),(0,a.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,a.jsx)("span",{children:"Code Interpreter is currently only supported for OpenAI models. "}),(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new?template=feature_request.yml",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Request support for other providers"})]})]})})]})},eM=s(82971),eK=e=>{let{endpointType:t,onEndpointChange:s,className:r}=e;return(0,a.jsx)("div",{className:r,children:(0,a.jsx)(P.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:ek,className:"rounded-md",filterOption:(e,t)=>{var s,a;return(null!==(s=null==t?void 0:t.label)&&void 0!==s?s:"").toLowerCase().includes(e.toLowerCase())||(null!==(a=null==t?void 0:t.value)&&void 0!==a?a:"").toLowerCase().includes(e.toLowerCase())}})})},eD=s(29),eB=s.n(eD);let{Text:ez}=k.default,{Panel:eH}=eI.default;var eF=e=>{var t,s;let{events:r,className:l}=e;if(console.log("MCPEventsDisplay: Received events:",r),!r||0===r.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let o=r.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),n=r.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",o),console.log("MCPEventsDisplay: mcpCallEvents:",n),o||0!==n.length)?(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(l||""),children:[(0,a.jsx)(eB(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,a.jsxs)(eI.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:o?["list-tools"]:n.map((e,t)=>"mcp-call-".concat(t)),children:[o&&(0,a.jsx)(eH,{header:"List tools",children:(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=o.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),n.map((e,t)=>{var s,r,l;return(0,a.jsx)(eH,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(r=e.item)||void 0===r?void 0:r.arguments)&&(0,a.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,a.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(l=e.item)||void 0===l?void 0:l.output)&&(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eG=s(94331),eW=s(38398);let eJ=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result.split(",")[1])},a.onerror=s,a.readAsDataURL(e)}),eq=async(e,t)=>{let s=await eJ(t),a=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(a,";base64,").concat(s)}]}},eV=(e,t,s,a)=>{let r="";t&&a&&(r=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let l={role:"user",content:t?"".concat(e," ").concat(r):e};return t&&s&&(l.imagePreviewUrl=s),l},eY=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var eX=e=>{let{message:t}=e;if(!eY(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},e$=s(53508);let{Dragger:eQ}=_.default;var e0=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:r,onRemoveImage:l}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(eQ,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(I.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(e$.Z,{style:{fontSize:"16px"}})})})})})},e2=s(33152),e1=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:r,onToggleSessionManagement:l}=e;return t!==ew.KP.RESPONSES?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,a.jsx)(I.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,a.jsx)(g.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,a.jsx)(eR.Z,{checked:r,onChange:l,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,a.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(g.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return r?"API Session: Ready":"UI Session: Ready";let e=r?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,a.jsx)(I.Z,{title:(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,a.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,a.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),B.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,a.jsx)(ei.Z,{style:{fontSize:"12px"}})})})]}),(0,a.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?r?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":r?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})};let{TextArea:e4}=S.default,{Dragger:e3}=_.default,e5=new Set([ew.KP.CHAT,ew.KP.RESPONSES]);var e6=e=>{let{accessToken:t,token:s,userRole:S,userID:_,disabledPersonalKeyCreation:W,proxySettings:q}=e,[er,el]=(0,T.useState)([]),[eo,en]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedMCPServers");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedMCPServers from sessionStorage",e),[]}}),[ei,ec]=(0,T.useState)(!1),[ed,em]=(0,T.useState)({}),[eu,ex]=(0,T.useState)(()=>{let e=sessionStorage.getItem("mcpServerToolRestrictions");try{return e?JSON.parse(e):{}}catch(e){return console.error("Error parsing mcpServerToolRestrictions from sessionStorage",e),{}}}),[eg,ep]=(0,T.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return W?"custom":"session"}),[ef,ev]=(0,T.useState)(()=>sessionStorage.getItem("apiKey")||""),[eb,ey]=(0,T.useState)(()=>sessionStorage.getItem("customProxyBaseUrl")||""),[eS,ek]=(0,T.useState)(""),[eI,eE]=(0,T.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eZ,eL]=(0,T.useState)(void 0),[eR,eO]=(0,T.useState)(!1),[eD,eB]=(0,T.useState)([]),[ez,eH]=(0,T.useState)([]),[eJ,eY]=(0,T.useState)(void 0),e$=(0,T.useRef)(null),[eQ,e6]=(0,T.useState)(()=>sessionStorage.getItem("endpointType")||ew.KP.CHAT),[e7,e8]=(0,T.useState)(!1),e9=(0,T.useRef)(null),[te,tt]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[ts,ta]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch(t){return e}}),[tr,tl]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[to,tn]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[ti,tc]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedPolicies");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedPolicies from sessionStorage",e),[]}}),[td,tm]=(0,T.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tu,tx]=(0,T.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[tg,tp]=(0,T.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[th,tf]=(0,T.useState)([]),[tv,tb]=(0,T.useState)([]),[ty,tj]=(0,T.useState)(null),[tN,tw]=(0,T.useState)(null),[tS,t_]=(0,T.useState)(null),[tk,tP]=(0,T.useState)(null),[tC,tA]=(0,T.useState)(null),[tI,tE]=(0,T.useState)(!1),[tZ,tT]=(0,T.useState)(""),[tL,tR]=(0,T.useState)("openai"),[tO,tU]=(0,T.useState)([]),[tM,tK]=(0,T.useState)(1),[tD,tB]=(0,T.useState)(2048),[tz,tH]=(0,T.useState)(!1),tF=function(){let[e,t]=(0,T.useState)(()=>{let e=sessionStorage.getItem("codeInterpreterEnabled");return!!e&&JSON.parse(e)}),[s,a]=(0,T.useState)(null),r=(0,T.useCallback)(e=>{t(e),sessionStorage.setItem("codeInterpreterEnabled",JSON.stringify(e))},[]),l=(0,T.useCallback)(()=>{a(null)},[]),o=(0,T.useCallback)(()=>{r(!e)},[e,r]);return{enabled:e,result:s,setEnabled:r,setResult:a,clearResult:l,toggle:o}}(),tG=(0,T.useRef)(null),tW=async()=>{let e="session"===eg?t:ef;if(e){ec(!0);try{let t=await (0,z.fetchMCPServers)(e);el(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP servers:",e)}finally{ec(!1)}}},tJ=async e=>{let s="session"===eg?t:ef;if(s&&!ed[e])try{let t=await (0,z.listMCPTools)(s,e);em(s=>({...s,[e]:t.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t)}};(0,T.useEffect)(()=>{tI&&tT((0,eM.L)({apiKeySource:eg,accessToken:t,apiKey:ef,inputMessage:eS,chatHistory:eI,selectedTags:te,selectedVectorStores:tr,selectedGuardrails:to,selectedPolicies:ti,selectedMCPServers:eo,mcpServers:er,mcpServerToolRestrictions:eu,endpointType:eQ,selectedModel:eZ,selectedSdk:tL,selectedVoice:ts,proxySettings:q}))},[tI,tL,eg,t,ef,eS,eI,te,tr,to,ti,eo,er,eu,eQ,eZ,q]),(0,T.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(eI))},500);return()=>{clearTimeout(e)}},[eI]),(0,T.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eg)),sessionStorage.setItem("apiKey",ef),sessionStorage.setItem("endpointType",eQ),sessionStorage.setItem("selectedTags",JSON.stringify(te)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(tr)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(to)),sessionStorage.setItem("selectedPolicies",JSON.stringify(ti)),sessionStorage.setItem("selectedMCPServers",JSON.stringify(eo)),sessionStorage.setItem("mcpServerToolRestrictions",JSON.stringify(eu)),sessionStorage.setItem("selectedVoice",ts),sessionStorage.removeItem("selectedMCPTools"),eZ?sessionStorage.setItem("selectedModel",eZ):sessionStorage.removeItem("selectedModel"),td?sessionStorage.setItem("messageTraceId",td):sessionStorage.removeItem("messageTraceId"),tu?sessionStorage.setItem("responsesSessionId",tu):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(tg))},[eg,ef,eZ,eQ,te,tr,to,ti,td,tu,tg,eo,eu,ts]),(0,T.useEffect)(()=>{let e="session"===eg?t:ef;if(!e||!s||!S||!_){console.log("userApiKey or token or userRole or userID is missing = ",e,s,S,_);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,ee.p)(e);console.log("Fetched models:",t),eB(t);let s=t.some(e=>e.model_group===eZ);t.length&&s||eL(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tW()},[t,_,S,eg,ef,s]),(0,T.useEffect)(()=>{let e="session"===eg?t:ef;e&&eQ===ew.KP.A2A_AGENTS&&(async()=>{try{let t=await (0,Q.o)(e,eb||void 0);eH(t),eJ&&!t.some(e=>e.agent_name===eJ)&&eY(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[t,eg,ef,eQ,eb,eJ]),(0,T.useEffect)(()=>{tG.current&&setTimeout(()=>{var e;null===(e=tG.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[eI]);let tq=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eE(a=>{let r=a[a.length-1];if(!r||r.role!==e||r.isImage||r.isAudio)return[...a,{role:e,content:t,model:s}];{var l;let e={...r,content:r.content+t,model:null!==(l=r.model)&&void 0!==l?l:s};return[...a.slice(0,-1),e]}})},tV=e=>{eE(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},tY=e=>{console.log("updateTimingData called with:",e),eE(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let a=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",a),a}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},tX=(e,t)=>{console.log("Received usage data:",e),eE(s=>{let a=s[s.length-1];if(a&&"assistant"===a.role){console.log("Updating message with usage data:",e);let r={...a,usage:e,toolName:t};return console.log("Updated message:",r),[...s.slice(0,s.length-1),r]}return s})},t$=e=>{console.log("Received A2A metadata:",e),eE(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let a={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),a]}return t})},tQ=e=>{eE(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},t0=e=>{console.log("Received search results:",e),eE(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let a={...s,searchResults:e};return[...t.slice(0,t.length-1),a]}return t})},t2=e=>{console.log("Received response ID for session management:",e),tg&&tx(e)},t1=e=>{console.log("ChatUI: Received MCP event:",e),tU(t=>{if(e.item_id&&t.some(t=>t.item_id===e.item_id&&t.type===e.type&&(t.sequence_number===e.sequence_number||void 0===t.sequence_number&&void 0===e.sequence_number)))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},t4=(e,t)=>{eE(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},t3=(e,t)=>{eE(s=>[...s,{role:"assistant",content:(0,M.aS)(e,100),model:t,isEmbeddings:!0}])},t5=(e,t)=>{eE(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},t6=(e,t)=>{eE(s=>{let a=s[s.length-1];if(!a||"assistant"!==a.role||a.isImage||a.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var r;let l={...a,image:{url:e,detail:"auto"},model:null!==(r=a.model)&&void 0!==r?r:t};return[...s.slice(0,-1),l]}})},t7=e=>{tf(t=>[...t,e]);let t=URL.createObjectURL(e);return tb(e=>[...e,t]),!1},t8=e=>{tv[e]&&URL.revokeObjectURL(tv[e]),tf(t=>t.filter((t,s)=>s!==e)),tb(t=>t.filter((t,s)=>s!==e))},t9=()=>{tv.forEach(e=>{URL.revokeObjectURL(e)}),tf([]),tb([])},se=()=>{tN&&URL.revokeObjectURL(tN),tj(null),tw(null)},st=()=>{tk&&URL.revokeObjectURL(tk),t_(null),tP(null)},ss=()=>{tA(null)},sa=async()=>{let e;if(""===eS.trim()&&eQ!==ew.KP.TRANSCRIPTION)return;if(eQ===ew.KP.IMAGE_EDITS&&0===th.length){B.Z.fromBackend("Please upload at least one image for editing");return}if(eQ===ew.KP.TRANSCRIPTION&&!tC){B.Z.fromBackend("Please upload an audio file for transcription");return}if(eQ===ew.KP.A2A_AGENTS&&!eJ){B.Z.fromBackend("Please select an agent to send a message");return}if([ew.KP.CHAT,ew.KP.IMAGE,ew.KP.SPEECH,ew.KP.IMAGE_EDITS,ew.KP.RESPONSES,ew.KP.ANTHROPIC_MESSAGES,ew.KP.EMBEDDINGS,ew.KP.TRANSCRIPTION].includes(eQ)&&!eZ){B.Z.fromBackend("Please select a model before sending a request");return}if(!s||!S||!_)return;let a="session"===eg?t:ef;if(!a){B.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}e9.current=new AbortController;let r=e9.current.signal;if(eQ===ew.KP.RESPONSES&&ty)try{e=await eq(eS,ty)}catch(e){B.Z.fromBackend("Failed to process image. Please try again.");return}else if(eQ===ew.KP.CHAT&&tS)try{e=await (0,eA.Sn)(eS,tS)}catch(e){B.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:eS};let l=td||(0,U.Z)();td||tm(l),eE([...eI,eQ===ew.KP.RESPONSES&&ty?eV(eS,!0,tN||void 0,ty.name):eQ===ew.KP.CHAT&&tS?(0,eA.Hk)(eS,!0,tk||void 0,tS.name):eQ===ew.KP.TRANSCRIPTION&&tC?eV(eS?"\uD83C\uDFB5 Audio file: ".concat(tC.name,"\nPrompt: ").concat(eS):"\uD83C\uDFB5 Audio file: ".concat(tC.name),!1):eV(eS,!1)]),tU([]),tF.clearResult(),e8(!0);try{if(eZ){if(eQ===ew.KP.CHAT){let t=[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await (0,X.n)(t,(e,t)=>tq("assistant",e,t),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,t6,t0,tz?tM:void 0,tz?tD:void 0,tQ,eb||void 0,er,eu,t1)}else if(eQ===ew.KP.IMAGE)await es(eS,(e,t)=>t4(e,t),eZ,a,te,r,eb||void 0);else if(eQ===ew.KP.SPEECH)await V(eS,ts,(e,t)=>t5(e,t),eZ||"",a,te,r,void 0,void 0,eb||void 0);else if(eQ===ew.KP.IMAGE_EDITS)th.length>0&&await et(1===th.length?th[0]:th,eS,(e,t)=>t4(e,t),eZ,a,te,r,eb||void 0);else if(eQ===ew.KP.RESPONSES){let t;t=tg&&tu?[e]:[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await ea(t,(e,t,s)=>tq(e,t,s),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,tg?tu:null,t2,t1,tF.enabled,tF.setResult,eb||void 0,er,eu)}else if(eQ===ew.KP.ANTHROPIC_MESSAGES){let t=[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await J(t,(e,t,s)=>tq(e,t,s),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,eb||void 0)}else eQ===ew.KP.EMBEDDINGS?await $(eS,(e,t)=>t3(e,t),eZ,a,te,eb||void 0):eQ===ew.KP.TRANSCRIPTION&&tC&&await Y(tC,(e,t)=>tq("assistant",e,t),eZ,a,te,r,void 0,void 0,void 0,void 0,eb||void 0)}eQ===ew.KP.A2A_AGENTS&&eJ&&await (0,G.O)(eJ,eS,(e,t)=>tq("assistant",e,t),a,r,tY,tQ,t$,eb||void 0)}catch(e){r.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tq("assistant","Error fetching response:"+e))}finally{e8(!1),e9.current=null,eQ===ew.KP.IMAGE_EDITS&&t9(),eQ===ew.KP.RESPONSES&&ty&&se(),eQ===ew.KP.CHAT&&tS&&st(),eQ===ew.KP.TRANSCRIPTION&&tC&&ss()}ek("")};if(S&&"Admin Viewer"===S){let{Title:e,Paragraph:t}=k.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let sr=(0,a.jsx)(r.Z,{style:{fontSize:24},spin:!0});return(0,a.jsxs)("div",{className:"w-full p-4 pb-0 bg-white",children:[(0,a.jsx)(w.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,a.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,a.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,a.jsx)(w.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-2"})," Virtual Key Source"]}),(0,a.jsx)(P.default,{disabled:W,value:eg,style:{width:"100%"},onChange:e=>{ep(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eg&&(0,a.jsx)(w.oi,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:ev,value:ef,icon:l.Z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)(w.xv,{className:"font-medium block text-gray-700 flex items-center",children:[(0,a.jsx)(o.Z,{className:"mr-2"})," Custom Proxy Base URL"]}),(null==q?void 0:q.LITELLM_UI_API_DOC_BASE_URL)&&!eb&&(0,a.jsx)(C.ZP,{type:"link",size:"small",icon:(0,a.jsx)(n.Z,{}),onClick:()=>{ey(q.LITELLM_UI_API_DOC_BASE_URL||""),sessionStorage.setItem("customProxyBaseUrl",q.LITELLM_UI_API_DOC_BASE_URL||"")},className:"text-gray-500 hover:text-gray-700",children:"Fill"}),eb&&(0,a.jsx)(C.ZP,{type:"link",size:"small",icon:(0,a.jsx)(i.Z,{}),onClick:()=>{ey(""),sessionStorage.removeItem("customProxyBaseUrl")},className:"text-gray-500 hover:text-gray-700",children:"Clear"})]}),(0,a.jsx)(w.oi,{placeholder:"Optional: Enter custom proxy URL (e.g., http://localhost:5000)",onValueChange:e=>{ey(e),sessionStorage.setItem("customProxyBaseUrl",e)},value:eb,icon:c.Z}),eb&&(0,a.jsxs)(w.xv,{className:"text-xs text-gray-500 mt-1",children:["API calls will be sent to: ",eb]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-2"})," Endpoint Type"]}),(0,a.jsx)(eK,{endpointType:eQ,onEndpointChange:e=>{e6(e),eL(void 0),eY(void 0),eO(!1);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch(e){}},className:"mb-4"}),eQ===ew.KP.SPEECH&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2"}),"Voice"]}),(0,a.jsx)(P.default,{value:ts,onChange:e=>{ta(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:e_})]}),(0,a.jsx)(e1,{endpointType:eQ,responsesSessionId:tu,useApiSessionManagement:tg,onToggleSessionManagement:e=>{tp(e),e||tx(null)}})]}),eQ!==ew.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," Select Model"]}),(()=>{if(!eZ||"custom"===eZ)return!1;let e=eD.find(e=>e.model_group===eZ);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,a.jsx)(A.Z,{content:(0,a.jsx)(ej,{temperature:tM,maxTokens:tD,useAdvancedParams:tz,onTemperatureChange:tK,onMaxTokensChange:tB,onUseAdvancedParamsChange:tH}),title:"Model Settings",trigger:"click",placement:"right",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(o.Z,{}),className:"text-gray-500 hover:text-gray-700"})}):(0,a.jsx)(I.Z,{title:"Advanced parameters are only supported for chat models currently",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(o.Z,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,a.jsx)(P.default,{value:eZ,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),eL(e),eO("custom"===e)},options:[{value:"custom",label:"Enter custom model",key:"custom"},...Array.from(new Set(eD.filter(e=>{if(!e.mode)return!0;let t=(0,ew.vf)(e.mode);return eQ===ew.KP.RESPONSES||eQ===ew.KP.ANTHROPIC_MESSAGES?t===eQ||t===ew.KP.CHAT:eQ===ew.KP.IMAGE_EDITS?t===eQ||t===ew.KP.IMAGE:t===eQ}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t}))],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),eR&&(0,a.jsx)(w.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{e$.current&&clearTimeout(e$.current),e$.current=setTimeout(()=>{eL(e)},500)}})]}),eQ===ew.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," Select Agent"]}),(0,a.jsx)(P.default,{value:eJ,placeholder:"Select an Agent",onChange:e=>eY(e),options:ez.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:ez.map(e=>{var t;return(0,a.jsx)(P.default.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),(null===(t=e.agent_card_params)||void 0===t?void 0:t.description)&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id)})}),0===ez.length&&(0,a.jsx)(w.xv,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(u.Z,{className:"mr-2"})," Tags"]}),(0,a.jsx)(H.Z,{value:te,onChange:tt,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(x.Z,{className:"mr-2"})," MCP Servers",(0,a.jsx)(I.Z,{className:"ml-1",title:"Select MCP servers to use in your conversation.",children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsxs)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP servers",value:eo,onChange:e=>{e.includes("__all__")?(en(["__all__"]),ex({})):(en(e),ex(t=>{let s={...t};return Object.keys(s).forEach(t=>{e.includes(t)||delete s[t]}),s}),e.forEach(e=>{ed[e]||tJ(e)}))},loading:ei,className:"mb-2",allowClear:!0,optionLabelProp:"label",disabled:!e5.has(eQ),maxTagCount:"responsive",children:[(0,a.jsx)(P.default.Option,{value:"__all__",label:"All MCP Servers",children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:"All MCP Servers"}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:"Use all available MCP servers"})]})},"__all__"),er.map(e=>(0,a.jsx)(P.default.Option,{value:e.server_id,label:e.alias||e.server_name||e.server_id,disabled:eo.includes("__all__"),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.alias||e.server_name||e.server_id}),e.description&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.server_id))]}),eo.length>0&&!eo.includes("__all__")&&e5.has(eQ)&&(0,a.jsx)("div",{className:"mt-3 space-y-2",children:eo.map(e=>{let t=er.find(t=>t.server_id===e),s=ed[e]||[];return 0===s.length?null:(0,a.jsxs)("div",{className:"border rounded p-2",children:[(0,a.jsxs)(w.xv,{className:"text-xs text-gray-600 mb-1",children:["Limit tools for ",(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,":"]}),(0,a.jsx)(P.default,{mode:"multiple",size:"small",style:{width:"100%"},placeholder:"All tools (default)",value:eu[e]||[],onChange:t=>{ex(s=>({...s,[e]:t}))},options:s.map(e=>({value:e.name,label:e.name})),maxTagCount:2})]},e)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(p.Z,{className:"mr-2"})," Vector Store",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,a.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(F.Z,{value:tr,onChange:tl,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(h.Z,{className:"mr-2"})," Guardrails",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,a.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(K.Z,{value:to,onChange:tn,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(h.Z,{className:"mr-2"})," Policies",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select policy/policies to apply to this LLM API call. Policies define which guardrails are applied based on conditions. You can set up your policies"," ",(0,a.jsx)("a",{href:"?page=policies",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(D.Z,{value:ti,onChange:tc,className:"mb-4",accessToken:t||""})]}),eQ===ew.KP.RESPONSES&&(0,a.jsx)("div",{children:(0,a.jsx)(eU,{accessToken:"session"===eg?t||"":ef,enabled:tF.enabled,onEnabledChange:tF.setEnabled,selectedContainerId:null,onContainerChange:()=>{},selectedModel:eZ||""})})]})]}),(0,a.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsx)(w.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(w.zx,{onClick:()=>{eI.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eE([]),tm(null),tx(null),tU([]),t9(),se(),st(),ss(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),B.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:i.Z,children:"Clear Chat"}),(0,a.jsx)(w.zx,{onClick:()=>tE(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:f.Z,children:"Get Code"})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===eI.length&&(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(m.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(w.xv,{children:"Start a conversation, generate an image, or handle audio"})]}),eI.map((e,s)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,a.jsx)(v.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,a.jsx)(m.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,a.jsx)(eG.Z,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&s===eI.length-1&&tO.length>0&&(eQ===ew.KP.RESPONSES||eQ===ew.KP.CHAT)&&(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)(eF,{events:tO})}),"assistant"===e.role&&e.searchResults&&(0,a.jsx)(e2.J,{searchResults:e.searchResults}),"assistant"===e.role&&s===eI.length-1&&tF.result&&eQ===ew.KP.RESPONSES&&(0,a.jsx)(eT,{code:tF.result.code,containerId:tF.result.containerId,annotations:tF.result.annotations,accessToken:"session"===eg?t||"":ef}),(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,a.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):e.isAudio?(0,a.jsx)(eN,{message:e}):(0,a.jsxs)(a.Fragment,{children:[eQ===ew.KP.RESPONSES&&(0,a.jsx)(eX,{message:e}),eQ===ew.KP.CHAT&&(0,a.jsx)(eP.Z,{message:e}),(0,a.jsx)(L.UG,{components:{code(e){let{node:t,inline:s,className:r,children:l,...o}=e,n=/language-(\w+)/.exec(r||"");return!s&&n?(0,a.jsx)(R.Z,{style:O.Z,language:n[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...o,children:String(l).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...o,children:l})},pre:e=>{let{node:t,...s}=e;return(0,a.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&!e.a2aMetadata&&(0,a.jsx)(eW.Z,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage,toolName:e.toolName}),"assistant"===e.role&&e.a2aMetadata&&(0,a.jsx)(eh,{a2aMetadata:e.a2aMetadata,timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency})]})]})})},s)),e7&&tO.length>0&&(eQ===ew.KP.RESPONSES||eQ===ew.KP.CHAT)&&eI.length>0&&"user"===eI[eI.length-1].role&&(0,a.jsx)("div",{className:"text-left mb-4",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,a.jsx)(m.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,a.jsx)(eF,{events:tO})]})}),e7&&(0,a.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,a.jsx)(E.Z,{indicator:sr})}),(0,a.jsx)("div",{ref:tG,style:{height:"1px"}})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eQ===ew.KP.IMAGE_EDITS&&(0,a.jsx)("div",{className:"mb-4",children:0===th.length?(0,a.jsxs)(e3,{beforeUpload:t7,accept:"image/*",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(b.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[th.map((e,t)=>(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:tv[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>t8(t),children:(0,a.jsx)(y.Z,{})})]},t)),(0,a.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(b.Z,{style:{fontSize:"24px",color:"#666"}}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,a.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>t7(e))}})]})]})}),eQ===ew.KP.TRANSCRIPTION&&(0,a.jsx)("div",{className:"mb-4",children:tC?(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,a.jsx)(d.Z,{style:{fontSize:"20px",color:"#666"}}),(0,a.jsx)("span",{className:"text-sm font-medium",children:tC.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tC.size/1024/1024).toFixed(2)," MB)"]})]}),(0,a.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:ss,children:[(0,a.jsx)(y.Z,{})," Remove"]})]}):(0,a.jsxs)(e3,{beforeUpload:e=>(tA(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(d.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),eQ===ew.KP.RESPONSES&&ty&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:ty.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tN||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:ty.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:ty.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:se,children:(0,a.jsx)(y.Z,{style:{fontSize:"12px"}})})]})}),eQ===ew.KP.CHAT&&tS&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tS.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tk||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tS.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tS.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:st,children:(0,a.jsx)(y.Z,{style:{fontSize:"12px"}})})]})}),eQ===ew.KP.RESPONSES&&tF.enabled&&(0,a.jsxs)("div",{className:"mb-2 space-y-2",children:[(0,a.jsxs)("div",{className:"px-3 py-2 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg border border-blue-200 flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:e7?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{className:"text-blue-500",spin:!0}),(0,a.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Running Python code..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{className:"text-blue-500"}),(0,a.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Code Interpreter Active"})]})}),(0,a.jsx)("button",{className:"text-xs text-blue-500 hover:text-blue-700",onClick:()=>tF.setEnabled(!1),children:"Disable"})]}),!e7&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:["Generate sample sales data CSV and create a chart","Create a PNG bar chart comparing AI gateway providers including LiteLLM","Generate a CSV of LLM pricing data and visualize it as a line chart"].map((e,t)=>(0,a.jsx)("button",{className:"text-xs px-3 py-1.5 bg-white border border-gray-200 rounded-full hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 transition-colors",onClick:()=>ek(e),children:e},t))})]}),0===eI.length&&!e7&&(0,a.jsx)("div",{className:"flex items-center gap-2 mb-3 overflow-x-auto",children:(eQ===ew.KP.A2A_AGENTS?["What can you help me with?","Tell me about yourself","What tasks can you perform?"]:["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"]).map(e=>(0,a.jsx)("button",{type:"button",className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 cursor-pointer",onClick:()=>ek(e),children:e},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 mr-2 flex items-center gap-1",children:[eQ===ew.KP.RESPONSES&&!ty&&(0,a.jsx)(e0,{responsesUploadedImage:ty,responsesImagePreviewUrl:tN,onImageUpload:e=>(tj(e),tw(URL.createObjectURL(e)),!1),onRemoveImage:se}),eQ===ew.KP.CHAT&&!tS&&(0,a.jsx)(eC.Z,{chatUploadedImage:tS,chatImagePreviewUrl:tk,onImageUpload:e=>(t_(e),tP(URL.createObjectURL(e)),!1),onRemoveImage:st}),eQ===ew.KP.RESPONSES&&(0,a.jsx)(I.Z,{title:tF.enabled?"Code Interpreter enabled (click to disable)":"Enable Code Interpreter",children:(0,a.jsx)("button",{className:"p-1.5 rounded-md transition-colors ".concat(tF.enabled?"bg-blue-100 text-blue-600":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"),onClick:()=>{tF.toggle(),tF.enabled||B.Z.success("Code Interpreter enabled!")},children:(0,a.jsx)(f.Z,{style:{fontSize:"16px"}})})})]}),(0,a.jsx)(e4,{value:eS,onChange:e=>ek(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),sa())},placeholder:eQ===ew.KP.CHAT||eQ===ew.KP.EMBEDDINGS||eQ===ew.KP.RESPONSES||eQ===ew.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eQ===ew.KP.A2A_AGENTS?"Send a message to the A2A agent...":eQ===ew.KP.IMAGE_EDITS?"Describe how you want to edit the image...":eQ===ew.KP.SPEECH?"Enter text to convert to speech...":eQ===ew.KP.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:e7,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,a.jsx)(w.zx,{onClick:sa,disabled:e7||(eQ===ew.KP.TRANSCRIPTION?!tC:!eS.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,a.jsx)(N.Z,{style:{fontSize:"14px"}})})]}),e7&&(0,a.jsx)(w.zx,{onClick:()=>{e9.current&&(e9.current.abort(),e9.current=null,e8(!1),B.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:y.Z,children:"Cancel"})]})]})]})]})}),(0,a.jsxs)(Z.Z,{title:"Generated Code",visible:tI,onCancel:()=>tE(!1),footer:null,width:800,children:[(0,a.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(w.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,a.jsx)(P.default,{value:tL,onChange:e=>tR(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,a.jsx)(C.ZP,{onClick:()=>{navigator.clipboard.writeText(tZ),B.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,a.jsx)(R.Z,{language:"python",style:O.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tZ})]})]})}},94331:function(e,t,s){var a=s(57437),r=s(2265),l=s(5545),o=s(62831),n=s(17906),i=s(57365),c=s(83322),d=s(70464),m=s(77565);t.Z=e=>{let{reasoningContent:t}=e,[s,u]=(0,r.useState)(!0);return t?(0,a.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,a.jsxs)(l.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!s),icon:(0,a.jsx)(c.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,a.jsx)(d.Z,{className:"ml-1"}):(0,a.jsx)(m.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,a.jsx)(o.UG,{components:{code(e){let{node:t,inline:s,className:r,children:l,...o}=e,c=/language-(\w+)/.exec(r||"");return!s&&c?(0,a.jsx)(n.Z,{style:i.Z,language:c[1],PreTag:"div",className:"rounded-md my-2",...o,children:String(l).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...o,children:l})}},children:t})})]}):null}},38398:function(e,t,s){var a=s(57437);s(2265);var r=s(99981),l=s(5540),o=s(71282),n=s(11741),i=s(83322),c=s(16601),d=s(62670),m=s(58630);t.Z=e=>{let{timeToFirstToken:t,totalLatency:s,usage:u,toolName:x}=e;return t||s||u?(0,a.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,a.jsx)(r.Z,{title:"Time to first token",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["TTFT: ",(t/1e3).toFixed(2),"s"]})]})}),void 0!==s&&(0,a.jsx)(r.Z,{title:"Total latency",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total Latency: ",(s/1e3).toFixed(2),"s"]})]})}),(null==u?void 0:u.promptTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Prompt tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(o.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),(null==u?void 0:u.completionTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Completion tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),(null==u?void 0:u.reasoningTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Reasoning tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),(null==u?void 0:u.totalTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Total tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),(null==u?void 0:u.cost)!==void 0&&(0,a.jsx)(r.Z,{title:"Cost",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),x&&(0,a.jsx)(r.Z,{title:"Tool used",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Tool: ",x]})]})})]}):null}},33152:function(e,t,s){s.d(t,{J:function(){return d}});var a=s(57437),r=s(2265),l=s(5545),o=s(44625),n=s(70464),i=s(77565),c=s(38434);function d(e){let{searchResults:t}=e,[s,d]=(0,r.useState)(!0),[m,u]=(0,r.useState)({});if(!t||0===t.length)return null;let x=(e,t)=>{let s="".concat(e,"-").concat(t);u(e=>({...e,[s]:!e[s]}))},g=t.reduce((e,t)=>e+t.data.length,0);return(0,a.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,a.jsxs)(l.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!s),icon:(0,a.jsx)(o.Z,{}),children:[s?"Hide sources":"Show sources (".concat(g,")"),s?(0,a.jsx)(n.Z,{className:"ml-1"}):(0,a.jsx)(i.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium",children:"Query:"}),(0,a.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,a.jsx)("span",{className:"text-gray-400",children:"•"}),(0,a.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,a.jsx)("div",{className:"space-y-2",children:e.data.map((e,s)=>{let r=m["".concat(t,"-").concat(s)]||!1;return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>x(t,s),children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ".concat(r?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)(c.Z,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||"Result ".concat(s+1)}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),r&&(0,a.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},t)),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,a.jsxs)("span",{className:"text-gray-500 font-medium",children:[t,":"]}),(0,a.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},t)})})]})]})})]},s)})})]},t))})})]})}},26832:function(e,t,s){s.d(t,{O:function(){return o},m:function(){return n}});var a=s(93837),r=s(19250);let l=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status){var s;if(t.status={state:e.status.state,timestamp:e.status.timestamp},null===(s=e.status.message)||void 0===s?void 0:s.parts){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},o=async(e,t,s,o,n,i,c,d,m)=>{let u=m||(0,r.getProxyBaseUrl)(),x=u?"".concat(u,"/a2a/").concat(e,"/message/send"):"/a2a/".concat(e,"/message/send"),g=(0,a.Z)(),p=(0,a.Z)().replace(/-/g,""),h=performance.now();try{var f,v,b;let a=await fetch(x,{method:"POST",headers:{[(0,r.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:g,method:"message/send",params:{message:{kind:"message",messageId:p,role:"user",parts:[{kind:"text",text:t}]}}}),signal:n}),m=performance.now()-h;if(i&&i(m),!a.ok){let e=await a.json();throw Error((null===(f=e.error)||void 0===f?void 0:f.message)||e.detail||"HTTP ".concat(a.status))}let u=await a.json(),y=performance.now()-h;if(c&&c(y),u.error)throw Error(u.error.message);let j=u.result;if(j){let t="",a=l(j);if(a&&d&&d(a),j.artifacts&&Array.isArray(j.artifacts)){for(let e of j.artifacts)if(e.parts&&Array.isArray(e.parts))for(let s of e.parts)"text"===s.kind&&s.text&&(t+=s.text)}else if(j.parts&&Array.isArray(j.parts))for(let e of j.parts)"text"===e.kind&&e.text&&(t+=e.text);else if(null===(b=j.status)||void 0===b?void 0:null===(v=b.message)||void 0===v?void 0:v.parts)for(let e of j.status.message.parts)"text"===e.kind&&e.text&&(t+=e.text);t?s(t,"a2a_agent/".concat(e)):(console.warn("Could not extract text from A2A response, showing raw JSON:",j),s(JSON.stringify(j,null,2),"a2a_agent/".concat(e)))}}catch(e){if(null==n?void 0:n.aborted){console.log("A2A request was cancelled");return}throw console.error("A2A send message error:",e),e}},n=async(e,t,s,o,n,i,c,d,m)=>{let u;let x=m||(0,r.getProxyBaseUrl)(),g=x?"".concat(x,"/a2a/").concat(e):"/a2a/".concat(e),p=(0,a.Z)(),h=(0,a.Z)().replace(/-/g,""),f=performance.now(),v=!1,b="";try{var y,j;let a=await fetch(g,{method:"POST",headers:{[(0,r.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:p,method:"message/stream",params:{message:{kind:"message",messageId:h,role:"user",parts:[{kind:"text",text:t}]}}}),signal:n});if(!a.ok){let e=await a.json();throw Error((null===(j=e.error)||void 0===j?void 0:j.message)||e.detail||"HTTP ".concat(a.status))}let m=null===(y=a.body)||void 0===y?void 0:y.getReader();if(!m)throw Error("No response body");let x=new TextDecoder,N="",w=!1;for(;!w;){let t=await m.read();w=t.done;let a=t.value;if(w)break;let r=(N+=x.decode(a,{stream:!0})).split("\n");for(let t of(N=r.pop()||"",r))if(t.trim())try{let a=JSON.parse(t);if(!v){v=!0;let e=performance.now()-f;i&&i(e)}let r=a.result;if(r){let t=l(r);t&&(u={...u,...t});let a=r.kind;if("artifact-update"===a&&r.artifact){let t=r.artifact;if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(b+=a.text,s(b,"a2a_agent/".concat(e)))}else if(r.artifacts&&Array.isArray(r.artifacts)){for(let t of r.artifacts)if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(b+=a.text,s(b,"a2a_agent/".concat(e)))}else if("status-update"===a);else if(r.parts&&Array.isArray(r.parts))for(let t of r.parts)"text"===t.kind&&t.text&&(b+=t.text,s(b,"a2a_agent/".concat(e)))}if(a.error){let e=a.error.message||"Unknown A2A error";throw Error(e)}}catch(e){if(e instanceof Error&&e.message&&!e.message.includes("JSON"))throw e;t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let S=performance.now()-f;c&&c(S),u&&d&&d(u)}catch(e){if(null==n?void 0:n.aborted){console.log("A2A streaming request was cancelled");return}throw console.error("A2A stream message error:",e),e}}},95459:function(e,t,s){s.d(t,{n:function(){return l}});var a=s(7271),r=s(19250);async function l(e,t,s,l,o,n,i,c,d,m,u,x,g,p,h,f,v,b,y,j,N,w,S){console.log=function(){},console.log("isLocal:",!1);let _=j||(0,r.getProxyBaseUrl)(),k={};o&&o.length>0&&(k["x-litellm-tags"]=o.join(","));let P=new a.ZP.OpenAI({apiKey:l,baseURL:_,dangerouslyAllowBrowser:!0,defaultHeaders:k});try{let a;let r=Date.now(),l=!1,o={},j=!1,_=[];for await(let y of(p&&p.length>0&&(p.includes("__all__")?_.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):p.forEach(e=>{let t=null==N?void 0:N.find(t=>t.server_id===e),s=(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,a=(null==w?void 0:w[e])||[];_.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp/".concat(s),require_approval:"never",...a.length>0?{allowed_tools:a}:{}})})),await P.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:m,messages:e,...u?{vector_store_ids:u}:{},...x?{guardrails:x}:{},...g?{policies:g}:{},..._.length>0?{tools:_,tool_choice:"auto"}:{},...void 0!==v?{temperature:v}:{},...void 0!==b?{max_tokens:b}:{}},{signal:n}))){var C,A,I,E,Z,T,L,R,O;console.log("Stream chunk:",y);let e=null===(C=y.choices[0])||void 0===C?void 0:C.delta;if(console.log("Delta content:",null===(I=y.choices[0])||void 0===I?void 0:null===(A=I.delta)||void 0===A?void 0:A.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!l&&((null===(Z=y.choices[0])||void 0===Z?void 0:null===(E=Z.delta)||void 0===E?void 0:E.content)||e&&e.reasoning_content)&&(l=!0,a=Date.now()-r,console.log("First token received! Time:",a,"ms"),c?(console.log("Calling onTimingData with:",a),c(a)):console.log("onTimingData callback is not defined!")),null===(L=y.choices[0])||void 0===L?void 0:null===(T=L.delta)||void 0===T?void 0:T.content){let e=y.choices[0].delta.content;t(e,y.model)}if(e&&e.image&&h&&(console.log("Image generated:",e.image),h(e.image.url,y.model)),e&&e.reasoning_content){let t=e.reasoning_content;i&&i(t)}if(e&&(null===(R=e.provider_specific_fields)||void 0===R?void 0:R.search_results)&&f&&(console.log("Search results found:",e.provider_specific_fields.search_results),f(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!o.mcp_list_tools&&(o.mcp_list_tools=t.mcp_list_tools,S&&!j)){j=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>{var t,s,a;return{name:(null===(t=e.function)||void 0===t?void 0:t.name)||e.name||"",description:(null===(s=e.function)||void 0===s?void 0:s.description)||e.description||"",input_schema:(null===(a=e.function)||void 0===a?void 0:a.parameters)||e.input_schema||{}}})},timestamp:Date.now()};S(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(o.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(o.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(y.usage&&d){console.log("Usage data found:",y.usage);let e={completionTokens:y.usage.completion_tokens,promptTokens:y.usage.prompt_tokens,totalTokens:y.usage.total_tokens};(null===(O=y.usage.completion_tokens_details)||void 0===O?void 0:O.reasoning_tokens)&&(e.reasoningTokens=y.usage.completion_tokens_details.reasoning_tokens),void 0!==y.usage.cost&&null!==y.usage.cost&&(e.cost=parseFloat(y.usage.cost)),d(e)}}S&&(o.mcp_tool_calls||o.mcp_call_results)&&o.mcp_tool_calls&&o.mcp_tool_calls.length>0&&o.mcp_tool_calls.forEach((e,t)=>{var s,a,r,l;let n=(null===(s=e.function)||void 0===s?void 0:s.name)||e.name||"",i=(null===(a=e.function)||void 0===a?void 0:a.arguments)||e.arguments||"{}",c=(null===(r=o.mcp_call_results)||void 0===r?void 0:r.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id))||(null===(l=o.mcp_call_results)||void 0===l?void 0:l[t]),d={type:"response.output_item.done",item:{type:"mcp_call",name:n,arguments:"string"==typeof i?i:JSON.stringify(i),output:(null==c?void 0:c.result)?"string"==typeof c.result?c.result:JSON.stringify(c.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};S(d),console.log("MCP call event sent:",d)});let k=Date.now();y&&y(k-r)}catch(e){throw(null==n?void 0:n.aborted)&&console.log("Chat completion request was cancelled"),e}}},91643:function(e,t,s){s.d(t,{o:function(){return r}});var a=s(19250);let r=async(e,t)=>{try{let s=t||(0,a.getProxyBaseUrl)(),r=await fetch(s?"".concat(s,"/v1/agents"):"/v1/agents",{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to fetch agents")}let l=await r.json();return console.log("Fetched agents:",l),l.sort((e,t)=>{let s=e.agent_name||e.agent_id,a=t.agent_name||t.agent_id;return s.localeCompare(a)}),l}catch(e){throw console.error("Error fetching agents:",e),e}}},99020:function(e,t,s){var a=s(57437),r=s(2265),l=s(37592),o=s(19250);t.Z=e=>{let{onChange:t,value:s,className:n,accessToken:i}=e,[c,d]=(0,r.useState)([]),[m,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(i)try{let e=await (0,o.tagListCall)(i);console.log("List tags response:",e),d(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{u(!1)}})()},[i]),(0,a.jsx)(l.default,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:t,value:s,loading:m,className:n,options:c.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5992],{19046:function(e,t,s){s.d(t,{Dx:function(){return n.Z},Zb:function(){return r.Z},oi:function(){return o.Z},xv:function(){return l.Z},zx:function(){return a.Z}});var a=s(78489),r=s(12514),l=s(84264),o=s(49566),n=s(96761)},88712:function(e,t,s){var a=s(57437);s(2265);var r=s(33145),l=s(66830),o=s(50010);t.Z=e=>{let{message:t}=e;if(!(0,l.br)(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(o.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)(r.default,{src:t.imagePreviewUrl||"",alt:"User uploaded image",width:256,height:200,className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px",width:"auto",height:"auto"}})})}},27930:function(e,t,s){var a=s(57437);s(2265);var r=s(65319),l=s(99981),o=s(53508);let{Dragger:n}=r.default;t.Z=e=>{let{chatUploadedImage:t,chatImagePreviewUrl:s,onImageUpload:r,onRemoveImage:i}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(n,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(l.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(o.Z,{style:{fontSize:"16px"}})})})})})}},66830:function(e,t,s){s.d(t,{Hk:function(){return l},Sn:function(){return r},br:function(){return o}});let a=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result)},a.onerror=s,a.readAsDataURL(e)}),r=async(e,t)=>({role:"user",content:[{type:"text",text:e},{type:"image_url",image_url:{url:await a(t)}}]}),l=(e,t,s,a)=>{let r="";t&&a&&(r=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let l={role:"user",content:t?"".concat(e," ").concat(r):e};return t&&s&&(l.imagePreviewUrl=s),l},o=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl},25992:function(e,t,s){s.d(t,{Z:function(){return e6}});var a=s(57437),r=s(61935),l=s(92403),o=s(55322),n=s(62272),i=s(26430),c=s(12660),d=s(25980),m=s(69993),u=s(71891),x=s(58630),g=s(15424),p=s(44625),h=s(57400),f=s(11894),v=s(15883),b=s(99890),y=s(26349),j=s(50010),N=s(79276),w=s(19046),S=s(4260),_=s(65319),k=s(57840),P=s(37592),C=s(5545),A=s(79326),I=s(99981),E=s(10353),Z=s(22116),T=s(2265),L=s(62831),R=s(17906),O=s(94263),U=s(93837),M=s(9309),K=s(67479),D=s(87972),B=s(9114),z=s(19250),H=s(99020),F=s(97415),G=s(26832),W=s(85498);async function J(e,t,s,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,n=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=(arguments.length>13&&arguments[13],arguments.length>14?arguments[14]:void 0);if(!a)throw Error("Virtual Key is required");console.log=function(){};let g=x||(0,z.getProxyBaseUrl)(),p={};r&&r.length>0&&(p["x-litellm-tags"]=r.join(","));let h=new W.ZP({apiKey:a,baseURL:g,dangerouslyAllowBrowser:!0,defaultHeaders:p});try{let a=Date.now(),r=!1,x={model:s,messages:e.map(e=>({role:e.role,content:e.content})),stream:!0,max_tokens:1024,litellm_trace_id:c};for await(let e of(d&&(x.vector_store_ids=d),m&&(x.guardrails=m),u&&(x.policies=u),h.messages.stream(x,{signal:l}))){if(console.log("Stream event:",e),"content_block_delta"===e.type){let l=e.delta;if(!r){r=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),n&&n(e)}"text_delta"===l.type?t("assistant",l.text,s):"reasoning_delta"===l.type&&o&&o(l.text)}if("message_delta"===e.type&&e.usage&&i){let t=e.usage;console.log("Usage data found:",t);let s={completionTokens:t.output_tokens,promptTokens:t.input_tokens,totalTokens:t.input_tokens+t.output_tokens};i(s)}}}catch(e){throw(null==l?void 0:l.aborted)?console.log("Anthropic messages request was cancelled"):B.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var q=s(7271);async function V(e,t,s,a,r,l,o,n,i,c){console.log=function(){},console.log("isLocal:",!1);let d=c||(0,z.getProxyBaseUrl)(),m=new q.ZP.OpenAI({apiKey:r,baseURL:d,dangerouslyAllowBrowser:!0,defaultHeaders:l&&l.length>0?{"x-litellm-tags":l.join(",")}:void 0});try{let r=await m.audio.speech.create({model:a,input:e,voice:t,...n?{response_format:n}:{},...i?{speed:i}:{}},{signal:o}),l=await r.blob(),c=URL.createObjectURL(l);s(c,a)}catch(e){throw(null==o?void 0:o.aborted)?console.log("Audio speech request was cancelled"):B.Z.fromBackend("Error occurred while generating speech. Please try again. Error: ".concat(e)),e}}async function Y(e,t,s,a,r,l,o,n,i,c,d){console.log=function(){},console.log("isLocal:",!1);let m=d||(0,z.getProxyBaseUrl)(),u=new q.ZP.OpenAI({apiKey:a,baseURL:m,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{console.log("Processing audio file for transcription:",e.name);let a=await u.audio.transcriptions.create({model:s,file:e,...o?{language:o}:{},...n?{prompt:n}:{},...i?{response_format:i}:{},...void 0!==c?{temperature:c}:{}},{signal:l});if(console.log("Transcription response:",a),a&&a.text)t(a.text,s),B.Z.success("Audio transcribed successfully");else throw Error("No transcription text in response")}catch(e){if(console.error("Error making audio transcription request:",e),null==l?void 0:l.aborted)console.log("Audio transcription request was cancelled");else{var x;let t="Failed to transcribe audio";(null==e?void 0:null===(x=e.error)||void 0===x?void 0:x.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),B.Z.fromBackend("Audio transcription failed: ".concat(t))}throw e}}var X=s(95459);async function $(e,t,s,a,r,l){if(!a)throw Error("Virtual Key is required");console.log=function(){};let o=l||(0,z.getProxyBaseUrl)(),n={};r&&r.length>0&&(n["x-litellm-tags"]=r.join(","));try{var i,c,d;let r=o.endsWith("/")?o.slice(0,-1):o,l=await fetch("".concat(r,"/embeddings"),{method:"POST",headers:{"Content-Type":"application/json",[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(a),...n},body:JSON.stringify({model:s,input:e})});if(!l.ok){let e=await l.text();throw Error(e||"Request failed with status ".concat(l.status))}let m=await l.json(),u=null==m?void 0:null===(c=m.data)||void 0===c?void 0:null===(i=c[0])||void 0===i?void 0:i.embedding;if(!u)throw Error("No embedding returned from server");t(JSON.stringify(u),null!==(d=null==m?void 0:m.model)&&void 0!==d?d:s)}catch(e){throw B.Z.fromBackend("Error occurred while making embeddings request. Please try again. Error: ".concat(e)),e}}var Q=s(91643),ee=s(10703);async function et(e,t,s,a,r,l,o,n){console.log=function(){},console.log("isLocal:",!1);let i=n||(0,z.getProxyBaseUrl)(),c=new q.ZP.OpenAI({apiKey:r,baseURL:i,dangerouslyAllowBrowser:!0,defaultHeaders:l&&l.length>0?{"x-litellm-tags":l.join(",")}:void 0});try{let r=Array.isArray(e)?e:[e],l=[];for(let e=0;e1&&B.Z.success("Successfully processed ".concat(l.length," images"))}catch(e){if(console.error("Error making image edit request:",e),null==o?void 0:o.aborted)console.log("Image edits request was cancelled");else{var d;let t="Failed to edit image(s)";(null==e?void 0:null===(d=e.error)||void 0===d?void 0:d.message)?t=e.error.message:(null==e?void 0:e.message)&&(t=e.message),B.Z.fromBackend("Image edit failed: ".concat(t))}throw e}}async function es(e,t,s,a,r,l,o){console.log=function(){},console.log("isLocal:",!1);let n=o||(0,z.getProxyBaseUrl)(),i=new q.ZP.OpenAI({apiKey:a,baseURL:n,dangerouslyAllowBrowser:!0,defaultHeaders:r&&r.length>0?{"x-litellm-tags":r.join(",")}:void 0});try{let a=await i.images.generate({model:s,prompt:e},{signal:l});if(console.log(a.data),a.data&&a.data[0]){if(a.data[0].url)t(a.data[0].url,s);else if(a.data[0].b64_json){let e=a.data[0].b64_json;t("data:image/png;base64,".concat(e),s)}else throw Error("No image data found in response")}else throw Error("Invalid response format")}catch(e){throw(null==l?void 0:l.aborted)?console.log("Image generation request was cancelled"):B.Z.fromBackend("Error occurred while generating image. Please try again. Error: ".concat(e)),e}}async function ea(e,t,s,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,n=arguments.length>7?arguments[7]:void 0,i=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,d=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,u=arguments.length>12?arguments[12]:void 0,x=arguments.length>13?arguments[13]:void 0,g=arguments.length>14?arguments[14]:void 0,p=arguments.length>15?arguments[15]:void 0,h=arguments.length>16?arguments[16]:void 0,f=arguments.length>17?arguments[17]:void 0,v=arguments.length>18?arguments[18]:void 0,b=arguments.length>19?arguments[19]:void 0,y=arguments.length>20?arguments[20]:void 0,j=arguments.length>21?arguments[21]:void 0;if(!a)throw Error("Virtual Key is required");if(!s||""===s.trim())throw Error("Model is required. Please select a model before sending a request.");console.log=function(){};let N=b||(0,z.getProxyBaseUrl)(),w={};r&&r.length>0&&(w["x-litellm-tags"]=r.join(","));let S=new q.ZP.OpenAI({apiKey:a,baseURL:N,dangerouslyAllowBrowser:!0,defaultHeaders:w});try{let a=Date.now(),r=!1,b=e.map(e=>(Array.isArray(e.content),{role:e.role,content:e.content,type:"message"})),N=[];x&&x.length>0&&(x.includes("__all__")?N.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):x.forEach(e=>{let t=null==y?void 0:y.find(t=>t.server_id===e),s=(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,a=(null==j?void 0:j[e])||[];N.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp/".concat(s),require_approval:"never",...a.length>0?{allowed_tools:a}:{}})})),f&&N.push({type:"code_interpreter",container:{type:"auto"}});let w=await S.responses.create({model:s,input:b,stream:!0,litellm_trace_id:c,...g?{previous_response_id:g}:{},...d?{vector_store_ids:d}:{},...m?{guardrails:m}:{},...u?{policies:u}:{},...N.length>0?{tools:N,tool_choice:"auto"}:{}},{signal:l}),Z="",T={code:"",containerId:""};for await(let e of w)if(console.log("Response event:",e),"object"==typeof e&&null!==e){var _,k,P,C,A,I,E;if(((null===(_=e.type)||void 0===_?void 0:_.startsWith("response.mcp_"))||"response.output_item.done"===e.type&&((null===(k=e.item)||void 0===k?void 0:k.type)==="mcp_list_tools"||(null===(P=e.item)||void 0===P?void 0:P.type)==="mcp_call"))&&(console.log("MCP event received:",e),h)){let t={type:e.type,sequence_number:e.sequence_number,output_index:e.output_index,item_id:e.item_id||(null===(I=e.item)||void 0===I?void 0:I.id),item:e.item,delta:e.delta,arguments:e.arguments,timestamp:Date.now()};h(t)}if("response.output_item.done"===e.type&&(null===(C=e.item)||void 0===C?void 0:C.type)==="mcp_call"&&(null===(A=e.item)||void 0===A?void 0:A.name)&&(Z=e.item.name,console.log("MCP tool used:",Z)),T=function(e,t){var s;return"response.output_item.done"===e.type&&(null===(s=e.item)||void 0===s?void 0:s.type)==="code_interpreter_call"?(console.log("Code interpreter call completed:",e.item),{code:e.item.code||"",containerId:e.item.container_id||""}):t}(e,T),!function(e,t,s){var a,r;if("response.output_item.done"===e.type&&(null===(a=e.item)||void 0===a?void 0:a.type)==="message"&&(null===(r=e.item)||void 0===r?void 0:r.content)&&s){for(let a of e.item.content)if("output_text"===a.type&&a.annotations){let e=a.annotations.filter(e=>"container_file_citation"===e.type);(e.length>0||t.code)&&s({code:t.code,containerId:t.containerId,annotations:e})}}}(e,T,v),"response.role.delta"===e.type)continue;if("response.output_text.delta"===e.type&&"string"==typeof e.delta){let l=e.delta;if(console.log("Text delta",l),l.trim().length>0&&(t("assistant",l,s),!r)){r=!0;let e=Date.now()-a;console.log("First token received! Time:",e,"ms"),n&&n(e)}}if("response.reasoning.delta"===e.type&&"delta"in e){let t=e.delta;"string"==typeof t&&o&&o(t)}if("response.completed"===e.type&&"response"in e){let t=e.response,s=t.usage;if(console.log("Usage data:",s),console.log("Response completed event:",t),t.id&&p&&(console.log("Response ID for session management:",t.id),p(t.id)),s&&i){console.log("Usage data:",s);let e={completionTokens:s.output_tokens,promptTokens:s.input_tokens,totalTokens:s.total_tokens};(null===(E=s.completion_tokens_details)||void 0===E?void 0:E.reasoning_tokens)&&(e.reasoningTokens=s.completion_tokens_details.reasoning_tokens),i(e,Z)}}}return w}catch(e){throw(null==l?void 0:l.aborted)?console.log("Responses API request was cancelled"):B.Z.fromBackend("Error occurred while generating model response. Please try again. Error: ".concat(e)),e}}var er=s(83669),el=s(29271),eo=s(5540),en=s(38434),ei=s(23639),ec=s(70464),ed=s(77565);let em=e=>{switch(e){case"completed":return(0,a.jsx)(er.Z,{className:"text-green-500"});case"working":case"submitted":return(0,a.jsx)(r.Z,{className:"text-blue-500"});case"failed":case"canceled":return(0,a.jsx)(el.Z,{className:"text-red-500"});default:return(0,a.jsx)(eo.Z,{className:"text-gray-500"})}},eu=e=>{switch(e){case"completed":return"bg-green-100 text-green-700";case"working":case"submitted":return"bg-blue-100 text-blue-700";case"failed":case"canceled":return"bg-red-100 text-red-700";default:return"bg-gray-100 text-gray-700"}},ex=e=>{if(!e)return null;try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch(t){return e}},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.length>t?"".concat(e.substring(0,t),"…"):e:null},ep=e=>{navigator.clipboard.writeText(e)};var eh=e=>{let{a2aMetadata:t,timeToFirstToken:s,totalLatency:r}=e,[l,o]=(0,T.useState)(!1);if(!t&&!s&&!r)return null;let{taskId:i,contextId:c,status:d,metadata:u}=t||{},x=ex(null==d?void 0:d.timestamp);return(0,a.jsxs)("div",{className:"a2a-metrics mt-3 pt-2 border-t border-gray-200 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2 text-gray-600",children:[(0,a.jsx)(m.Z,{className:"mr-1.5 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"A2A Metadata"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-gray-500 ml-4",children:[(null==d?void 0:d.state)&&(0,a.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat(eu(d.state)),children:[em(d.state),(0,a.jsx)("span",{className:"ml-1 capitalize",children:d.state})]}),x&&(0,a.jsx)(I.Z,{title:null==d?void 0:d.timestamp,children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(eo.Z,{className:"mr-1"}),x]})}),void 0!==r&&(0,a.jsx)(I.Z,{title:"Total latency",children:(0,a.jsxs)("span",{className:"flex items-center text-blue-600",children:[(0,a.jsx)(eo.Z,{className:"mr-1"}),(r/1e3).toFixed(2),"s"]})}),void 0!==s&&(0,a.jsx)(I.Z,{title:"Time to first token",children:(0,a.jsxs)("span",{className:"flex items-center text-green-600",children:["TTFT: ",(s/1e3).toFixed(2),"s"]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-gray-500 ml-4 mt-1.5",children:[i&&(0,a.jsx)(I.Z,{title:"Click to copy: ".concat(i),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>ep(i),children:[(0,a.jsx)(en.Z,{className:"mr-1"}),"Task: ",eg(i),(0,a.jsx)(ei.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),c&&(0,a.jsx)(I.Z,{title:"Click to copy: ".concat(c),children:(0,a.jsxs)("span",{className:"flex items-center cursor-pointer hover:text-gray-700",onClick:()=>ep(c),children:[(0,a.jsx)(n.Z,{className:"mr-1"}),"Session: ",eg(c),(0,a.jsx)(ei.Z,{className:"ml-1 text-gray-400 hover:text-gray-600"})]})}),(u||(null==d?void 0:d.message))&&(0,a.jsxs)(C.ZP,{type:"text",size:"small",className:"text-xs text-blue-500 hover:text-blue-700 p-0 h-auto",onClick:()=>o(!l),children:[l?(0,a.jsx)(ec.Z,{}):(0,a.jsx)(ed.Z,{}),(0,a.jsx)("span",{className:"ml-1",children:"Details"})]})]}),l&&(0,a.jsxs)("div",{className:"mt-2 ml-4 p-3 bg-gray-50 rounded-md text-gray-600 border border-gray-200",children:[(null==d?void 0:d.message)&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Status Message:"}),(0,a.jsx)("span",{className:"ml-2",children:d.message})]}),i&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Task ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:i}),(0,a.jsx)(ei.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>ep(i)})]}),c&&(0,a.jsxs)("div",{className:"mb-1.5 flex items-center",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700 w-24",children:"Session ID:"}),(0,a.jsx)("code",{className:"ml-2 px-2 py-1 bg-white border border-gray-200 rounded text-xs font-mono",children:c}),(0,a.jsx)(ei.Z,{className:"ml-2 cursor-pointer text-gray-400 hover:text-blue-500",onClick:()=>ep(c)})]}),u&&Object.keys(u).length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Custom Metadata:"}),(0,a.jsx)("pre",{className:"mt-1.5 p-2 bg-white border border-gray-200 rounded text-xs font-mono overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(u,null,2)})]})]})]})},ef=s(92280),ev=s(61994),eb=s(19015),ey=s(85847),ej=e=>{let{temperature:t=1,maxTokens:s=2048,useAdvancedParams:r,onTemperatureChange:l,onMaxTokensChange:o,onUseAdvancedParamsChange:n}=e,[i,c]=(0,T.useState)(!1),d=void 0!==r?r:i,[m,u]=(0,T.useState)(t),[x,p]=(0,T.useState)(s);(0,T.useEffect)(()=>{u(t)},[t]),(0,T.useEffect)(()=>{p(s)},[s]);let h=e=>{let t=null!=e?e:1;u(t),null==l||l(t)},f=e=>{let t=null!=e?e:1e3;p(t),null==o||o(t)},v=d?"text-gray-700":"text-gray-400",b=e=>{n?n(e):c(e)};return(0,a.jsxs)("div",{className:"space-y-4 p-4 w-80",children:[(0,a.jsx)(ev.Z,{checked:d,onChange:e=>b(e.target.checked),children:(0,a.jsx)("span",{className:"font-medium",children:"Use Advanced Parameters"})}),(0,a.jsxs)("div",{className:"space-y-4 transition-opacity duration-200",style:{opacity:d?1:.4},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(ef.x,{className:"text-sm ".concat(v),children:"Temperature"}),(0,a.jsx)(I.Z,{title:"Controls randomness. Lower values make output more deterministic, higher values more creative.",children:(0,a.jsx)(g.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(eb.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,precision:1,className:"w-20"})]}),(0,a.jsx)(ey.Z,{min:0,max:2,step:.1,value:m,onChange:h,disabled:!d,marks:{0:"0",1:"1.0",2:"2.0"}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(ef.x,{className:"text-sm ".concat(v),children:"Max Tokens"}),(0,a.jsx)(I.Z,{title:"Maximum number of tokens to generate in the response.",children:(0,a.jsx)(g.Z,{className:"text-xs ".concat(v," cursor-help")})})]}),(0,a.jsx)(eb.Z,{min:1,max:32768,step:1,value:x,onChange:f,disabled:!d})]}),(0,a.jsx)(ey.Z,{min:1,max:32768,step:1,value:x,onChange:f,disabled:!d,marks:{1:"1",32768:"32768"}})]})]})]})},eN=e=>{let{message:t}=e;return t.isAudio&&"string"==typeof t.content?(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("audio",{controls:!0,src:t.content,className:"max-w-full",style:{maxWidth:"500px"},children:"Your browser does not support the audio element."})}):null},ew=s(8443);let eS={ALLOY:"Alloy - Professional and confident",ASH:"Ash - Casual and relaxed",BALAD:"Ballad - Smooth and melodic",CORAL:"Coral - Warm and engaging",ECHO:"Echo - Friendly and conversational",FABLE:"Fable - Wise and measured",NOVA:"Nova - Friendly and conversational",ONYX:"Onyx - Deep and authoritative",SAGE:"Sage - Wise and measured",SHIMMER:"Shimmer - Bright and cheerful"},e_=Object.entries({ALLOY:"alloy",ASH:"ash",BALAD:"ballad",CORAL:"coral",ECHO:"echo",FABLE:"fable",NOVA:"nova",ONYX:"onyx",SAGE:"sage",SHIMMER:"shimmer"}).map(e=>{let[t,s]=e;return{value:s,label:eS[t]}}),ek=[{value:ew.KP.CHAT,label:"/v1/chat/completions"},{value:ew.KP.RESPONSES,label:"/v1/responses"},{value:ew.KP.ANTHROPIC_MESSAGES,label:"/v1/messages"},{value:ew.KP.IMAGE,label:"/v1/images/generations"},{value:ew.KP.IMAGE_EDITS,label:"/v1/images/edits"},{value:ew.KP.EMBEDDINGS,label:"/v1/embeddings"},{value:ew.KP.SPEECH,label:"/v1/audio/speech"},{value:ew.KP.TRANSCRIPTION,label:"/v1/audio/transcriptions"},{value:ew.KP.A2A_AGENTS,label:"/v1/a2a/message/send"}];var eP=s(88712),eC=s(27930),eA=s(66830),eI=s(44851),eE=s(41589),eZ=s(73879),eT=e=>{let{code:t,containerId:s,annotations:l=[],accessToken:o}=e,[n,i]=(0,T.useState)({}),[c,d]=(0,T.useState)({}),m=(0,z.getProxyBaseUrl)();(0,T.useEffect)(()=>{let e=async()=>{for(let r of l){var e,t,s,a;if(((null===(e=r.filename)||void 0===e?void 0:e.toLowerCase().endsWith(".png"))||(null===(t=r.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".jpg"))||(null===(s=r.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpeg"))||(null===(a=r.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".gif")))&&r.container_id&&r.file_id){d(e=>({...e,[r.file_id]:!0}));try{let e=await fetch("".concat(m,"/v1/containers/").concat(r.container_id,"/files/").concat(r.file_id,"/content"),{headers:{[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o)}});if(e.ok){let t=await e.blob(),s=URL.createObjectURL(t);i(e=>({...e,[r.file_id]:s}))}}catch(e){console.error("Error fetching image:",e)}finally{d(e=>({...e,[r.file_id]:!1}))}}}};return l.length>0&&o&&e(),()=>{Object.values(n).forEach(e=>URL.revokeObjectURL(e))}},[l,o,m]);let u=async e=>{try{let t=await fetch("".concat(m,"/v1/containers/").concat(e.container_id,"/files/").concat(e.file_id,"/content"),{headers:{[(0,z.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o)}});if(t.ok){let s=await t.blob(),a=URL.createObjectURL(s),r=document.createElement("a");r.href=a,r.download=e.filename||"file_".concat(e.file_id),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)}}catch(e){console.error("Error downloading file:",e)}},x=l.filter(e=>{var t,s,a,r;return(null===(t=e.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".png"))||(null===(s=e.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpg"))||(null===(a=e.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".jpeg"))||(null===(r=e.filename)||void 0===r?void 0:r.toLowerCase().endsWith(".gif"))}),g=l.filter(e=>{var t,s,a,r;return!(null===(t=e.filename)||void 0===t?void 0:t.toLowerCase().endsWith(".png"))&&!(null===(s=e.filename)||void 0===s?void 0:s.toLowerCase().endsWith(".jpg"))&&!(null===(a=e.filename)||void 0===a?void 0:a.toLowerCase().endsWith(".jpeg"))&&!(null===(r=e.filename)||void 0===r?void 0:r.toLowerCase().endsWith(".gif"))});return t||0!==l.length?(0,a.jsxs)("div",{className:"mt-3 space-y-3",children:[t&&(0,a.jsx)(eI.default,{size:"small",items:[{key:"code",label:(0,a.jsxs)("span",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(f.Z,{})," Python Code Executed"]}),children:(0,a.jsx)(R.Z,{language:"python",style:O.Z,customStyle:{margin:0,borderRadius:"6px",fontSize:"12px",maxHeight:"300px",overflow:"auto"},children:t})}]}),x.map(e=>(0,a.jsx)("div",{className:"rounded-lg border border-gray-200 overflow-hidden",children:c[e.file_id]?(0,a.jsxs)("div",{className:"flex items-center justify-center p-8 bg-gray-50",children:[(0,a.jsx)(E.Z,{indicator:(0,a.jsx)(r.Z,{spin:!0})}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:"Loading image..."})]}):n[e.file_id]?(0,a.jsxs)("div",{children:[(0,a.jsx)("img",{src:n[e.file_id],alt:e.filename||"Generated chart",className:"max-w-full",style:{maxHeight:"400px"}}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 border-t border-gray-200",children:[(0,a.jsxs)("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,a.jsx)(eE.Z,{})," ",e.filename]}),(0,a.jsxs)("button",{onClick:()=>u(e),className:"text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1",children:[(0,a.jsx)(eZ.Z,{})," Download"]})]})]}):(0,a.jsx)("div",{className:"flex items-center justify-center p-4 bg-gray-50",children:(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Image not available"})})},e.file_id)),g.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,a.jsxs)("button",{onClick:()=>u(e),className:"flex items-center gap-2 px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 transition-colors",children:[(0,a.jsx)(en.Z,{className:"text-blue-500"}),(0,a.jsx)("span",{className:"text-sm",children:e.filename}),(0,a.jsx)(eZ.Z,{className:"text-gray-400"})]},e.file_id))})]}):null},eL=s(42264),eR=s(63709);let eO=e=>{if(!e)return!1;let t=e.toLowerCase();return t.startsWith("openai/")||t.startsWith("gpt-")||t.startsWith("o1")||t.startsWith("o3")||t.includes("openai")};var eU=e=>{let{enabled:t,onEnabledChange:s,selectedModel:r,disabled:l=!1}=e,o=eO(r);return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-lg p-3 bg-gradient-to-r from-blue-50 to-purple-50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(f.Z,{className:"text-blue-500"}),(0,a.jsx)(ef.x,{className:"font-medium text-gray-700",children:"Code Interpreter"}),(0,a.jsx)(I.Z,{title:"Run Python code to generate files, charts, and analyze data. Container is created automatically.",children:(0,a.jsx)(g.Z,{className:"text-gray-400 text-xs"})})]}),(0,a.jsx)(eR.Z,{checked:t&&o,onChange:e=>{if(e&&!o){eL.ZP.warning("Code Interpreter is only available for OpenAI models");return}s(e)},disabled:l||!o,size:"small",className:t&&o?"bg-blue-500":""})]}),!o&&(0,a.jsx)("div",{className:"mt-2 pt-2 border-t border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(el.Z,{className:"text-amber-500 mt-0.5"}),(0,a.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,a.jsx)("span",{children:"Code Interpreter is currently only supported for OpenAI models. "}),(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues/new?template=feature_request.yml",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Request support for other providers"})]})]})})]})},eM=s(82971),eK=e=>{let{endpointType:t,onEndpointChange:s,className:r}=e;return(0,a.jsx)("div",{className:r,children:(0,a.jsx)(P.default,{showSearch:!0,value:t,style:{width:"100%"},onChange:s,options:ek,className:"rounded-md",filterOption:(e,t)=>{var s,a;return(null!==(s=null==t?void 0:t.label)&&void 0!==s?s:"").toLowerCase().includes(e.toLowerCase())||(null!==(a=null==t?void 0:t.value)&&void 0!==a?a:"").toLowerCase().includes(e.toLowerCase())}})})},eD=s(29),eB=s.n(eD);let{Text:ez}=k.default,{Panel:eH}=eI.default;var eF=e=>{var t,s;let{events:r,className:l}=e;if(console.log("MCPEventsDisplay: Received events:",r),!r||0===r.length)return console.log("MCPEventsDisplay: No events, returning null"),null;let o=r.find(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_list_tools"&&e.item.tools&&e.item.tools.length>0}),n=r.filter(e=>{var t;return"response.output_item.done"===e.type&&(null===(t=e.item)||void 0===t?void 0:t.type)==="mcp_call"});return(console.log("MCPEventsDisplay: toolsEvent:",o),console.log("MCPEventsDisplay: mcpCallEvents:",n),o||0!==n.length)?(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac "+"mcp-events-display ".concat(l||""),children:[(0,a.jsx)(eB(),{id:"32b14b04f420f3ac",children:'.openai-mcp-tools.jsx-32b14b04f420f3ac{position:relative;margin:0;padding:0}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse.jsx-32b14b04f420f3ac{background:transparent!important;border:none!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-item.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac{padding:0 0 0 20px!important;background:transparent!important;border:none!important;font-size:14px!important;color:#9ca3af!important;font-weight:400!important;line-height:20px!important;min-height:20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-header.jsx-32b14b04f420f3ac:hover{background:transparent!important;color:#6b7280!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content.jsx-32b14b04f420f3ac{border:none!important;background:transparent!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-content-box.jsx-32b14b04f420f3ac{padding:4px 0 0 20px!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac{position:absolute!important;left:2px!important;top:2px!important;color:#9ca3af!important;font-size:10px!important;width:16px!important;height:16px!important;display:-webkit-box!important;display:-webkit-flex!important;display:-moz-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-webkit-align-items:center!important;-moz-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:center!important;-webkit-justify-content:center!important;-moz-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.openai-mcp-tools.jsx-32b14b04f420f3ac .ant-collapse-expand-icon.jsx-32b14b04f420f3ac:hover{color:#6b7280!important}.openai-vertical-line.jsx-32b14b04f420f3ac{position:absolute;left:9px;top:18px;bottom:0;width:.5px;background-color:#f3f4f6;opacity:.8}.tool-item.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:13px;color:#4b5563;line-height:18px;padding:0;margin:0;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac{margin-bottom:12px;background:white;position:relative;z-index:1}.mcp-section.jsx-32b14b04f420f3ac:last-child{margin-bottom:0}.mcp-section-header.jsx-32b14b04f420f3ac{font-size:13px;color:#6b7280;font-weight:500;margin-bottom:4px}.mcp-code-block.jsx-32b14b04f420f3ac{background:#f9fafb;border:1px solid#f3f4f6;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;font-size:12px}.mcp-json.jsx-32b14b04f420f3ac{font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:#374151;margin:0;white-space:pre-wrap;word-wrap:break-word}.mcp-approved.jsx-32b14b04f420f3ac{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;font-size:13px;color:#6b7280}.mcp-checkmark.jsx-32b14b04f420f3ac{color:#10b981;margin-right:6px;font-weight:bold}.mcp-response-content.jsx-32b14b04f420f3ac{font-size:13px;color:#374151;line-height:1.5;white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,"SF Mono",Monaco,Consolas,"Liberation Mono","Courier New",monospace}'}),(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac openai-mcp-tools",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac openai-vertical-line"}),(0,a.jsxs)(eI.default,{ghost:!0,size:"small",expandIconPosition:"start",defaultActiveKey:o?["list-tools"]:n.map((e,t)=>"mcp-call-".concat(t)),children:[o&&(0,a.jsx)(eH,{header:"List tools",children:(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac",children:null===(s=o.item)||void 0===s?void 0:null===(t=s.tools)||void 0===t?void 0:t.map((e,t)=>(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac tool-item",children:e.name},t))})},"list-tools"),n.map((e,t)=>{var s,r,l;return(0,a.jsx)(eH,{header:(null===(s=e.item)||void 0===s?void 0:s.name)||"Tool call",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac",children:[(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Request"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-code-block",children:(null===(r=e.item)||void 0===r?void 0:r.arguments)&&(0,a.jsx)("pre",{className:"jsx-32b14b04f420f3ac mcp-json",children:(()=>{try{return JSON.stringify(JSON.parse(e.item.arguments),null,2)}catch(t){return e.item.arguments}})()})})]}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-approved",children:[(0,a.jsx)("span",{className:"jsx-32b14b04f420f3ac mcp-checkmark",children:"✓"})," Approved"]})}),(null===(l=e.item)||void 0===l?void 0:l.output)&&(0,a.jsxs)("div",{className:"jsx-32b14b04f420f3ac mcp-section",children:[(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-section-header",children:"Response"}),(0,a.jsx)("div",{className:"jsx-32b14b04f420f3ac mcp-response-content",children:e.item.output})]})]})},"mcp-call-".concat(t))})]})]})]}):(console.log("MCPEventsDisplay: No valid events found, returning null"),null)},eG=s(94331),eW=s(38398);let eJ=e=>new Promise((t,s)=>{let a=new FileReader;a.onload=()=>{t(a.result.split(",")[1])},a.onerror=s,a.readAsDataURL(e)}),eq=async(e,t)=>{let s=await eJ(t),a=t.type||(t.name.toLowerCase().endsWith(".pdf")?"application/pdf":"image/jpeg");return{role:"user",content:[{type:"input_text",text:e},{type:"input_image",image_url:"data:".concat(a,";base64,").concat(s)}]}},eV=(e,t,s,a)=>{let r="";t&&a&&(r=a.toLowerCase().endsWith(".pdf")?"[PDF attached]":"[Image attached]");let l={role:"user",content:t?"".concat(e," ").concat(r):e};return t&&s&&(l.imagePreviewUrl=s),l},eY=e=>"user"===e.role&&"string"==typeof e.content&&(e.content.includes("[Image attached]")||e.content.includes("[PDF attached]"))&&!!e.imagePreviewUrl;var eX=e=>{let{message:t}=e;if(!eY(t))return null;let s="string"==typeof t.content&&t.content.includes("[PDF attached]");return(0,a.jsx)("div",{className:"mb-2",children:s?(0,a.jsx)("div",{className:"w-64 h-32 rounded-md border border-gray-200 bg-red-50 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"48px",color:"#dc2626"}})}):(0,a.jsx)("img",{src:t.imagePreviewUrl,alt:"User uploaded image",className:"max-w-64 rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"200px"}})})},e$=s(53508);let{Dragger:eQ}=_.default;var e0=e=>{let{responsesUploadedImage:t,responsesImagePreviewUrl:s,onImageUpload:r,onRemoveImage:l}=e;return(0,a.jsx)(a.Fragment,{children:!t&&(0,a.jsx)(eQ,{beforeUpload:r,accept:"image/*,.pdf",showUploadList:!1,className:"inline-block",style:{padding:0,border:"none",background:"none"},children:(0,a.jsx)(I.Z,{title:"Attach image or PDF",children:(0,a.jsx)("button",{type:"button",className:"flex items-center justify-center w-8 h-8 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-md transition-colors",children:(0,a.jsx)(e$.Z,{style:{fontSize:"16px"}})})})})})},e2=s(33152),e1=e=>{let{endpointType:t,responsesSessionId:s,useApiSessionManagement:r,onToggleSessionManagement:l}=e;return t!==ew.KP.RESPONSES?null:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Session Management"}),(0,a.jsx)(I.Z,{title:"Choose between LiteLLM API session management (using previous_response_id) or UI-based session management (using chat history)",children:(0,a.jsx)(g.Z,{className:"text-gray-400",style:{fontSize:"12px"}})})]}),(0,a.jsx)(eR.Z,{checked:r,onChange:l,checkedChildren:"API",unCheckedChildren:"UI",size:"small"})]}),(0,a.jsxs)("div",{className:"text-xs p-2 rounded-md ".concat(s?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(g.Z,{style:{fontSize:"12px"}}),(()=>{if(!s)return r?"API Session: Ready":"UI Session: Ready";let e=r?"Response ID":"UI Session",t=s.slice(0,10);return"".concat(e,": ").concat(t,"...")})()]}),s&&(0,a.jsx)(I.Z,{title:(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"mb-1",children:"Copy response ID to continue session:"}),(0,a.jsx)("div",{className:"bg-gray-800 text-gray-100 p-2 rounded font-mono text-xs whitespace-pre-wrap",children:'curl -X POST "your-proxy-url/v1/responses" \\\n -H "Authorization: Bearer your-api-key" \\\n -H "Content-Type: application/json" \\\n -d \'{\n "model": "your-model",\n "input": [{"role": "user", "content": "your message", "type": "message"}],\n "previous_response_id": "'.concat(s,'",\n "stream": true\n }\'')})]}),overlayStyle:{maxWidth:"500px"},children:(0,a.jsx)("button",{onClick:()=>{s&&(navigator.clipboard.writeText(s),B.Z.success("Response ID copied to clipboard!"))},className:"ml-2 p-1 hover:bg-green-100 rounded transition-colors",children:(0,a.jsx)(ei.Z,{style:{fontSize:"12px"}})})})]}),(0,a.jsx)("div",{className:"text-xs opacity-75 mt-1",children:s?r?"LiteLLM API session active - context maintained server-side":"UI session active - context maintained client-side":r?"LiteLLM will manage session using previous_response_id":"UI will manage session using chat history"})]})]})};let{TextArea:e4}=S.default,{Dragger:e3}=_.default,e5=new Set([ew.KP.CHAT,ew.KP.RESPONSES]);var e6=e=>{let{accessToken:t,token:s,userRole:S,userID:_,disabledPersonalKeyCreation:W,proxySettings:q}=e,[er,el]=(0,T.useState)([]),[eo,en]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedMCPServers");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedMCPServers from sessionStorage",e),[]}}),[ei,ec]=(0,T.useState)(!1),[ed,em]=(0,T.useState)({}),[eu,ex]=(0,T.useState)(()=>{let e=sessionStorage.getItem("mcpServerToolRestrictions");try{return e?JSON.parse(e):{}}catch(e){return console.error("Error parsing mcpServerToolRestrictions from sessionStorage",e),{}}}),[eg,ep]=(0,T.useState)(()=>{let e=sessionStorage.getItem("apiKeySource");if(e)try{return JSON.parse(e)}catch(e){console.error("Error parsing apiKeySource from sessionStorage",e)}return W?"custom":"session"}),[ef,ev]=(0,T.useState)(()=>sessionStorage.getItem("apiKey")||""),[eb,ey]=(0,T.useState)(()=>sessionStorage.getItem("customProxyBaseUrl")||""),[eS,ek]=(0,T.useState)(""),[eI,eE]=(0,T.useState)(()=>{try{let e=sessionStorage.getItem("chatHistory");return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing chatHistory from sessionStorage",e),[]}}),[eZ,eL]=(0,T.useState)(void 0),[eR,eO]=(0,T.useState)(!1),[eD,eB]=(0,T.useState)([]),[ez,eH]=(0,T.useState)([]),[eJ,eY]=(0,T.useState)(void 0),e$=(0,T.useRef)(null),[eQ,e6]=(0,T.useState)(()=>sessionStorage.getItem("endpointType")||ew.KP.CHAT),[e7,e9]=(0,T.useState)(!1),e8=(0,T.useRef)(null),[te,tt]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedTags");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedTags from sessionStorage",e),[]}}),[ts,ta]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedVoice");if(!e)return"alloy";try{return JSON.parse(e)}catch(t){return e}}),[tr,tl]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedVectorStores");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedVectorStores from sessionStorage",e),[]}}),[to,tn]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedGuardrails");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedGuardrails from sessionStorage",e),[]}}),[ti,tc]=(0,T.useState)(()=>{let e=sessionStorage.getItem("selectedPolicies");try{return e?JSON.parse(e):[]}catch(e){return console.error("Error parsing selectedPolicies from sessionStorage",e),[]}}),[td,tm]=(0,T.useState)(()=>sessionStorage.getItem("messageTraceId")||null),[tu,tx]=(0,T.useState)(()=>sessionStorage.getItem("responsesSessionId")||null),[tg,tp]=(0,T.useState)(()=>{let e=sessionStorage.getItem("useApiSessionManagement");return!e||JSON.parse(e)}),[th,tf]=(0,T.useState)([]),[tv,tb]=(0,T.useState)([]),[ty,tj]=(0,T.useState)(null),[tN,tw]=(0,T.useState)(null),[tS,t_]=(0,T.useState)(null),[tk,tP]=(0,T.useState)(null),[tC,tA]=(0,T.useState)(null),[tI,tE]=(0,T.useState)(!1),[tZ,tT]=(0,T.useState)(""),[tL,tR]=(0,T.useState)("openai"),[tO,tU]=(0,T.useState)([]),[tM,tK]=(0,T.useState)(1),[tD,tB]=(0,T.useState)(2048),[tz,tH]=(0,T.useState)(!1),tF=function(){let[e,t]=(0,T.useState)(()=>{let e=sessionStorage.getItem("codeInterpreterEnabled");return!!e&&JSON.parse(e)}),[s,a]=(0,T.useState)(null),r=(0,T.useCallback)(e=>{t(e),sessionStorage.setItem("codeInterpreterEnabled",JSON.stringify(e))},[]),l=(0,T.useCallback)(()=>{a(null)},[]),o=(0,T.useCallback)(()=>{r(!e)},[e,r]);return{enabled:e,result:s,setEnabled:r,setResult:a,clearResult:l,toggle:o}}(),tG=(0,T.useRef)(null),tW=async()=>{let e="session"===eg?t:ef;if(e){ec(!0);try{let t=await (0,z.fetchMCPServers)(e);el(Array.isArray(t)?t:t.data||[])}catch(e){console.error("Error fetching MCP servers:",e)}finally{ec(!1)}}},tJ=async e=>{let s="session"===eg?t:ef;if(s&&!ed[e])try{let t=await (0,z.listMCPTools)(s,e);em(s=>({...s,[e]:t.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t)}};(0,T.useEffect)(()=>{tI&&tT((0,eM.L)({apiKeySource:eg,accessToken:t,apiKey:ef,inputMessage:eS,chatHistory:eI,selectedTags:te,selectedVectorStores:tr,selectedGuardrails:to,selectedPolicies:ti,selectedMCPServers:eo,mcpServers:er,mcpServerToolRestrictions:eu,endpointType:eQ,selectedModel:eZ,selectedSdk:tL,selectedVoice:ts,proxySettings:q}))},[tI,tL,eg,t,ef,eS,eI,te,tr,to,ti,eo,er,eu,eQ,eZ,q]),(0,T.useEffect)(()=>{let e=setTimeout(()=>{sessionStorage.setItem("chatHistory",JSON.stringify(eI))},500);return()=>{clearTimeout(e)}},[eI]),(0,T.useEffect)(()=>{sessionStorage.setItem("apiKeySource",JSON.stringify(eg)),sessionStorage.setItem("apiKey",ef),sessionStorage.setItem("endpointType",eQ),sessionStorage.setItem("selectedTags",JSON.stringify(te)),sessionStorage.setItem("selectedVectorStores",JSON.stringify(tr)),sessionStorage.setItem("selectedGuardrails",JSON.stringify(to)),sessionStorage.setItem("selectedPolicies",JSON.stringify(ti)),sessionStorage.setItem("selectedMCPServers",JSON.stringify(eo)),sessionStorage.setItem("mcpServerToolRestrictions",JSON.stringify(eu)),sessionStorage.setItem("selectedVoice",ts),sessionStorage.removeItem("selectedMCPTools"),eZ?sessionStorage.setItem("selectedModel",eZ):sessionStorage.removeItem("selectedModel"),td?sessionStorage.setItem("messageTraceId",td):sessionStorage.removeItem("messageTraceId"),tu?sessionStorage.setItem("responsesSessionId",tu):sessionStorage.removeItem("responsesSessionId"),sessionStorage.setItem("useApiSessionManagement",JSON.stringify(tg))},[eg,ef,eZ,eQ,te,tr,to,ti,td,tu,tg,eo,eu,ts]),(0,T.useEffect)(()=>{let e="session"===eg?t:ef;if(!e||!s||!S||!_){console.log("userApiKey or token or userRole or userID is missing = ",e,s,S,_);return}(async()=>{try{if(!e){console.log("userApiKey is missing");return}let t=await (0,ee.p)(e);console.log("Fetched models:",t),eB(t);let s=t.some(e=>e.model_group===eZ);t.length&&s||eL(void 0)}catch(e){console.error("Error fetching model info:",e)}})(),tW()},[t,_,S,eg,ef,s]),(0,T.useEffect)(()=>{let e="session"===eg?t:ef;e&&eQ===ew.KP.A2A_AGENTS&&(async()=>{try{let t=await (0,Q.o)(e,eb||void 0);eH(t),eJ&&!t.some(e=>e.agent_name===eJ)&&eY(void 0)}catch(e){console.error("Error fetching agents:",e)}})()},[t,eg,ef,eQ,eb,eJ]),(0,T.useEffect)(()=>{tG.current&&setTimeout(()=>{var e;null===(e=tG.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)},[eI]);let tq=(e,t,s)=>{console.log("updateTextUI called with:",e,t,s),eE(a=>{let r=a[a.length-1];if(!r||r.role!==e||r.isImage||r.isAudio)return[...a,{role:e,content:t,model:s}];{var l;let e={...r,content:r.content+t,model:null!==(l=r.model)&&void 0!==l?l:s};return[...a.slice(0,-1),e]}})},tV=e=>{eE(t=>{let s=t[t.length-1];return!s||"assistant"!==s.role||s.isImage||s.isAudio?t.length>0&&"user"===t[t.length-1].role?[...t,{role:"assistant",content:"",reasoningContent:e}]:t:[...t.slice(0,t.length-1),{...s,reasoningContent:(s.reasoningContent||"")+e}]})},tY=e=>{console.log("updateTimingData called with:",e),eE(t=>{let s=t[t.length-1];if(console.log("Current last message:",s),s&&"assistant"===s.role){console.log("Updating assistant message with timeToFirstToken:",e);let a=[...t.slice(0,t.length-1),{...s,timeToFirstToken:e}];return console.log("Updated chat history:",a),a}return s&&"user"===s.role?(console.log("Creating new assistant message with timeToFirstToken:",e),[...t,{role:"assistant",content:"",timeToFirstToken:e}]):(console.log("No appropriate message found to update timing"),t)})},tX=(e,t)=>{console.log("Received usage data:",e),eE(s=>{let a=s[s.length-1];if(a&&"assistant"===a.role){console.log("Updating message with usage data:",e);let r={...a,usage:e,toolName:t};return console.log("Updated message:",r),[...s.slice(0,s.length-1),r]}return s})},t$=e=>{console.log("Received A2A metadata:",e),eE(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){let a={...s,a2aMetadata:e};return[...t.slice(0,t.length-1),a]}return t})},tQ=e=>{eE(t=>{let s=t[t.length-1];return s&&"assistant"===s.role?[...t.slice(0,t.length-1),{...s,totalLatency:e}]:t})},t0=e=>{console.log("Received search results:",e),eE(t=>{let s=t[t.length-1];if(s&&"assistant"===s.role){console.log("Updating message with search results");let a={...s,searchResults:e};return[...t.slice(0,t.length-1),a]}return t})},t2=e=>{console.log("Received response ID for session management:",e),tg&&tx(e)},t1=e=>{console.log("ChatUI: Received MCP event:",e),tU(t=>{if(e.item_id&&t.some(t=>t.item_id===e.item_id&&t.type===e.type&&(t.sequence_number===e.sequence_number||void 0===t.sequence_number&&void 0===e.sequence_number)))return console.log("ChatUI: Duplicate MCP event, skipping"),t;let s=[...t,e];return console.log("ChatUI: Updated MCP events:",s),s})},t4=(e,t)=>{eE(s=>[...s,{role:"assistant",content:e,model:t,isImage:!0}])},t3=(e,t)=>{eE(s=>[...s,{role:"assistant",content:(0,M.aS)(e,100),model:t,isEmbeddings:!0}])},t5=(e,t)=>{eE(s=>[...s,{role:"assistant",content:e,model:t,isAudio:!0}])},t6=(e,t)=>{eE(s=>{let a=s[s.length-1];if(!a||"assistant"!==a.role||a.isImage||a.isAudio)return[...s,{role:"assistant",content:"",model:t,image:{url:e,detail:"auto"}}];{var r;let l={...a,image:{url:e,detail:"auto"},model:null!==(r=a.model)&&void 0!==r?r:t};return[...s.slice(0,-1),l]}})},t7=e=>{tf(t=>[...t,e]);let t=URL.createObjectURL(e);return tb(e=>[...e,t]),!1},t9=e=>{tv[e]&&URL.revokeObjectURL(tv[e]),tf(t=>t.filter((t,s)=>s!==e)),tb(t=>t.filter((t,s)=>s!==e))},t8=()=>{tv.forEach(e=>{URL.revokeObjectURL(e)}),tf([]),tb([])},se=()=>{tN&&URL.revokeObjectURL(tN),tj(null),tw(null)},st=()=>{tk&&URL.revokeObjectURL(tk),t_(null),tP(null)},ss=()=>{tA(null)},sa=async()=>{let e;if(""===eS.trim()&&eQ!==ew.KP.TRANSCRIPTION)return;if(eQ===ew.KP.IMAGE_EDITS&&0===th.length){B.Z.fromBackend("Please upload at least one image for editing");return}if(eQ===ew.KP.TRANSCRIPTION&&!tC){B.Z.fromBackend("Please upload an audio file for transcription");return}if(eQ===ew.KP.A2A_AGENTS&&!eJ){B.Z.fromBackend("Please select an agent to send a message");return}if([ew.KP.CHAT,ew.KP.IMAGE,ew.KP.SPEECH,ew.KP.IMAGE_EDITS,ew.KP.RESPONSES,ew.KP.ANTHROPIC_MESSAGES,ew.KP.EMBEDDINGS,ew.KP.TRANSCRIPTION].includes(eQ)&&!eZ){B.Z.fromBackend("Please select a model before sending a request");return}if(!s||!S||!_)return;let a="session"===eg?t:ef;if(!a){B.Z.fromBackend("Please provide a Virtual Key or select Current UI Session");return}e8.current=new AbortController;let r=e8.current.signal;if(eQ===ew.KP.RESPONSES&&ty)try{e=await eq(eS,ty)}catch(e){B.Z.fromBackend("Failed to process image. Please try again.");return}else if(eQ===ew.KP.CHAT&&tS)try{e=await (0,eA.Sn)(eS,tS)}catch(e){B.Z.fromBackend("Failed to process image. Please try again.");return}else e={role:"user",content:eS};let l=td||(0,U.Z)();td||tm(l),eE([...eI,eQ===ew.KP.RESPONSES&&ty?eV(eS,!0,tN||void 0,ty.name):eQ===ew.KP.CHAT&&tS?(0,eA.Hk)(eS,!0,tk||void 0,tS.name):eQ===ew.KP.TRANSCRIPTION&&tC?eV(eS?"\uD83C\uDFB5 Audio file: ".concat(tC.name,"\nPrompt: ").concat(eS):"\uD83C\uDFB5 Audio file: ".concat(tC.name),!1):eV(eS,!1)]),tU([]),tF.clearResult(),e9(!0);try{if(eZ){if(eQ===ew.KP.CHAT){let t=[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:"string"==typeof s?s:""}}),e];await (0,X.n)(t,(e,t)=>tq("assistant",e,t),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,t6,t0,tz?tM:void 0,tz?tD:void 0,tQ,eb||void 0,er,eu,t1)}else if(eQ===ew.KP.IMAGE)await es(eS,(e,t)=>t4(e,t),eZ,a,te,r,eb||void 0);else if(eQ===ew.KP.SPEECH)await V(eS,ts,(e,t)=>t5(e,t),eZ||"",a,te,r,void 0,void 0,eb||void 0);else if(eQ===ew.KP.IMAGE_EDITS)th.length>0&&await et(1===th.length?th[0]:th,eS,(e,t)=>t4(e,t),eZ,a,te,r,eb||void 0);else if(eQ===ew.KP.RESPONSES){let t;t=tg&&tu?[e]:[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e],await ea(t,(e,t,s)=>tq(e,t,s),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,tg?tu:null,t2,t1,tF.enabled,tF.setResult,eb||void 0,er,eu)}else if(eQ===ew.KP.ANTHROPIC_MESSAGES){let t=[...eI.filter(e=>!e.isImage&&!e.isAudio).map(e=>{let{role:t,content:s}=e;return{role:t,content:s}}),e];await J(t,(e,t,s)=>tq(e,t,s),eZ,a,te,r,tV,tY,tX,l,tr.length>0?tr:void 0,to.length>0?to:void 0,ti.length>0?ti:void 0,eo,eb||void 0)}else eQ===ew.KP.EMBEDDINGS?await $(eS,(e,t)=>t3(e,t),eZ,a,te,eb||void 0):eQ===ew.KP.TRANSCRIPTION&&tC&&await Y(tC,(e,t)=>tq("assistant",e,t),eZ,a,te,r,void 0,void 0,void 0,void 0,eb||void 0)}eQ===ew.KP.A2A_AGENTS&&eJ&&await (0,G.O)(eJ,eS,(e,t)=>tq("assistant",e,t),a,r,tY,tQ,t$,eb||void 0)}catch(e){r.aborted?console.log("Request was cancelled"):(console.error("Error fetching response",e),tq("assistant","Error fetching response:"+e))}finally{e9(!1),e8.current=null,eQ===ew.KP.IMAGE_EDITS&&t8(),eQ===ew.KP.RESPONSES&&ty&&se(),eQ===ew.KP.CHAT&&tS&&st(),eQ===ew.KP.TRANSCRIPTION&&tC&&ss()}ek("")};if(S&&"Admin Viewer"===S){let{Title:e,Paragraph:t}=k.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}let sr=(0,a.jsx)(r.Z,{style:{fontSize:24},spin:!0});return(0,a.jsxs)("div",{className:"w-full p-4 pb-0 bg-white",children:[(0,a.jsx)(w.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,a.jsxs)("div",{className:"flex h-[80vh] w-full gap-4",children:[(0,a.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 overflow-y-auto",children:[(0,a.jsx)(w.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"Configurations"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-2"})," Virtual Key Source"]}),(0,a.jsx)(P.default,{disabled:W,value:eg,style:{width:"100%"},onChange:e=>{ep(e)},options:[{value:"session",label:"Current UI Session"},{value:"custom",label:"Virtual Key"}],className:"rounded-md"}),"custom"===eg&&(0,a.jsx)(w.oi,{className:"mt-2",placeholder:"Enter custom Virtual Key",type:"password",onValueChange:ev,value:ef,icon:l.Z})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)(w.xv,{className:"font-medium block text-gray-700 flex items-center",children:[(0,a.jsx)(o.Z,{className:"mr-2"})," Custom Proxy Base URL"]}),(null==q?void 0:q.LITELLM_UI_API_DOC_BASE_URL)&&!eb&&(0,a.jsx)(C.ZP,{type:"link",size:"small",icon:(0,a.jsx)(n.Z,{}),onClick:()=>{ey(q.LITELLM_UI_API_DOC_BASE_URL||""),sessionStorage.setItem("customProxyBaseUrl",q.LITELLM_UI_API_DOC_BASE_URL||"")},className:"text-gray-500 hover:text-gray-700",children:"Fill"}),eb&&(0,a.jsx)(C.ZP,{type:"link",size:"small",icon:(0,a.jsx)(i.Z,{}),onClick:()=>{ey(""),sessionStorage.removeItem("customProxyBaseUrl")},className:"text-gray-500 hover:text-gray-700",children:"Clear"})]}),(0,a.jsx)(w.oi,{placeholder:"Optional: Enter custom proxy URL (e.g., http://localhost:5000)",onValueChange:e=>{ey(e),sessionStorage.setItem("customProxyBaseUrl",e)},value:eb,icon:c.Z}),eb&&(0,a.jsxs)(w.xv,{className:"text-xs text-gray-500 mt-1",children:["API calls will be sent to: ",eb]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-2"})," Endpoint Type"]}),(0,a.jsx)(eK,{endpointType:eQ,onEndpointChange:e=>{e6(e),eL(void 0),eY(void 0),eO(!1);try{sessionStorage.removeItem("selectedModel"),sessionStorage.removeItem("selectedAgent")}catch(e){}},className:"mb-4"}),eQ===ew.KP.SPEECH&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2"}),"Voice"]}),(0,a.jsx)(P.default,{value:ts,onChange:e=>{ta(e),sessionStorage.setItem("selectedVoice",e)},style:{width:"100%"},className:"rounded-md",options:e_})]}),(0,a.jsx)(e1,{endpointType:eQ,responsesSessionId:tu,useApiSessionManagement:tg,onToggleSessionManagement:e=>{tp(e),e||tx(null)}})]}),eQ!==ew.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," Select Model"]}),(()=>{if(!eZ||"custom"===eZ)return!1;let e=eD.find(e=>e.model_group===eZ);return!!e&&(!e.mode||"chat"===e.mode)})()?(0,a.jsx)(A.Z,{content:(0,a.jsx)(ej,{temperature:tM,maxTokens:tD,useAdvancedParams:tz,onTemperatureChange:tK,onMaxTokensChange:tB,onUseAdvancedParamsChange:tH}),title:"Model Settings",trigger:"click",placement:"right",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(o.Z,{}),className:"text-gray-500 hover:text-gray-700"})}):(0,a.jsx)(I.Z,{title:"Advanced parameters are only supported for chat models currently",children:(0,a.jsx)(C.ZP,{type:"text",size:"small",icon:(0,a.jsx)(o.Z,{}),className:"text-gray-300 cursor-not-allowed",disabled:!0})})]}),(0,a.jsx)(P.default,{value:eZ,placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),eL(e),eO("custom"===e)},options:[{value:"custom",label:"Enter custom model",key:"custom"},...Array.from(new Set(eD.filter(e=>{if(!e.mode)return!0;let t=(0,ew.vf)(e.mode);return eQ===ew.KP.RESPONSES||eQ===ew.KP.ANTHROPIC_MESSAGES?t===eQ||t===ew.KP.CHAT:eQ===ew.KP.IMAGE_EDITS?t===eQ||t===ew.KP.IMAGE:t===eQ}).map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t}))],style:{width:"100%"},showSearch:!0,className:"rounded-md"}),eR&&(0,a.jsx)(w.oi,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{e$.current&&clearTimeout(e$.current),e$.current=setTimeout(()=>{eL(e)},500)}})]}),eQ===ew.KP.A2A_AGENTS&&(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-2"})," Select Agent"]}),(0,a.jsx)(P.default,{value:eJ,placeholder:"Select an Agent",onChange:e=>eY(e),options:ez.map(e=>({value:e.agent_name,label:e.agent_name||e.agent_id,key:e.agent_id})),style:{width:"100%"},showSearch:!0,className:"rounded-md",optionLabelProp:"label",children:ez.map(e=>{var t;return(0,a.jsx)(P.default.Option,{value:e.agent_name,label:e.agent_name||e.agent_id,children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.agent_name||e.agent_id}),(null===(t=e.agent_card_params)||void 0===t?void 0:t.description)&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.agent_card_params.description})]})},e.agent_id)})}),0===ez.length&&(0,a.jsx)(w.xv,{className:"text-xs text-gray-500 mt-2 block",children:"No agents found. Create agents via /v1/agents endpoint."})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(u.Z,{className:"mr-2"})," Tags"]}),(0,a.jsx)(H.Z,{value:te,onChange:tt,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(x.Z,{className:"mr-2"})," MCP Servers",(0,a.jsx)(I.Z,{className:"ml-1",title:"Select MCP servers to use in your conversation.",children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsxs)(P.default,{mode:"multiple",style:{width:"100%"},placeholder:"Select MCP servers",value:eo,onChange:e=>{e.includes("__all__")?(en(["__all__"]),ex({})):(en(e),ex(t=>{let s={...t};return Object.keys(s).forEach(t=>{e.includes(t)||delete s[t]}),s}),e.forEach(e=>{ed[e]||tJ(e)}))},loading:ei,className:"mb-2",allowClear:!0,optionLabelProp:"label",disabled:!e5.has(eQ),maxTagCount:"responsive",children:[(0,a.jsx)(P.default.Option,{value:"__all__",label:"All MCP Servers",children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:"All MCP Servers"}),(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:"Use all available MCP servers"})]})},"__all__"),er.map(e=>(0,a.jsx)(P.default.Option,{value:e.server_id,label:e.alias||e.server_name||e.server_id,disabled:eo.includes("__all__"),children:(0,a.jsxs)("div",{className:"flex flex-col py-1",children:[(0,a.jsx)("span",{className:"font-medium",children:e.alias||e.server_name||e.server_id}),e.description&&(0,a.jsx)("span",{className:"text-xs text-gray-500 mt-1",children:e.description})]})},e.server_id))]}),eo.length>0&&!eo.includes("__all__")&&e5.has(eQ)&&(0,a.jsx)("div",{className:"mt-3 space-y-2",children:eo.map(e=>{let t=er.find(t=>t.server_id===e),s=ed[e]||[];return 0===s.length?null:(0,a.jsxs)("div",{className:"border rounded p-2",children:[(0,a.jsxs)(w.xv,{className:"text-xs text-gray-600 mb-1",children:["Limit tools for ",(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,":"]}),(0,a.jsx)(P.default,{mode:"multiple",size:"small",style:{width:"100%"},placeholder:"All tools (default)",value:eu[e]||[],onChange:t=>{ex(s=>({...s,[e]:t}))},options:s.map(e=>({value:e.name,label:e.name})),maxTagCount:2})]},e)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(p.Z,{className:"mr-2"})," Vector Store",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select vector store(s) to use for this LLM API call. You can set up your vector store"," ",(0,a.jsx)("a",{href:"?page=vector-stores",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(F.Z,{value:tr,onChange:tl,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(h.Z,{className:"mr-2"})," Guardrails",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select guardrail(s) to use for this LLM API call. You can set up your guardrails"," ",(0,a.jsx)("a",{href:"?page=guardrails",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(K.Z,{value:to,onChange:tn,className:"mb-4",accessToken:t||""})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(w.xv,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(h.Z,{className:"mr-2"})," Policies",(0,a.jsx)(I.Z,{className:"ml-1",title:(0,a.jsxs)("span",{children:["Select policy/policies to apply to this LLM API call. Policies define which guardrails are applied based on conditions. You can set up your policies"," ",(0,a.jsx)("a",{href:"?page=policies",style:{color:"#1890ff"},children:"here"}),"."]}),children:(0,a.jsx)(g.Z,{})})]}),(0,a.jsx)(D.Z,{value:ti,onChange:tc,className:"mb-4",accessToken:t||""})]}),eQ===ew.KP.RESPONSES&&(0,a.jsx)("div",{children:(0,a.jsx)(eU,{accessToken:"session"===eg?t||"":ef,enabled:tF.enabled,onEnabledChange:tF.setEnabled,selectedContainerId:null,onContainerChange:()=>{},selectedModel:eZ||""})})]})]}),(0,a.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsx)(w.Dx,{className:"text-xl font-semibold mb-0",children:"Test Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(w.zx,{onClick:()=>{eI.forEach(e=>{e.isAudio&&"string"==typeof e.content&&URL.revokeObjectURL(e.content)}),eE([]),tm(null),tx(null),tU([]),t8(),se(),st(),ss(),sessionStorage.removeItem("chatHistory"),sessionStorage.removeItem("messageTraceId"),sessionStorage.removeItem("responsesSessionId"),B.Z.success("Chat history cleared.")},className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:i.Z,children:"Clear Chat"}),(0,a.jsx)(w.zx,{onClick:()=>tE(!0),className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:f.Z,children:"Get Code"})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===eI.length&&(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(m.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(w.xv,{children:"Start a conversation, generate an image, or handle audio"})]}),eI.map((e,s)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-4 ".concat("user"===e.role?"text-right":"text-left"),children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===e.role?"#f0f8ff":"#ffffff",border:"user"===e.role?"1px solid #e6f0fa":"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===e.role?"#e6f0fa":"#f5f5f5"},children:"user"===e.role?(0,a.jsx)(v.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,a.jsx)(m.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:e.role}),"assistant"===e.role&&e.model&&(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:e.model})]}),e.reasoningContent&&(0,a.jsx)(eG.Z,{reasoningContent:e.reasoningContent}),"assistant"===e.role&&s===eI.length-1&&tO.length>0&&(eQ===ew.KP.RESPONSES||eQ===ew.KP.CHAT)&&(0,a.jsx)("div",{className:"mb-3",children:(0,a.jsx)(eF,{events:tO})}),"assistant"===e.role&&e.searchResults&&(0,a.jsx)(e2.J,{searchResults:e.searchResults}),"assistant"===e.role&&s===eI.length-1&&tF.result&&eQ===ew.KP.RESPONSES&&(0,a.jsx)(eT,{code:tF.result.code,containerId:tF.result.containerId,annotations:tF.result.annotations,accessToken:"session"===eg?t||"":ef}),(0,a.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:[e.isImage?(0,a.jsx)("img",{src:"string"==typeof e.content?e.content:"",alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}}):e.isAudio?(0,a.jsx)(eN,{message:e}):(0,a.jsxs)(a.Fragment,{children:[eQ===ew.KP.RESPONSES&&(0,a.jsx)(eX,{message:e}),eQ===ew.KP.CHAT&&(0,a.jsx)(eP.Z,{message:e}),(0,a.jsx)(L.UG,{components:{code(e){let{node:t,inline:s,className:r,children:l,...o}=e,n=/language-(\w+)/.exec(r||"");return!s&&n?(0,a.jsx)(R.Z,{style:O.Z,language:n[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...o,children:String(l).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...o,children:l})},pre:e=>{let{node:t,...s}=e;return(0,a.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:"string"==typeof e.content?e.content:""}),e.image&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("img",{src:e.image.url,alt:"Generated image",className:"max-w-full rounded-md border border-gray-200 shadow-sm",style:{maxHeight:"500px"}})})]}),"assistant"===e.role&&(e.timeToFirstToken||e.totalLatency||e.usage)&&!e.a2aMetadata&&(0,a.jsx)(eW.Z,{timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency,usage:e.usage,toolName:e.toolName}),"assistant"===e.role&&e.a2aMetadata&&(0,a.jsx)(eh,{a2aMetadata:e.a2aMetadata,timeToFirstToken:e.timeToFirstToken,totalLatency:e.totalLatency})]})]})})},s)),e7&&tO.length>0&&(eQ===ew.KP.RESPONSES||eQ===ew.KP.CHAT)&&eI.length>0&&"user"===eI[eI.length-1].role&&(0,a.jsx)("div",{className:"text-left mb-4",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"#ffffff",border:"1px solid #f0f0f0",textAlign:"left"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"#f5f5f5"},children:(0,a.jsx)(m.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,a.jsx)("strong",{className:"text-sm capitalize",children:"Assistant"})]}),(0,a.jsx)(eF,{events:tO})]})}),e7&&(0,a.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,a.jsx)(E.Z,{indicator:sr})}),(0,a.jsx)("div",{ref:tG,style:{height:"1px"}})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[eQ===ew.KP.IMAGE_EDITS&&(0,a.jsx)("div",{className:"mb-4",children:0===th.length?(0,a.jsxs)(e3,{beforeUpload:t7,accept:"image/*",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(b.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag images to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for PNG, JPG, JPEG formats. Multiple images supported."})]}):(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[th.map((e,t)=>(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:tv[t]||"",alt:"Upload preview ".concat(t+1),className:"max-w-32 max-h-32 rounded-md border border-gray-200 object-cover"}),(0,a.jsx)("button",{className:"absolute top-1 right-1 bg-white shadow-sm border border-gray-200 rounded px-1 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:()=>t9(t),children:(0,a.jsx)(y.Z,{})})]},t)),(0,a.jsxs)("div",{className:"flex items-center justify-center w-32 h-32 border-2 border-dashed border-gray-300 rounded-md hover:border-gray-400 cursor-pointer",onClick:()=>{var e;return null===(e=document.getElementById("additional-image-upload"))||void 0===e?void 0:e.click()},children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(b.Z,{style:{fontSize:"24px",color:"#666"}}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Add more"})]}),(0,a.jsx)("input",{id:"additional-image-upload",type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{Array.from(e.target.files||[]).forEach(e=>t7(e))}})]})]})}),eQ===ew.KP.TRANSCRIPTION&&(0,a.jsx)("div",{className:"mb-4",children:tC?(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1",children:[(0,a.jsx)(d.Z,{style:{fontSize:"20px",color:"#666"}}),(0,a.jsx)("span",{className:"text-sm font-medium",children:tC.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(tC.size/1024/1024).toFixed(2)," MB)"]})]}),(0,a.jsxs)("button",{className:"bg-white shadow-sm border border-gray-200 rounded px-2 py-1 text-red-500 hover:bg-red-50 text-xs",onClick:ss,children:[(0,a.jsx)(y.Z,{})," Remove"]})]}):(0,a.jsxs)(e3,{beforeUpload:e=>(tA(e),!1),accept:"audio/*,.mp3,.mp4,.mpeg,.mpga,.m4a,.wav,.webm",showUploadList:!1,children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(d.Z,{style:{fontSize:"24px",color:"#666"}})}),(0,a.jsx)("p",{className:"ant-upload-text text-sm",children:"Click or drag audio file to upload"}),(0,a.jsx)("p",{className:"ant-upload-hint text-xs text-gray-500",children:"Support for MP3, MP4, MPEG, MPGA, M4A, WAV, WEBM formats. Max file size: 25 MB."})]})}),eQ===ew.KP.RESPONSES&&ty&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:ty.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tN||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:ty.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:ty.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:se,children:(0,a.jsx)(y.Z,{style:{fontSize:"12px"}})})]})}),eQ===ew.KP.CHAT&&tS&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsx)("div",{className:"relative inline-block",children:tS.name.toLowerCase().endsWith(".pdf")?(0,a.jsx)("div",{className:"w-10 h-10 rounded-md bg-red-500 flex items-center justify-center",children:(0,a.jsx)(j.Z,{style:{fontSize:"16px",color:"white"}})}):(0,a.jsx)("img",{src:tk||"",alt:"Upload preview",className:"w-10 h-10 rounded-md border border-gray-200 object-cover"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:tS.name}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:tS.name.toLowerCase().endsWith(".pdf")?"PDF":"Image"})]}),(0,a.jsx)("button",{className:"flex items-center justify-center w-6 h-6 text-gray-400 hover:text-gray-600 hover:bg-gray-200 rounded-full transition-colors",onClick:st,children:(0,a.jsx)(y.Z,{style:{fontSize:"12px"}})})]})}),eQ===ew.KP.RESPONSES&&tF.enabled&&(0,a.jsxs)("div",{className:"mb-2 space-y-2",children:[(0,a.jsxs)("div",{className:"px-3 py-2 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg border border-blue-200 flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:e7?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{className:"text-blue-500",spin:!0}),(0,a.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Running Python code..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{className:"text-blue-500"}),(0,a.jsx)("span",{className:"text-sm text-blue-700 font-medium",children:"Code Interpreter Active"})]})}),(0,a.jsx)("button",{className:"text-xs text-blue-500 hover:text-blue-700",onClick:()=>tF.setEnabled(!1),children:"Disable"})]}),!e7&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:["Generate sample sales data CSV and create a chart","Create a PNG bar chart comparing AI gateway providers including LiteLLM","Generate a CSV of LLM pricing data and visualize it as a line chart"].map((e,t)=>(0,a.jsx)("button",{className:"text-xs px-3 py-1.5 bg-white border border-gray-200 rounded-full hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 transition-colors",onClick:()=>ek(e),children:e},t))})]}),0===eI.length&&!e7&&(0,a.jsx)("div",{className:"flex items-center gap-2 mb-3 overflow-x-auto",children:(eQ===ew.KP.A2A_AGENTS?["What can you help me with?","Tell me about yourself","What tasks can you perform?"]:["Write me a poem","Explain quantum computing","Draft a polite email requesting a meeting"]).map(e=>(0,a.jsx)("button",{type:"button",className:"shrink-0 rounded-full border border-gray-200 px-3 py-1 text-xs font-medium text-gray-600 transition-colors hover:bg-blue-50 hover:border-blue-300 hover:text-blue-600 cursor-pointer",onClick:()=>ek(e),children:e},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 mr-2 flex items-center gap-1",children:[eQ===ew.KP.RESPONSES&&!ty&&(0,a.jsx)(e0,{responsesUploadedImage:ty,responsesImagePreviewUrl:tN,onImageUpload:e=>(tj(e),tw(URL.createObjectURL(e)),!1),onRemoveImage:se}),eQ===ew.KP.CHAT&&!tS&&(0,a.jsx)(eC.Z,{chatUploadedImage:tS,chatImagePreviewUrl:tk,onImageUpload:e=>(t_(e),tP(URL.createObjectURL(e)),!1),onRemoveImage:st}),eQ===ew.KP.RESPONSES&&(0,a.jsx)(I.Z,{title:tF.enabled?"Code Interpreter enabled (click to disable)":"Enable Code Interpreter",children:(0,a.jsx)("button",{className:"p-1.5 rounded-md transition-colors ".concat(tF.enabled?"bg-blue-100 text-blue-600":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"),onClick:()=>{tF.toggle(),tF.enabled||B.Z.success("Code Interpreter enabled!")},children:(0,a.jsx)(f.Z,{style:{fontSize:"16px"}})})})]}),(0,a.jsx)(e4,{value:eS,onChange:e=>ek(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),sa())},placeholder:eQ===ew.KP.CHAT||eQ===ew.KP.EMBEDDINGS||eQ===ew.KP.RESPONSES||eQ===ew.KP.ANTHROPIC_MESSAGES?"Type your message... (Shift+Enter for new line)":eQ===ew.KP.A2A_AGENTS?"Send a message to the A2A agent...":eQ===ew.KP.IMAGE_EDITS?"Describe how you want to edit the image...":eQ===ew.KP.SPEECH?"Enter text to convert to speech...":eQ===ew.KP.TRANSCRIPTION?"Optional: Add context or prompt for transcription...":"Describe the image you want to generate...",disabled:e7,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,a.jsx)(w.zx,{onClick:sa,disabled:e7||(eQ===ew.KP.TRANSCRIPTION?!tC:!eS.trim()),className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,a.jsx)(N.Z,{style:{fontSize:"14px"}})})]}),e7&&(0,a.jsx)(w.zx,{onClick:()=>{e8.current&&(e8.current.abort(),e8.current=null,e9(!1),B.Z.info("Request cancelled"))},className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",icon:y.Z,children:"Cancel"})]})]})]})]})}),(0,a.jsxs)(Z.Z,{title:"Generated Code",visible:tI,onCancel:()=>tE(!1),footer:null,width:800,children:[(0,a.jsxs)("div",{className:"flex justify-between items-end my-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(w.xv,{className:"font-medium block mb-1 text-gray-700",children:"SDK Type"}),(0,a.jsx)(P.default,{value:tL,onChange:e=>tR(e),style:{width:150},options:[{value:"openai",label:"OpenAI SDK"},{value:"azure",label:"Azure SDK"}]})]}),(0,a.jsx)(C.ZP,{onClick:()=>{navigator.clipboard.writeText(tZ),B.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,a.jsx)(R.Z,{language:"python",style:O.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md",customStyle:{maxHeight:"60vh",overflowY:"auto"},children:tZ})]})]})}},94331:function(e,t,s){var a=s(57437),r=s(2265),l=s(5545),o=s(62831),n=s(17906),i=s(94263),c=s(83322),d=s(70464),m=s(77565);t.Z=e=>{let{reasoningContent:t}=e,[s,u]=(0,r.useState)(!0);return t?(0,a.jsxs)("div",{className:"reasoning-content mt-1 mb-2",children:[(0,a.jsxs)(l.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>u(!s),icon:(0,a.jsx)(c.Z,{}),children:[s?"Hide reasoning":"Show reasoning",s?(0,a.jsx)(d.Z,{className:"ml-1"}):(0,a.jsx)(m.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700",children:(0,a.jsx)(o.UG,{components:{code(e){let{node:t,inline:s,className:r,children:l,...o}=e,c=/language-(\w+)/.exec(r||"");return!s&&c?(0,a.jsx)(n.Z,{style:i.Z,language:c[1],PreTag:"div",className:"rounded-md my-2",...o,children:String(l).replace(/\n$/,"")}):(0,a.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),...o,children:l})}},children:t})})]}):null}},38398:function(e,t,s){var a=s(57437);s(2265);var r=s(99981),l=s(5540),o=s(71282),n=s(11741),i=s(83322),c=s(16601),d=s(62670),m=s(58630);t.Z=e=>{let{timeToFirstToken:t,totalLatency:s,usage:u,toolName:x}=e;return t||s||u?(0,a.jsxs)("div",{className:"response-metrics mt-2 pt-2 border-t border-gray-100 text-xs text-gray-500 flex flex-wrap gap-3",children:[void 0!==t&&(0,a.jsx)(r.Z,{title:"Time to first token",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["TTFT: ",(t/1e3).toFixed(2),"s"]})]})}),void 0!==s&&(0,a.jsx)(r.Z,{title:"Total latency",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total Latency: ",(s/1e3).toFixed(2),"s"]})]})}),(null==u?void 0:u.promptTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Prompt tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(o.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["In: ",u.promptTokens]})]})}),(null==u?void 0:u.completionTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Completion tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Out: ",u.completionTokens]})]})}),(null==u?void 0:u.reasoningTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Reasoning tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Reasoning: ",u.reasoningTokens]})]})}),(null==u?void 0:u.totalTokens)!==void 0&&(0,a.jsx)(r.Z,{title:"Total tokens",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(c.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Total: ",u.totalTokens]})]})}),(null==u?void 0:u.cost)!==void 0&&(0,a.jsx)(r.Z,{title:"Cost",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["$",u.cost.toFixed(6)]})]})}),x&&(0,a.jsx)(r.Z,{title:"Tool used",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(m.Z,{className:"mr-1"}),(0,a.jsxs)("span",{children:["Tool: ",x]})]})})]}):null}},33152:function(e,t,s){s.d(t,{J:function(){return d}});var a=s(57437),r=s(2265),l=s(5545),o=s(44625),n=s(70464),i=s(77565),c=s(38434);function d(e){let{searchResults:t}=e,[s,d]=(0,r.useState)(!0),[m,u]=(0,r.useState)({});if(!t||0===t.length)return null;let x=(e,t)=>{let s="".concat(e,"-").concat(t);u(e=>({...e,[s]:!e[s]}))},g=t.reduce((e,t)=>e+t.data.length,0);return(0,a.jsxs)("div",{className:"search-results-content mt-1 mb-2",children:[(0,a.jsxs)(l.ZP,{type:"text",className:"flex items-center text-xs text-gray-500 hover:text-gray-700",onClick:()=>d(!s),icon:(0,a.jsx)(o.Z,{}),children:[s?"Hide sources":"Show sources (".concat(g,")"),s?(0,a.jsx)(n.Z,{className:"ml-1"}):(0,a.jsx)(i.Z,{className:"ml-1"})]}),s&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md text-sm",children:(0,a.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs text-gray-600 mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-medium",children:"Query:"}),(0,a.jsxs)("span",{className:"italic",children:['"',e.search_query,'"']}),(0,a.jsx)("span",{className:"text-gray-400",children:"•"}),(0,a.jsxs)("span",{className:"text-gray-500",children:[e.data.length," result",1!==e.data.length?"s":""]})]}),(0,a.jsx)("div",{className:"space-y-2",children:e.data.map((e,s)=>{let r=m["".concat(t,"-").concat(s)]||!1;return(0,a.jsxs)("div",{className:"border border-gray-200 rounded-md overflow-hidden bg-white",children:[(0,a.jsx)("div",{className:"flex items-center justify-between p-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>x(t,s),children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform flex-shrink-0 ".concat(r?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,a.jsx)(c.Z,{className:"text-gray-400 flex-shrink-0",style:{fontSize:"12px"}}),(0,a.jsx)("span",{className:"text-xs font-medium text-gray-700 truncate",children:e.filename||e.file_id||"Result ".concat(s+1)}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-700 font-mono flex-shrink-0",children:e.score.toFixed(3)})]})}),r&&(0,a.jsx)("div",{className:"border-t border-gray-200 bg-white",children:(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[e.content.map((e,t)=>(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"text-xs font-mono bg-gray-50 p-2 rounded text-gray-800 whitespace-pre-wrap break-words",children:e.text})},t)),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-100",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Metadata:"}),(0,a.jsx)("div",{className:"space-y-1",children:Object.entries(e.attributes).map(e=>{let[t,s]=e;return(0,a.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,a.jsxs)("span",{className:"text-gray-500 font-medium",children:[t,":"]}),(0,a.jsx)("span",{className:"text-gray-700 font-mono break-all",children:String(s)})]},t)})})]})]})})]},s)})})]},t))})})]})}},26832:function(e,t,s){s.d(t,{O:function(){return o},m:function(){return n}});var a=s(93837),r=s(19250);let l=e=>{if(!e)return;let t={};if(e.id&&(t.taskId=e.id),e.contextId&&(t.contextId=e.contextId),e.status){var s;if(t.status={state:e.status.state,timestamp:e.status.timestamp},null===(s=e.status.message)||void 0===s?void 0:s.parts){let s=e.status.message.parts.filter(e=>"text"===e.kind&&e.text).map(e=>e.text).join(" ");s&&(t.status.message=s)}}return e.metadata&&"object"==typeof e.metadata&&(t.metadata=e.metadata),Object.keys(t).length>0?t:void 0},o=async(e,t,s,o,n,i,c,d,m)=>{let u=m||(0,r.getProxyBaseUrl)(),x=u?"".concat(u,"/a2a/").concat(e,"/message/send"):"/a2a/".concat(e,"/message/send"),g=(0,a.Z)(),p=(0,a.Z)().replace(/-/g,""),h=performance.now();try{var f,v,b;let a=await fetch(x,{method:"POST",headers:{[(0,r.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:g,method:"message/send",params:{message:{kind:"message",messageId:p,role:"user",parts:[{kind:"text",text:t}]}}}),signal:n}),m=performance.now()-h;if(i&&i(m),!a.ok){let e=await a.json();throw Error((null===(f=e.error)||void 0===f?void 0:f.message)||e.detail||"HTTP ".concat(a.status))}let u=await a.json(),y=performance.now()-h;if(c&&c(y),u.error)throw Error(u.error.message);let j=u.result;if(j){let t="",a=l(j);if(a&&d&&d(a),j.artifacts&&Array.isArray(j.artifacts)){for(let e of j.artifacts)if(e.parts&&Array.isArray(e.parts))for(let s of e.parts)"text"===s.kind&&s.text&&(t+=s.text)}else if(j.parts&&Array.isArray(j.parts))for(let e of j.parts)"text"===e.kind&&e.text&&(t+=e.text);else if(null===(b=j.status)||void 0===b?void 0:null===(v=b.message)||void 0===v?void 0:v.parts)for(let e of j.status.message.parts)"text"===e.kind&&e.text&&(t+=e.text);t?s(t,"a2a_agent/".concat(e)):(console.warn("Could not extract text from A2A response, showing raw JSON:",j),s(JSON.stringify(j,null,2),"a2a_agent/".concat(e)))}}catch(e){if(null==n?void 0:n.aborted){console.log("A2A request was cancelled");return}throw console.error("A2A send message error:",e),e}},n=async(e,t,s,o,n,i,c,d,m)=>{let u;let x=m||(0,r.getProxyBaseUrl)(),g=x?"".concat(x,"/a2a/").concat(e):"/a2a/".concat(e),p=(0,a.Z)(),h=(0,a.Z)().replace(/-/g,""),f=performance.now(),v=!1,b="";try{var y,j;let a=await fetch(g,{method:"POST",headers:{[(0,r.getGlobalLitellmHeaderName)()]:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:p,method:"message/stream",params:{message:{kind:"message",messageId:h,role:"user",parts:[{kind:"text",text:t}]}}}),signal:n});if(!a.ok){let e=await a.json();throw Error((null===(j=e.error)||void 0===j?void 0:j.message)||e.detail||"HTTP ".concat(a.status))}let m=null===(y=a.body)||void 0===y?void 0:y.getReader();if(!m)throw Error("No response body");let x=new TextDecoder,N="",w=!1;for(;!w;){let t=await m.read();w=t.done;let a=t.value;if(w)break;let r=(N+=x.decode(a,{stream:!0})).split("\n");for(let t of(N=r.pop()||"",r))if(t.trim())try{let a=JSON.parse(t);if(!v){v=!0;let e=performance.now()-f;i&&i(e)}let r=a.result;if(r){let t=l(r);t&&(u={...u,...t});let a=r.kind;if("artifact-update"===a&&r.artifact){let t=r.artifact;if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(b+=a.text,s(b,"a2a_agent/".concat(e)))}else if(r.artifacts&&Array.isArray(r.artifacts)){for(let t of r.artifacts)if(t.parts&&Array.isArray(t.parts))for(let a of t.parts)"text"===a.kind&&a.text&&(b+=a.text,s(b,"a2a_agent/".concat(e)))}else if("status-update"===a);else if(r.parts&&Array.isArray(r.parts))for(let t of r.parts)"text"===t.kind&&t.text&&(b+=t.text,s(b,"a2a_agent/".concat(e)))}if(a.error){let e=a.error.message||"Unknown A2A error";throw Error(e)}}catch(e){if(e instanceof Error&&e.message&&!e.message.includes("JSON"))throw e;t.trim().length>0&&console.warn("Failed to parse A2A streaming chunk:",t,e)}}let S=performance.now()-f;c&&c(S),u&&d&&d(u)}catch(e){if(null==n?void 0:n.aborted){console.log("A2A streaming request was cancelled");return}throw console.error("A2A stream message error:",e),e}}},95459:function(e,t,s){s.d(t,{n:function(){return l}});var a=s(7271),r=s(19250);async function l(e,t,s,l,o,n,i,c,d,m,u,x,g,p,h,f,v,b,y,j,N,w,S){console.log=function(){},console.log("isLocal:",!1);let _=j||(0,r.getProxyBaseUrl)(),k={};o&&o.length>0&&(k["x-litellm-tags"]=o.join(","));let P=new a.ZP.OpenAI({apiKey:l,baseURL:_,dangerouslyAllowBrowser:!0,defaultHeaders:k});try{let a;let r=Date.now(),l=!1,o={},j=!1,_=[];for await(let y of(p&&p.length>0&&(p.includes("__all__")?_.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp",require_approval:"never"}):p.forEach(e=>{let t=null==N?void 0:N.find(t=>t.server_id===e),s=(null==t?void 0:t.alias)||(null==t?void 0:t.server_name)||e,a=(null==w?void 0:w[e])||[];_.push({type:"mcp",server_label:"litellm",server_url:"litellm_proxy/mcp/".concat(s),require_approval:"never",...a.length>0?{allowed_tools:a}:{}})})),await P.chat.completions.create({model:s,stream:!0,stream_options:{include_usage:!0},litellm_trace_id:m,messages:e,...u?{vector_store_ids:u}:{},...x?{guardrails:x}:{},...g?{policies:g}:{},..._.length>0?{tools:_,tool_choice:"auto"}:{},...void 0!==v?{temperature:v}:{},...void 0!==b?{max_tokens:b}:{}},{signal:n}))){var C,A,I,E,Z,T,L,R,O;console.log("Stream chunk:",y);let e=null===(C=y.choices[0])||void 0===C?void 0:C.delta;if(console.log("Delta content:",null===(I=y.choices[0])||void 0===I?void 0:null===(A=I.delta)||void 0===A?void 0:A.content),console.log("Delta reasoning content:",null==e?void 0:e.reasoning_content),!l&&((null===(Z=y.choices[0])||void 0===Z?void 0:null===(E=Z.delta)||void 0===E?void 0:E.content)||e&&e.reasoning_content)&&(l=!0,a=Date.now()-r,console.log("First token received! Time:",a,"ms"),c?(console.log("Calling onTimingData with:",a),c(a)):console.log("onTimingData callback is not defined!")),null===(L=y.choices[0])||void 0===L?void 0:null===(T=L.delta)||void 0===T?void 0:T.content){let e=y.choices[0].delta.content;t(e,y.model)}if(e&&e.image&&h&&(console.log("Image generated:",e.image),h(e.image.url,y.model)),e&&e.reasoning_content){let t=e.reasoning_content;i&&i(t)}if(e&&(null===(R=e.provider_specific_fields)||void 0===R?void 0:R.search_results)&&f&&(console.log("Search results found:",e.provider_specific_fields.search_results),f(e.provider_specific_fields.search_results)),e&&e.provider_specific_fields){let t=e.provider_specific_fields;if(t.mcp_list_tools&&!o.mcp_list_tools&&(o.mcp_list_tools=t.mcp_list_tools,S&&!j)){j=!0;let e={type:"response.output_item.done",item_id:"mcp_list_tools",item:{type:"mcp_list_tools",tools:t.mcp_list_tools.map(e=>{var t,s,a;return{name:(null===(t=e.function)||void 0===t?void 0:t.name)||e.name||"",description:(null===(s=e.function)||void 0===s?void 0:s.description)||e.description||"",input_schema:(null===(a=e.function)||void 0===a?void 0:a.parameters)||e.input_schema||{}}})},timestamp:Date.now()};S(e),console.log("MCP list_tools event sent:",e)}t.mcp_tool_calls&&(o.mcp_tool_calls=t.mcp_tool_calls),t.mcp_call_results&&(o.mcp_call_results=t.mcp_call_results),(t.mcp_list_tools||t.mcp_tool_calls||t.mcp_call_results)&&console.log("MCP metadata found in chunk:",{mcp_list_tools:t.mcp_list_tools?"present":"absent",mcp_tool_calls:t.mcp_tool_calls?"present":"absent",mcp_call_results:t.mcp_call_results?"present":"absent"})}if(y.usage&&d){console.log("Usage data found:",y.usage);let e={completionTokens:y.usage.completion_tokens,promptTokens:y.usage.prompt_tokens,totalTokens:y.usage.total_tokens};(null===(O=y.usage.completion_tokens_details)||void 0===O?void 0:O.reasoning_tokens)&&(e.reasoningTokens=y.usage.completion_tokens_details.reasoning_tokens),void 0!==y.usage.cost&&null!==y.usage.cost&&(e.cost=parseFloat(y.usage.cost)),d(e)}}S&&(o.mcp_tool_calls||o.mcp_call_results)&&o.mcp_tool_calls&&o.mcp_tool_calls.length>0&&o.mcp_tool_calls.forEach((e,t)=>{var s,a,r,l;let n=(null===(s=e.function)||void 0===s?void 0:s.name)||e.name||"",i=(null===(a=e.function)||void 0===a?void 0:a.arguments)||e.arguments||"{}",c=(null===(r=o.mcp_call_results)||void 0===r?void 0:r.find(t=>t.tool_call_id===e.id||t.tool_call_id===e.call_id))||(null===(l=o.mcp_call_results)||void 0===l?void 0:l[t]),d={type:"response.output_item.done",item:{type:"mcp_call",name:n,arguments:"string"==typeof i?i:JSON.stringify(i),output:(null==c?void 0:c.result)?"string"==typeof c.result?c.result:JSON.stringify(c.result):void 0},item_id:e.id||e.call_id,timestamp:Date.now()};S(d),console.log("MCP call event sent:",d)});let k=Date.now();y&&y(k-r)}catch(e){throw(null==n?void 0:n.aborted)&&console.log("Chat completion request was cancelled"),e}}},91643:function(e,t,s){s.d(t,{o:function(){return r}});var a=s(19250);let r=async(e,t)=>{try{let s=t||(0,a.getProxyBaseUrl)(),r=await fetch(s?"".concat(s,"/v1/agents"):"/v1/agents",{method:"GET",headers:{[(0,a.getGlobalLitellmHeaderName)()]:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to fetch agents")}let l=await r.json();return console.log("Fetched agents:",l),l.sort((e,t)=>{let s=e.agent_name||e.agent_id,a=t.agent_name||t.agent_id;return s.localeCompare(a)}),l}catch(e){throw console.error("Error fetching agents:",e),e}}},99020:function(e,t,s){var a=s(57437),r=s(2265),l=s(37592),o=s(19250);t.Z=e=>{let{onChange:t,value:s,className:n,accessToken:i}=e,[c,d]=(0,r.useState)([]),[m,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(i)try{let e=await (0,o.tagListCall)(i);console.log("List tags response:",e),d(Object.values(e))}catch(e){console.error("Error fetching tags:",e)}finally{u(!1)}})()},[i]),(0,a.jsx)(l.default,{mode:"tags",showSearch:!0,placeholder:"Select or create tags",onChange:t,value:s,loading:m,className:n,options:c.map(e=>({label:e.name,value:e.name,title:e.description||e.name})),optionFilterProp:"label",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"}})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6399-a5f3d71ffad03be8.js b/litellm/proxy/_experimental/out/_next/static/chunks/6399-8797565c20b103df.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/6399-a5f3d71ffad03be8.js rename to litellm/proxy/_experimental/out/_next/static/chunks/6399-8797565c20b103df.js index 923c450722..81308d7390 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6399-a5f3d71ffad03be8.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6399-8797565c20b103df.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6399],{12579:function(e,t,s){s.d(t,{RM:function(){return a.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return o.Z},xs:function(){return i.Z},zx:function(){return n.Z}});var n=s(78489),r=s(21626),a=s(97214),l=s(28241),o=s(58834),i=s(69552),c=s(71876)},56399:function(e,t,s){s.d(t,{Z:function(){return eG}});var n=s(57437),r=s(2265),a=s(16312),l=s(22116),o=s(19250),i=s(12579),c=s(74998),d=s(44633),m=s(86462),p=s(49084),x=s(99981),u=s(23639),h=s(71594),g=s(24525),v=s(42673);let f=e=>{let t=new Set,s=/\{\{(\w+)\}\}/g;if(e.messages.forEach(e=>{let n;for(;null!==(n=s.exec(e.content));)t.add(n[1])}),e.developerMessage){let n;for(;null!==(n=s.exec(e.developerMessage));)t.add(n[1])}return Array.from(t)},j=e=>{let t=f(e),s="---\nmodel: ".concat(e.model,"\n");return void 0!==e.config.temperature&&(s+="temperature: ".concat(e.config.temperature,"\n")),void 0!==e.config.max_tokens&&(s+="max_tokens: ".concat(e.config.max_tokens,"\n")),void 0!==e.config.top_p&&(s+="top_p: ".concat(e.config.top_p,"\n")),s+="input:\n schema:\n",t.forEach(e=>{s+=" ".concat(e,": string\n")}),s+="output:\n format: text\n",e.tools&&e.tools.length>0&&(s+="tools:\n",e.tools.forEach(e=>{let t=JSON.parse(e.json);s+=" - ".concat(JSON.stringify(t),"\n")})),s+="---\n\n",e.developerMessage&&""!==e.developerMessage.trim()&&(s+="Developer: ".concat(e.developerMessage.trim(),"\n\n")),e.messages.forEach(e=>{let t=e.role.charAt(0).toUpperCase()+e.role.slice(1);s+="".concat(t,": ").concat(e.content,"\n\n")}),s.trim()},b=e=>{var t,s,n;let r=(null==e?void 0:null===(s=e.prompt_spec)||void 0===s?void 0:null===(t=s.litellm_params)||void 0===t?void 0:t.dotprompt_content)||"";if(!r)throw Error("No dotprompt_content found in API response");let a=r.split("---");if(a.length<3)throw Error("Invalid dotprompt format");let l=a[1],o=a.slice(2).join("---").trim(),i={};l.split("\n").forEach(e=>{let t=e.trim();if(t&&!t.startsWith("input:")&&!t.startsWith("output:")&&!t.startsWith("schema:")&&!t.startsWith("format:")){let e=t.indexOf(":");if(e>0){let s=t.substring(0,e).trim(),n=t.substring(e+1).trim();"temperature"===s||"max_tokens"===s||"top_p"===s?i[s]=parseFloat(n):"model"===s&&(i[s]=n)}}});let c="",d=[],m=o.split("\n"),p=null,x="";for(let e of m)e.startsWith("Developer:")?c=e.substring(10).trim():e.startsWith("User:")?(p&&x&&d.push({role:p,content:x.trim()}),p="user",x=e.substring(5).trim()):e.startsWith("Assistant:")?(p&&x&&d.push({role:p,content:x.trim()}),p="assistant",x=e.substring(10).trim()):e.trim()&&p&&(x+="\n"+e.trim());p&&x&&d.push({role:p,content:x.trim()});let u=(null==e?void 0:null===(n=e.prompt_spec)||void 0===n?void 0:n.prompt_id)||"Unnamed Prompt";return{name:N(u)||u,model:i.model||"gpt-4o",config:{temperature:i.temperature,max_tokens:i.max_tokens,top_p:i.top_p},tools:[],developerMessage:c,messages:d.length>0?d:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}},y=e=>{if(!e)return"1";let t=e.match(/[._-]v(\d+)$/);return t?t[1]:"1"},N=e=>e?e.replace(/[._-]v\d+$/,""):"",w=e=>{let t;if(!e)return{};let s={},n=/\{\{(\w+)\}\}/g;for(;null!==(t=n.exec(e));){let e=t[1];s[e]||(s[e]="example_".concat(e))}return s},_=e=>(null==e?void 0:e.prompt_id)||"",C=e=>{var t;let s=_(e);return(null==e?void 0:null===(t=e.litellm_params)||void 0===t?void 0:t.prompt_id)||s},k=e=>(null==e?void 0:e.version)?String(e.version):y(C(e)),S=e=>{try{var t;let s=e.litellm_params;if(null==s?void 0:s.dotprompt_content){let e=s.dotprompt_content.match(/model:\s*([^\n]+)/);if(e)return e[1].trim()}if(null==s?void 0:null===(t=s.prompt_data)||void 0===t?void 0:t.model)return s.prompt_data.model;if(null==s?void 0:s.model)return s.model;return null}catch(e){return console.error("Error extracting model:",e),null}},Z=(e,t)=>{if(!e)return null;let s=t.get(e);return s&&s.providers&&s.providers.length>0?s.providers[0]:null};var P=e=>{let{promptsList:t,isLoading:s,onPromptClick:a,onDeleteClick:l,accessToken:f,isAdmin:j}=e,[b,y]=(0,r.useState)([{id:"created_at",desc:!0}]),[N,w]=(0,r.useState)(new Map);(0,r.useEffect)(()=>{(async()=>{if(f)try{let e=await (0,o.modelHubCall)(f);if(null==e?void 0:e.data){let t=new Map;e.data.forEach(e=>{t.set(e.model_group,e)}),w(t)}}catch(e){console.error("Error fetching model hub data:",e)}})()},[f]);let _=e=>e?new Date(e).toLocaleString():"-",C=e=>{navigator.clipboard.writeText(e)},k=[{header:"Prompt ID",accessorKey:"prompt_id",cell:e=>{let t=String(e.getValue()||""),s=t.length>25?"".concat(t.slice(0,25),"..."):t;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(x.Z,{title:t,children:(0,n.jsx)(i.zx,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[220px] justify-start",onClick:()=>e.getValue()&&(null==a?void 0:a(e.getValue())),children:s})}),(0,n.jsx)(x.Z,{title:"Copy prompt ID",children:(0,n.jsx)(u.Z,{onClick:e=>{e.stopPropagation(),C(t)},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Model",accessorKey:"model",cell:e=>{let{row:t}=e,s=S(t.original);if(!s)return(0,n.jsx)("span",{className:"text-xs text-gray-400",children:"-"});let r=Z(s,N),{logo:a}=(0,v.dr)(r||"");return(0,n.jsx)(x.Z,{title:s,children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:r&&a?(0,n.jsx)("img",{src:a,alt:"".concat(r," logo"),className:"w-4 h-4",onError:e=>{let t=e.currentTarget,s=t.parentElement;if(s&&s.contains(t))try{let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null==r?void 0:r.charAt(0))||"-",s.replaceChild(e,t)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,n.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,n.jsx)("span",{className:"max-w-[15ch] truncate block",children:s})]})})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:_(s.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:_(s.updated_at)})})}},{header:"Type",accessorKey:"prompt_info.prompt_type",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.prompt_info.prompt_type,children:(0,n.jsx)("span",{className:"text-xs",children:s.prompt_info.prompt_type})})}},...j?[{header:"Actions",id:"actions",enableSorting:!1,cell:e=>{let{row:t}=e,s=t.original,r=s.prompt_id||"Unknown Prompt";return(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(x.Z,{title:"Delete prompt",children:(0,n.jsx)(i.zx,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),null==l||l(s.prompt_id,r)},icon:c.Z,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],P=(0,h.b7)({data:t,columns:k,state:{sorting:b},onSortingChange:y,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,n.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(i.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(i.ss,{children:P.getHeaderGroups().map(e=>(0,n.jsx)(i.SC,{children:e.headers.map(e=>(0,n.jsx)(i.xs,{className:"py-1 h-8",onClick:e.column.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,h.ie)(e.column.columnDef.header,e.getContext())}),(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(d.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(m.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(i.RM,{children:s?(0,n.jsx)(i.SC,{children:(0,n.jsx)(i.pj,{colSpan:k.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):t.length>0?P.getRowModel().rows.map(e=>(0,n.jsx)(i.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(i.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,h.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(i.SC,{children:(0,n.jsx)(i.pj,{colSpan:k.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No prompts found"})})})})})]})})})},T=s(84717),D=s(5545),E=s(77331),z=s(93416),O=s(59872),A=s(30401),I=s(78867),L=s(9114),M=s(37592),F=s(65869),B=s(11894),R=s(19431),J=s(17906),U=s(57365),V=e=>{let{promptId:t,model:s,promptVariables:a={},accessToken:o,version:i="1",proxySettings:c}=e,[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)("curl"),[u,h]=(0,r.useState)("basic"),[g,v]=(0,r.useState)(""),f=window.location.origin,j=null==c?void 0:c.LITELLM_UI_API_DOC_BASE_URL;j&&j.trim()?f=j:(null==c?void 0:c.PROXY_BASE_URL)&&(f=c.PROXY_BASE_URL);let b=o||"sk-1234",y=()=>{let e=Object.keys(a).length>0;if("curl"===p)return"basic"===u?"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,6).replace(/\n/g,"\n ")):"","\n }' | jq"):"messages"===u?"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,6).replace(/\n/g,"\n ")):"",',\n "messages": [\n {\n "role": "user",\n "content": "hi"\n }\n ]\n }\' | jq'):"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'",\n "prompt_version": ').concat(i,',\n "messages": [\n {\n "role": "user",\n "content": "Who are u"\n }\n ]\n }\' | jq');if("python"===p){let n='import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(b,'",\n base_url="').concat(f,'"\n)\n');return"basic"===u?"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n extra_body={\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):"","\n }\n)\n\nprint(response)"):"messages"===u?"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n messages=[\n {"role": "user", "content": "hi"}\n ],\n extra_body={\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):"","\n }\n)\n\nprint(response)"):"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n messages=[\n {"role": "user", "content": "Who are u"}\n ],\n extra_body={\n "prompt_id": "').concat(t,'",\n "prompt_version": ').concat(i,"\n }\n)\n\nprint(response)")}{let n="import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: \"".concat(b,'",\n baseURL: "').concat(f,'"\n});\n');return"basic"===u?"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n ').concat(e?'prompt_id: "'.concat(t,'",\n prompt_variables: ').concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):'prompt_id: "'.concat(t,'"'),"\n });\n \n console.log(response);\n}\n\nmain();"):"messages"===u?"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n messages: [\n { role: "user", content: "hi" }\n ],\n ').concat(e?'prompt_id: "'.concat(t,'",\n prompt_variables: ').concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):'prompt_id: "'.concat(t,'"'),"\n });\n \n console.log(response);\n}\n\nmain();"):"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n messages: [\n { role: "user", content: "Who are u" }\n ],\n prompt_id: "').concat(t,'",\n prompt_version: ').concat(i,"\n });\n \n console.log(response);\n}\n\nmain();")}};return r.useEffect(()=>{d&&v(y())},[d,p,u,t,s,a]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.z,{variant:"secondary",icon:B.Z,onClick:()=>{m(!0)},children:"Get Code"}),(0,n.jsxs)(l.Z,{title:"Generated Code",open:d,onCancel:()=>{m(!1)},footer:null,width:800,children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(R.x,{className:"font-medium block mb-1 text-gray-700",children:"Language"}),(0,n.jsx)(M.default,{value:p,onChange:e=>x(e),style:{width:180},options:[{value:"curl",label:"cURL"},{value:"python",label:"Python (OpenAI SDK)"},{value:"javascript",label:"JavaScript (OpenAI SDK)"}]})]}),(0,n.jsx)(D.ZP,{onClick:()=>{navigator.clipboard.writeText(g),L.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,n.jsx)(F.default,{activeKey:u,onChange:h,items:[{label:"Basic",key:"basic"},{label:"With Messages",key:"messages"},{label:"With Version",key:"version"}]}),(0,n.jsx)(J.Z,{language:"curl"===p?"bash":"python"===p?"python":"javascript",style:U.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md mt-0",customStyle:{maxHeight:"60vh",overflowY:"auto",marginTop:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:g})]})]})},W=e=>{var t,s,a;let{promptId:i,onClose:d,accessToken:m,isAdmin:p,onDelete:x,onEdit:u}=e,[h,g]=(0,r.useState)(null),[v,f]=(0,r.useState)(null),[j,b]=(0,r.useState)(null),[y,N]=(0,r.useState)(!0),[C,Z]=(0,r.useState)({}),[P,M]=(0,r.useState)(!1),[F,B]=(0,r.useState)(!1),R=async()=>{try{if(N(!0),!m)return;let e=await (0,o.getPromptInfo)(m,i);g(e.prompt_spec),f(e.raw_prompt_template),b(e)}catch(e){L.Z.fromBackend("Failed to load prompt information"),console.error("Error fetching prompt info:",e)}finally{N(!1)}};if((0,r.useEffect)(()=>{R()},[i,m]),y)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!h)return(0,n.jsx)("div",{className:"p-4",children:"Prompt not found"});let J=e=>e?new Date(e).toLocaleString():"-",U=async(e,t)=>{await (0,O.vQ)(e)&&(Z(e=>({...e,[t]:!0})),setTimeout(()=>{Z(e=>({...e,[t]:!1}))},2e3))},W=async()=>{if(m&&h){B(!0);try{await (0,o.deletePromptCall)(m,H),L.Z.success('Prompt "'.concat(H,'" deleted successfully')),null==x||x(),d()}catch(e){console.error("Error deleting prompt:",e),L.Z.fromBackend("Failed to delete prompt")}finally{B(!1),M(!1)}}},K=h&&S(h)||"gpt-4o",H=_(h),q=k(h);return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.zx,{icon:E.Z,variant:"light",onClick:d,className:"mb-4",children:"Back to Prompts"}),(0,n.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.Dx,{children:"Prompt Details"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(T.xv,{className:"text-gray-500 font-mono",children:H}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["prompt-id"]?(0,n.jsx)(A.Z,{size:12}):(0,n.jsx)(I.Z,{size:12}),onClick:()=>U(H,"prompt-id"),className:"left-2 z-10 transition-all duration-200 ".concat(C["prompt-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(V,{promptId:H,model:K,promptVariables:w(null==v?void 0:v.content),accessToken:m,version:q}),(0,n.jsx)(T.zx,{icon:z.Z,variant:"primary",onClick:()=>null==u?void 0:u(j),className:"flex items-center",children:"Prompt Studio"}),p&&(0,n.jsx)(T.zx,{icon:c.Z,variant:"secondary",onClick:()=>{M(!0)},className:"flex items-center",children:"Delete Prompt"})]})]})]}),(0,n.jsxs)(T.v0,{children:[(0,n.jsxs)(T.td,{className:"mb-4",children:[(0,n.jsx)(T.OK,{children:"Overview"},"overview"),v?(0,n.jsx)(T.OK,{children:"Prompt Template"},"prompt-template"):(0,n.jsx)(n.Fragment,{}),p?(0,n.jsx)(T.OK,{children:"Details"},"details"):(0,n.jsx)(n.Fragment,{}),(0,n.jsx)(T.OK,{children:"Raw JSON"},"raw-json")]}),(0,n.jsxs)(T.nP,{children:[(0,n.jsxs)(T.x4,{children:[(0,n.jsxs)(T.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Prompt ID"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(T.Dx,{className:"font-mono text-sm",children:H})})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Version"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:q}),(0,n.jsxs)(T.Ct,{color:"blue",className:"mt-1",children:["v",q]})]})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Prompt Type"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:(null===(t=h.prompt_info)||void 0===t?void 0:t.prompt_type)||"-"}),(0,n.jsx)(T.Ct,{color:"blue",className:"mt-1",children:(null===(s=h.prompt_info)||void 0===s?void 0:s.prompt_type)||"Unknown"})]})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:J(h.created_at)}),(0,n.jsxs)(T.xv,{children:["Last Updated: ",J(h.updated_at)]})]})]})]}),h.litellm_params&&Object.keys(h.litellm_params).length>0&&(0,n.jsxs)(T.Zb,{className:"mt-6",children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"LiteLLM Parameters"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(h.litellm_params,null,2)})})]})]}),v&&(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(T.Dx,{children:"Prompt Template"}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["prompt-content"]?(0,n.jsx)(A.Z,{size:16}):(0,n.jsx)(I.Z,{size:16}),onClick:()=>U(v.content,"prompt-content"),className:"transition-all duration-200 ".concat(C["prompt-content"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:C["prompt-content"]?"Copied!":"Copy Content"})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Template ID"}),(0,n.jsx)("div",{className:"font-mono text-sm bg-gray-50 p-2 rounded",children:v.litellm_prompt_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Content"}),(0,n.jsx)("div",{className:"mt-2 p-4 bg-gray-50 rounded-md border overflow-auto max-h-96",children:(0,n.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:v.content})})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Template Metadata"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap overflow-auto max-h-64",children:JSON.stringify(v.metadata,null,2)})})]})]})]})}),p&&(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.Dx,{className:"mb-4",children:"Prompt Details"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt ID"}),(0,n.jsx)("div",{className:"font-mono text-sm bg-gray-50 p-2 rounded",children:H})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt Type"}),(0,n.jsx)("div",{children:(null===(a=h.prompt_info)||void 0===a?void 0:a.prompt_type)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:J(h.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:J(h.updated_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"LiteLLM Parameters"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap overflow-auto max-h-96",children:JSON.stringify(h.litellm_params,null,2)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt Info"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(h.prompt_info,null,2)})})]})]})]})}),(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(T.Dx,{children:"Raw API Response"}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["raw-json"]?(0,n.jsx)(A.Z,{size:16}):(0,n.jsx)(I.Z,{size:16}),onClick:()=>U(JSON.stringify(j,null,2),"raw-json"),className:"transition-all duration-200 ".concat(C["raw-json"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:C["raw-json"]?"Copied!":"Copy JSON"})]}),(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border overflow-auto",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(j,null,2)})})]})})]})]}),(0,n.jsxs)(l.Z,{title:"Delete Prompt",open:P,onOk:W,onCancel:()=>{M(!1)},confirmLoading:F,okText:"Delete",okButtonProps:{danger:!0},children:[(0,n.jsxs)("p",{children:["Are you sure you want to delete prompt: ",(0,n.jsx)("strong",{children:H}),"?"]}),(0,n.jsx)("p",{children:"This action cannot be undone."})]})]})},K=s(10032),H=s(23496),q=s(65319),G=s(31283),X=s(3632);let{Option:Y}=M.default;var $=e=>{let{visible:t,onClose:s,accessToken:a,onSuccess:i}=e,[c]=K.Z.useForm(),[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)([]),[u,h]=(0,r.useState)("dotprompt"),g=()=>{c.resetFields(),x([]),h("dotprompt"),s()},v=async()=>{try{let e=await c.validateFields();if(console.log("values: ",e),!a){L.Z.fromBackend("Access token is required");return}if("dotprompt"===u&&0===p.length){L.Z.fromBackend("Please upload a .prompt file");return}m(!0);let t={};if("dotprompt"===u&&p.length>0){let s=p[0].originFileObj;try{let n=await (0,o.convertPromptFileToJson)(a,s);console.log("Conversion result:",n),t={prompt_id:e.prompt_id,litellm_params:{prompt_integration:"dotprompt",prompt_id:n.prompt_id,prompt_data:n.json_data},prompt_info:{prompt_type:"db"}}}catch(e){console.error("Error converting prompt file:",e),L.Z.fromBackend("Failed to convert prompt file to JSON"),m(!1);return}}try{await (0,o.createPromptCall)(a,t),L.Z.success("Prompt created successfully!"),g(),i()}catch(e){console.error("Error creating prompt:",e),L.Z.fromBackend("Failed to create prompt")}}catch(e){console.error("Form validation error:",e)}finally{m(!1)}};return(0,n.jsx)(l.Z,{title:"Add New Prompt",open:t,onCancel:g,footer:[(0,n.jsx)(D.ZP,{onClick:g,children:"Cancel"},"cancel"),(0,n.jsx)(D.ZP,{loading:d,onClick:v,children:"Create Prompt"},"submit")],width:600,children:(0,n.jsxs)(K.Z,{form:c,layout:"vertical",requiredMark:!1,children:[(0,n.jsx)(K.Z.Item,{label:"Prompt ID",name:"prompt_id",rules:[{required:!0,message:"Please enter a prompt ID"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Prompt ID can only contain letters, numbers, underscores, and hyphens"}],children:(0,n.jsx)(G.o,{placeholder:"Enter unique prompt ID (e.g., my_prompt_id)"})}),(0,n.jsx)(K.Z.Item,{label:"Prompt Integration",name:"prompt_integration",initialValue:"dotprompt",children:(0,n.jsx)(M.default,{value:u,onChange:h,children:(0,n.jsx)(Y,{value:"dotprompt",children:"dotprompt"})})}),"dotprompt"===u&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.Z,{}),(0,n.jsxs)(K.Z.Item,{label:"Prompt File",extra:"Upload a .prompt file that follows the Dotprompt specification",children:[(0,n.jsx)(q.default,{beforeUpload:e=>(e.name.endsWith(".prompt")||L.Z.fromBackend("Please upload a .prompt file"),!1),fileList:p,onChange:e=>{let{fileList:t}=e;x(t.slice(-1))},onRemove:()=>{x([])},children:(0,n.jsx)(D.ZP,{icon:(0,n.jsx)(X.Z,{}),children:"Select .prompt File"})}),p.length>0&&(0,n.jsxs)("div",{className:"mt-2 text-sm text-gray-600",children:["Selected: ",p[0].name]})]})]})]})})},Q=e=>{let{visible:t,initialJson:s,onSave:a,onClose:o}=e,[i,c]=(0,r.useState)(s||'{\n "type": "function",\n "function": {\n "name": "get_current_weather",\n "description": "Get the current weather in a given location",\n "parameters": {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": {\n "type": "string",\n "enum": ["celsius", "fahrenheit"]\n }\n },\n "required": ["location"]\n }\n }\n}'),[d,m]=(0,r.useState)(null),p=()=>{m(null),o()};return(0,n.jsx)(l.Z,{title:(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsx)("span",{className:"text-lg font-medium",children:"Add Tool"})}),open:t,onCancel:p,width:800,footer:[(0,n.jsx)(D.ZP,{onClick:p,children:"Cancel"},"cancel"),(0,n.jsx)(D.ZP,{type:"primary",onClick:()=>{try{JSON.parse(i),m(null),a(i)}catch(e){m("Invalid JSON format. Please check your syntax.")}},children:"Add"},"save")],children:(0,n.jsxs)("div",{className:"space-y-3",children:[d&&(0,n.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:d}),(0,n.jsx)("textarea",{value:i,onChange:e=>c(e.target.value),className:"w-full min-h-[400px] px-4 py-3 border border-gray-300 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",placeholder:"Paste your tool JSON here..."})]})})},ee=s(4260),et=s(32660),es=s(91723),en=s(83229),er=e=>{let{promptName:t,onNameChange:s,onBack:r,onSave:l,isSaving:o,editMode:i=!1,onShowHistory:c,version:d,promptModel:m="gpt-4o",promptVariables:p={},accessToken:x,proxySettings:u}=e;return(0,n.jsxs)("div",{className:"bg-white border-b border-gray-200 px-6 py-3 flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,n.jsx)(a.z,{icon:et.Z,variant:"light",onClick:r,size:"xs",children:"Back"}),(0,n.jsx)(ee.default,{value:t,onChange:e=>s(e.target.value),className:"text-base font-medium border-none shadow-none",style:{width:"200px"}}),d&&(0,n.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium",children:d}),(0,n.jsx)("span",{className:"px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:"Draft"}),(0,n.jsx)("span",{className:"text-xs text-gray-400",children:"Unsaved changes"})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(V,{promptId:t,model:m,promptVariables:p,accessToken:x,version:(null==d?void 0:d.replace("v",""))||"1",proxySettings:u}),i&&c&&(0,n.jsx)(a.z,{icon:es.Z,variant:"secondary",onClick:c,children:"History"}),(0,n.jsx)(a.z,{icon:en.Z,onClick:l,loading:o,disabled:o,children:i?"Update":"Save"})]})]})},ea=s(92280),el=s(98728),eo=s(76593),ei=e=>{let{model:t,temperature:s=1,maxTokens:a=1e3,accessToken:l,onModelChange:o,onTemperatureChange:i,onMaxTokensChange:c}=e,[d,m]=(0,r.useState)(!1);return(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"w-[300px]",children:(0,n.jsx)(eo.Z,{accessToken:l||"",value:t,onChange:o,showLabel:!1})}),(0,n.jsxs)("button",{onClick:()=>m(!d),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[(0,n.jsx)(el.Z,{size:16}),(0,n.jsx)("span",{children:"Parameters"})]}),d&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-30",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-96",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Model Parameters"}),(0,n.jsx)("button",{onClick:()=>m(!1),className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ea.x,{className:"text-sm text-gray-700",children:"Temperature"}),(0,n.jsx)(ee.default,{type:"number",size:"small",min:0,max:2,step:.1,value:s,onChange:e=>i(parseFloat(e.target.value)||0),className:"w-20"})]})}),(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ea.x,{className:"text-sm text-gray-700",children:"Max Tokens"}),(0,n.jsx)(ee.default,{type:"number",size:"small",min:1,max:32768,value:a,onChange:e=>c(parseInt(e.target.value)||1e3),className:"w-24"})]})})]})]})})]})},ec=s(78801),ed=s(99397),em=s(27413),ep=e=>{let{tools:t,onAddTool:s,onEditTool:r,onRemoveTool:a}=e;return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ec.x,{className:"text-sm font-medium",children:"Tools"}),(0,n.jsxs)("button",{onClick:s,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,n.jsx)(ed.Z,{size:14,className:"mr-1"}),"Add"]})]}),0===t.length?(0,n.jsx)(ec.x,{className:"text-gray-500 text-xs",children:"No tools added"}):(0,n.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 border border-gray-200 rounded",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium text-xs truncate",children:e.name}),(0,n.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 ml-2",children:[(0,n.jsx)("button",{onClick:()=>r(t),className:"text-xs text-blue-600 hover:text-blue-700",children:"Edit"}),(0,n.jsx)("button",{onClick:()=>a(t),className:"text-gray-400 hover:text-red-500",children:(0,n.jsx)(em.Z,{size:14})})]})]},t))})]})},ex=s(79326),eu=s(3810),eh=s(13377);let{TextArea:eg}=ee.default;var ev=e=>{let{value:t,onChange:s,placeholder:a,rows:l=4,className:o}=e,[i,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(""),p=()=>{d.trim()&&i&&(s(t.substring(0,i.start)+"{{".concat(d,"}}")+t.substring(i.end)),c(null),m(""))},x=(()=>{let e;let s=/\{\{(\w+)\}\}/g,n=[];for(;null!==(e=s.exec(t));)n.push({name:e[1],start:e.index,end:e.index+e[0].length});return n})();return(0,n.jsxs)("div",{className:"variable-textarea-container ".concat(o),children:[(0,n.jsx)("style",{children:"\n .variable-highlight-text {\n color: #f97316;\n background-color: #fff7ed;\n border-radius: 4px;\n padding: 0 2px;\n border: 1px solid #fed7aa;\n font-family: monospace;\n }\n "}),(0,n.jsx)(eg,{value:t,onChange:e=>s(e.target.value),placeholder:a,rows:l,className:"font-sans"}),x.length>0&&(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 items-center",children:[(0,n.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Detected variables:"}),x.map((e,t)=>(0,n.jsx)(ex.Z,{content:(0,n.jsxs)("div",{className:"p-2",style:{minWidth:"200px"},children:[(0,n.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Edit variable name"}),(0,n.jsx)(ee.default,{size:"small",value:d,onChange:e=>m(e.target.value),onPressEnter:p,placeholder:"Variable name",autoFocus:!0}),(0,n.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,n.jsx)("button",{onClick:p,className:"text-xs px-2 py-1 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Save"}),(0,n.jsx)("button",{onClick:()=>{c(null),m("")},className:"text-xs px-2 py-1 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})]})]}),open:(null==i?void 0:i.start)===e.start,onOpenChange:e=>{e||(c(null),m(""))},trigger:"click",children:(0,n.jsx)(eu.Z,{color:"orange",className:"cursor-pointer hover:opacity-80 transition-all m-0",icon:(0,n.jsx)(eh.Z,{}),onClick:()=>{c({oldName:e.name,start:e.start,end:e.end}),m(e.name)},children:e.name})},"".concat(e.start,"-").concat(t)))]})]})},ef=e=>{let{value:t,onChange:s}=e;return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsx)(ec.x,{className:"block mb-2 text-sm font-medium",children:"Developer message"}),(0,n.jsx)(ec.x,{className:"text-gray-500 text-xs mb-2",children:"Optional system instructions for the model"}),(0,n.jsx)(ev,{value:t,onChange:s,rows:3,placeholder:"e.g., You are a helpful assistant..."})]})},ej=s(41905);let{Option:eb}=M.default;var ey=e=>{let{messages:t,onAddMessage:s,onUpdateMessage:a,onRemoveMessage:l,onMoveMessage:o}=e,[i,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),p=e=>{c(e)},x=(e,t)=>{e.preventDefault(),m(t)},u=(e,t)=>{e.preventDefault(),null!==i&&i!==t&&o(i,t),c(null),m(null)},h=()=>{c(null),m(null)};return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)(ec.x,{className:"text-sm font-medium",children:"Prompt messages"}),(0,n.jsxs)(ec.x,{className:"text-gray-500 text-xs mt-1",children:["Use ",(0,n.jsx)("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"{{variable}}"})," syntax for template variables"]})]}),(0,n.jsx)("div",{className:"space-y-2",children:t.map((e,s)=>(0,n.jsxs)("div",{draggable:!0,onDragStart:()=>p(s),onDragOver:e=>x(e,s),onDrop:e=>u(e,s),onDragEnd:h,className:"border border-gray-300 rounded overflow-hidden bg-white transition-all ".concat(i===s?"opacity-50":""," ").concat(d===s&&i!==s?"border-blue-500 border-2":""),children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-2 py-1.5 border-b border-gray-300 flex items-center justify-between",children:[(0,n.jsxs)(M.default,{value:e.role,onChange:e=>a(s,"role",e),style:{width:100},size:"small",bordered:!1,children:[(0,n.jsx)(eb,{value:"user",children:"User"}),(0,n.jsx)(eb,{value:"assistant",children:"Assistant"}),(0,n.jsx)(eb,{value:"system",children:"System"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[t.length>1&&(0,n.jsx)("button",{onClick:()=>l(s),className:"text-gray-400 hover:text-red-500",children:(0,n.jsx)(em.Z,{size:14})}),(0,n.jsx)("div",{className:"cursor-grab active:cursor-grabbing text-gray-400 hover:text-gray-600",children:(0,n.jsx)(ej.Z,{size:16})})]})]}),(0,n.jsx)("div",{className:"p-2",children:(0,n.jsx)(ev,{value:e.content,onChange:e=>a(s,"content",e),rows:3,placeholder:"Enter prompt content..."})})]},s))}),(0,n.jsxs)("button",{onClick:s,className:"mt-2 text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,n.jsx)(ed.Z,{size:14,className:"mr-1"}),"Add message"]})]})},eN=s(26430);let ew=(e,t)=>{let[s,n]=(0,r.useState)(!1),[a,l]=(0,r.useState)([]),[i,c]=(0,r.useState)(""),[d,m]=(0,r.useState)({}),[p,x]=(0,r.useState)(!1),[u,h]=(0,r.useState)(null),g=(0,r.useRef)(null),v=f(e),b=v.every(e=>d[e]&&""!==d[e].trim()),y=()=>{g.current&&setTimeout(()=>{var e;null===(e=g.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)};(0,r.useEffect)(()=>{y()},[a]);let N=async()=>{let s;if(!t){L.Z.fromBackend("Access token is required");return}if(v.length>0&&!b){L.Z.fromBackend("Please fill in all template variables");return}if(!i.trim())return;!p&&v.length>0&&x(!0);let r={role:"user",content:i};l(e=>[...e,r]),c("");let m=new AbortController;h(m),n(!0);let u=Date.now();try{let n,r;let c=j(e),p=(0,o.getProxyBaseUrl)(),x={dotprompt_content:c};0===a.length?x.prompt_variables=d:x.conversation_history=[...a.map(e=>({role:e.role,content:e.content})),{role:"user",content:i}];let h=await fetch("".concat(p,"/prompts/test"),{method:"POST",headers:{[(0,o.getGlobalLitellmHeaderName)()]:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(!h.ok){let e=await h.text();throw Error("HTTP error! status: ".concat(h.status,", ").concat(e))}if(!h.body)throw Error("No response body");let v=h.body.getReader(),b=new TextDecoder,N="";for(l(e=>[...e,{role:"assistant",content:""}]);;){let{done:e,value:t}=await v.read();if(e)break;for(let e of b.decode(t).split("\n"))if(e.startsWith("data: ")){let t=e.slice(6);if("[DONE]"===t)continue;try{var g,f,y;let e=JSON.parse(t);!n&&e.model&&(n=e.model),e.usage&&(r=e.usage);let a=null===(y=e.choices)||void 0===y?void 0:null===(f=y[0])||void 0===f?void 0:null===(g=f.delta)||void 0===g?void 0:g.content;a&&(s||(s=Date.now()-u),N+=a,l(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:N,model:n,timeToFirstToken:s},t}))}catch(e){console.error("Error parsing chunk:",e)}}}let w=Date.now()-u;l(e=>{let t=[...e];return t[t.length-1]={...t[t.length-1],totalLatency:w,usage:r},t})}catch(e){"AbortError"===e.name?console.log("Request was cancelled"):(console.error("Error testing prompt:",e),l(t=>{let s=t[t.length-1];return s&&"assistant"===s.role&&""===s.content?[...t.slice(0,-1),{role:"assistant",content:"Error: ".concat(e.message)}]:[...t,{role:"assistant",content:"Error: ".concat(e.message)}]}))}finally{n(!1),h(null)}};return{isLoading:s,messages:a,inputMessage:i,variables:d,variablesFilled:p,extractedVariables:v,allVariablesFilled:b,messagesEndRef:g,setInputMessage:c,handleSendMessage:N,handleCancelRequest:()=>{u&&(u.abort(),h(null),n(!1),L.Z.info("Request cancelled"))},handleClearConversation:()=>{l([]),x(!1),L.Z.success("Chat history cleared.")},handleKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),N())},handleVariableChange:(e,t)=>{m({...d,[e]:t})}}};var e_=e=>{let{extractedVariables:t,variables:s,onVariableChange:r}=e;return 0===t.length?null:(0,n.jsxs)("div",{className:"p-4 border-b border-gray-200 bg-blue-50",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Fill in template variables to start testing"}),(0,n.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-xs text-gray-600 mb-1 font-medium",children:["{{",e,"}}"]}),(0,n.jsx)(ee.default,{value:s[e]||"",onChange:t=>r(e,t.target.value),placeholder:"Enter value for ".concat(e),size:"small"})]},e))})]})},eC=s(61935),ek=s(10353),eS=s(69993),eZ=e=>{let{hasVariables:t}=e;return(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(eS.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)("span",{className:"text-base",children:t?"Fill in the variables above, then type a message to start testing":"Type a message below to start testing your prompt"})]})},eP=s(15883),eT=s(62831),eD=s(38398),eE=e=>{let{message:t}=e;return(0,n.jsx)("div",{className:"mb-4 flex ".concat("user"===t.role?"justify-end":"justify-start"),children:(0,n.jsxs)("div",{className:"max-w-[85%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===t.role?"#f0f8ff":"#ffffff",border:"user"===t.role?"1px solid #e6f0fa":"1px solid #f0f0f0"},children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===t.role?"#e6f0fa":"#f5f5f5"},children:"user"===t.role?(0,n.jsx)(eP.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,n.jsx)(eS.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,n.jsx)("strong",{className:"text-sm capitalize",children:t.role}),"assistant"===t.role&&t.model&&(0,n.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:t.model})]}),(0,n.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:["assistant"===t.role?(0,n.jsx)(eT.UG,{components:{code(e){let{node:t,inline:s,className:r,children:a,...l}=e,o=/language-(\w+)/.exec(r||"");return!s&&o?(0,n.jsx)(J.Z,{style:U.Z,language:o[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(a).replace(/\n$/,"")}):(0,n.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...l,children:a})},pre:e=>{let{node:t,...s}=e;return(0,n.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:t.content}):(0,n.jsx)("div",{className:"whitespace-pre-wrap",children:t.content}),"assistant"===t.role&&(t.timeToFirstToken||t.totalLatency||t.usage)&&(0,n.jsx)(eD.Z,{timeToFirstToken:t.timeToFirstToken,totalLatency:t.totalLatency,usage:t.usage})]})]})})},ez=e=>{let{messages:t,isLoading:s,hasVariables:r,messagesEndRef:a}=e,l=(0,n.jsx)(eC.Z,{style:{fontSize:24},spin:!0});return(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 pb-0",children:[0===t.length&&(0,n.jsx)(eZ,{hasVariables:r}),t.map((e,t)=>(0,n.jsx)(eE,{message:e},t)),s&&(0,n.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,n.jsx)(ek.Z,{indicator:l})}),(0,n.jsx)("div",{ref:a,style:{height:"1px"}})]})},eO=e=>{let{extractedVariables:t,variables:s}=e,r=t.filter(e=>!s[e]||""===s[e].trim());return 0===r.length?null:(0,n.jsx)("div",{className:"mb-3 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)("span",{className:"text-yellow-600 text-sm",children:"⚠️"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium mb-1",children:"Please fill in all template variables above"}),(0,n.jsxs)("p",{className:"text-xs text-yellow-700",children:["Missing: ",r.map(e=>"{{".concat(e,"}}")).join(", ")]})]})]})})},eA=s(79276);let{TextArea:eI}=ee.default;var eL=e=>{let{inputMessage:t,isLoading:s,isDisabled:r,onInputChange:l,onSend:o,onKeyDown:i,onCancel:c}=e;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,n.jsx)(eI,{value:t,onChange:e=>l(e.target.value),onKeyDown:i,placeholder:"Type your message... (Shift+Enter for new line)",disabled:s,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,n.jsx)(a.z,{onClick:o,disabled:r,className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,n.jsx)(eA.Z,{style:{fontSize:"14px"}})})]}),s&&(0,n.jsx)(a.z,{onClick:c,className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",children:"Cancel"})]})},eM=e=>{let{prompt:t,accessToken:s}=e,{isLoading:r,messages:l,inputMessage:o,variables:i,variablesFilled:c,extractedVariables:d,allVariablesFilled:m,messagesEndRef:p,setInputMessage:x,handleSendMessage:u,handleCancelRequest:h,handleClearConversation:g,handleKeyDown:v,handleVariableChange:f}=ew(t,s);return(0,n.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[!c&&(0,n.jsx)(e_,{extractedVariables:d,variables:i,onVariableChange:f}),l.length>0&&(0,n.jsx)("div",{className:"p-3 border-b border-gray-200 bg-white flex justify-end",children:(0,n.jsx)(a.z,{onClick:g,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:eN.Z,children:"Clear Chat"})}),(0,n.jsx)(ez,{messages:l,isLoading:r,hasVariables:d.length>0,messagesEndRef:p}),(0,n.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[(0,n.jsx)(eO,{extractedVariables:d,variables:i}),(0,n.jsx)(eL,{inputMessage:o,isLoading:r,isDisabled:r||!o.trim()||d.length>0&&!m,onInputChange:x,onSend:u,onKeyDown:v,onCancel:h})]})]})},eF=e=>{let{visible:t,promptName:s,isSaving:r,onNameChange:a,onPublish:o,onCancel:i}=e;return(0,n.jsx)(l.Z,{title:"Publish Prompt",open:t,onCancel:i,footer:[(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(R.z,{variant:"secondary",onClick:i,children:"Cancel"}),(0,n.jsx)(R.z,{onClick:o,loading:r,children:"Publish"})]},"footer")],children:(0,n.jsxs)("div",{className:"py-4",children:[(0,n.jsx)(R.x,{className:"mb-2",children:"Name"}),(0,n.jsx)(ee.default,{value:s,onChange:e=>a(e.target.value),placeholder:"Enter prompt name",onPressEnter:o,autoFocus:!0}),(0,n.jsx)(R.x,{className:"text-gray-500 text-xs mt-2",children:"Published prompts can be used in API calls and are versioned for easy tracking."})]})})},eB=e=>{let{prompt:t}=e,s=j(t);return(0,n.jsxs)("div",{className:"p-6",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Generated .prompt file"}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:"This is the dotprompt format that will be saved to the database"})]}),(0,n.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto",children:(0,n.jsx)("pre",{className:"text-sm text-gray-900 font-mono whitespace-pre-wrap",children:s})})]})},eR=s(57840),eJ=s(63134),eU=s(50337),eV=s(35631);let{Text:eW}=eR.default;var eK=e=>{let{isOpen:t,onClose:s,accessToken:a,promptId:l,activeVersionId:i,onSelectVersion:c}=e,[d,m]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{t&&a&&l&&u()},[t,a,l]);let u=async()=>{x(!0);try{let e=l.includes(".v")?l.split(".v")[0]:l,t=await (0,o.getPromptVersions)(a,e);m(t.prompts)}catch(e){console.error("Error fetching prompt versions:",e)}finally{x(!1)}},h=e=>{var t;if(e.version)return"v".concat(e.version);let s=(null===(t=e.litellm_params)||void 0===t?void 0:t.prompt_id)||e.prompt_id;return s.includes(".v")?"v".concat(s.split(".v")[1]):s.includes("_v")?"v".concat(s.split("_v")[1]):"v1"},g=e=>e?new Date(e).toLocaleString():"-";return(0,n.jsx)(eJ.Z,{title:"Version History",placement:"right",onClose:s,open:t,width:400,mask:!1,maskClosable:!1,children:p?(0,n.jsx)(eU.Z,{active:!0,paragraph:{rows:4}}):0===d.length?(0,n.jsx)("div",{className:"text-center py-8 text-gray-500",children:"No version history available."}):(0,n.jsx)(eV.Z,{dataSource:d,renderItem:(e,t)=>{var s;let r=e.version||parseInt(h(e).replace("v","")),a=null;i&&(i.includes(".v")?a=parseInt(i.split(".v")[1]):i.includes("_v")&&(a=parseInt(i.split("_v")[1])));let l=a?r===a:0===t;return(0,n.jsxs)("div",{className:"mb-4 p-4 rounded-lg border cursor-pointer transition-all hover:shadow-md ".concat(l?"border-blue-500 bg-blue-50":"border-gray-200 bg-white hover:border-blue-300"),onClick:()=>null==c?void 0:c(e),children:[(0,n.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(eu.Z,{className:"m-0",children:h(e)}),0===t&&(0,n.jsx)(eu.Z,{color:"blue",className:"m-0",children:"Latest"})]}),l&&(0,n.jsx)(eu.Z,{color:"green",className:"m-0",children:"Active"})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(eW,{className:"text-sm text-gray-600 font-medium",children:g(e.created_at)}),(0,n.jsx)(eW,{type:"secondary",className:"text-xs",children:(null===(s=e.prompt_info)||void 0===s?void 0:s.prompt_type)==="db"?"Saved to Database":"Config Prompt"})]})]},"".concat(e.prompt_id,"-v").concat(e.version||r))}})})},eH=e=>{var t;let{onClose:s,onSuccess:a,accessToken:l,initialPromptData:i}=e,[c,d]=(0,r.useState)((()=>{if(i)try{return b(i)}catch(e){console.error("Error parsing existing prompt:",e),L.Z.fromBackend("Failed to parse prompt data")}return{name:"New prompt",model:"gpt-4o",config:{temperature:1,max_tokens:1e3},tools:[],developerMessage:"",messages:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}})()),[m,p]=(0,r.useState)(!!i),[x,u]=(0,r.useState)(!1),[h,g]=(0,r.useState)((()=>{var e;if(!(null==i?void 0:i.prompt_spec))return;let t=i.prompt_spec.prompt_id,s=i.prompt_spec.version||(null===(e=i.prompt_spec.litellm_params)||void 0===e?void 0:e.prompt_id);return"number"==typeof s?"".concat(t,".v").concat(s):"string"==typeof s&&(s.includes(".v")||s.includes("_v"))?s:t})()),[v,f]=(0,r.useState)(!1),[y,N]=(0,r.useState)(!1),[w,_]=(0,r.useState)(null),[C,k]=(0,r.useState)(!1),[S,Z]=(0,r.useState)("pretty"),P=e=>{void 0!==e?_(e):_(null),f(!0)},T=async()=>{if(!l){L.Z.fromBackend("Access token is required");return}if(!c.name||""===c.name.trim()){L.Z.fromBackend("Please enter a valid prompt name");return}k(!0);try{var e;let t=c.name.replace(/[^a-zA-Z0-9_-]/g,"_").toLowerCase(),n=j(c),r={prompt_id:t,litellm_params:{prompt_integration:"dotprompt",prompt_id:t,dotprompt_content:n},prompt_info:{prompt_type:"db"}};m&&(null==i?void 0:null===(e=i.prompt_spec)||void 0===e?void 0:e.prompt_id)?(await (0,o.updatePromptCall)(l,i.prompt_spec.prompt_id,r),L.Z.success("Prompt updated successfully!")):(await (0,o.createPromptCall)(l,r),L.Z.success("Prompt created successfully!")),a(),s()}catch(e){console.error("Error saving prompt:",e),L.Z.fromBackend(m?"Failed to update prompt":"Failed to save prompt")}finally{k(!1),N(!1)}},D=h&&h.includes(".v")?"v".concat(h.split(".v")[1]):null;return(0,n.jsxs)("div",{className:"flex h-full bg-white",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,n.jsx)(er,{promptName:c.name,onNameChange:e=>d({...c,name:e}),onBack:s,onSave:()=>{c.name&&""!==c.name.trim()&&"New prompt"!==c.name?T():N(!0)},isSaving:C,editMode:m,onShowHistory:()=>u(!0),version:D,promptModel:c.model,promptVariables:(()=>{let e;let t={},s=[c.developerMessage,...c.messages.map(e=>e.content)].join(" "),n=/\{\{(\w+)\}\}/g;for(;null!==(e=n.exec(s));){let s=e[1];t[s]||(t[s]="example_".concat(s))}return t})(),accessToken:l}),(0,n.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,n.jsxs)("div",{className:"w-1/2 overflow-y-auto bg-white border-r border-gray-200 flex-shrink-0",children:[(0,n.jsxs)("div",{className:"border-b border-gray-200 bg-white px-6 py-4 flex items-center gap-3",children:[(0,n.jsx)(ei,{model:c.model,temperature:c.config.temperature,maxTokens:c.config.max_tokens,accessToken:l,onModelChange:e=>d({...c,model:e}),onTemperatureChange:e=>d({...c,config:{...c.config,temperature:e}}),onMaxTokensChange:e=>d({...c,config:{...c.config,max_tokens:e}})}),(0,n.jsxs)("div",{className:"ml-auto inline-flex items-center bg-gray-200 rounded-full p-0.5",children:[(0,n.jsx)("button",{className:"px-3 py-1 text-xs font-medium rounded-full transition-colors ".concat("pretty"===S?"bg-white text-gray-900 shadow-sm":"text-gray-600"),onClick:()=>Z("pretty"),children:"PRETTY"}),(0,n.jsx)("button",{className:"px-3 py-1 text-xs font-medium rounded-full transition-colors ".concat("dotprompt"===S?"bg-white text-gray-900 shadow-sm":"text-gray-600"),onClick:()=>Z("dotprompt"),children:"DOTPROMPT"})]})]}),"pretty"===S?(0,n.jsxs)("div",{className:"p-6 space-y-4 pb-20",children:[(0,n.jsx)(ep,{tools:c.tools,onAddTool:()=>P(),onEditTool:P,onRemoveTool:e=>{d({...c,tools:c.tools.filter((t,s)=>s!==e)})}}),(0,n.jsx)(ef,{value:c.developerMessage,onChange:e=>d({...c,developerMessage:e})}),(0,n.jsx)(ey,{messages:c.messages,onAddMessage:()=>{d({...c,messages:[...c.messages,{role:"user",content:""}]})},onUpdateMessage:(e,t,s)=>{let n=[...c.messages];n[e][t]=s,d({...c,messages:n})},onRemoveMessage:e=>{c.messages.length>1&&d({...c,messages:c.messages.filter((t,s)=>s!==e)})},onMoveMessage:(e,t)=>{let s=[...c.messages],[n]=s.splice(e,1);s.splice(t,0,n),d({...c,messages:s})}})]}):(0,n.jsx)(eB,{prompt:c})]}),(0,n.jsx)("div",{className:"w-1/2 flex-shrink-0",children:(0,n.jsx)(eM,{prompt:c,accessToken:l})})]})]}),(0,n.jsx)(eF,{visible:y,promptName:c.name,isSaving:C,onNameChange:e=>d({...c,name:e}),onPublish:T,onCancel:()=>N(!1)}),v&&(0,n.jsx)(Q,{visible:v,initialJson:null!==w?c.tools[w].json:"",onSave:e=>{try{var t,s;let n=JSON.parse(e),r={name:(null===(t=n.function)||void 0===t?void 0:t.name)||"Unnamed Tool",description:(null===(s=n.function)||void 0===s?void 0:s.description)||"",json:e};if(null!==w){let e=[...c.tools];e[w]=r,d({...c,tools:e})}else d({...c,tools:[...c.tools,r]});f(!1),_(null)}catch(e){L.Z.fromBackend("Invalid JSON format")}},onClose:()=>{f(!1),_(null)}}),(0,n.jsx)(eK,{isOpen:x,onClose:()=>u(!1),accessToken:l,promptId:(null==i?void 0:null===(t=i.prompt_spec)||void 0===t?void 0:t.prompt_id)||c.name,activeVersionId:h,onSelectVersion:e=>{try{let t=b({prompt_spec:e});d(t);let s=e.version||1;g("".concat(e.prompt_id,".v").concat(s))}catch(e){console.error("Error loading version:",e),L.Z.fromBackend("Failed to load prompt version")}}})]})},eq=s(20347),eG=e=>{let{accessToken:t,userRole:s}=e,[i,c]=(0,r.useState)([]),[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[g,v]=(0,r.useState)(!1),[f,j]=(0,r.useState)(null),[b,y]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null),_=!!s&&(0,eq.tY)(s),C=async()=>{if(t){m(!0);try{let e=await (0,o.getPromptsList)(t);console.log("prompts: ".concat(JSON.stringify(e))),c(e.prompts)}catch(e){console.error("Error fetching prompts:",e)}finally{m(!1)}}};(0,r.useEffect)(()=>{C()},[t]);let k=()=>{C(),v(!1),j(null),x(null)},S=async()=>{if(N&&t){y(!0);try{await (0,o.deletePromptCall)(t,N.id),L.Z.success('Prompt "'.concat(N.name,'" deleted successfully')),C()}catch(e){console.error("Error deleting prompt:",e),L.Z.fromBackend("Failed to delete prompt")}finally{y(!1),w(null)}}};return(0,n.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[g?(0,n.jsx)(eH,{onClose:()=>{v(!1),j(null)},onSuccess:k,accessToken:t,initialPromptData:f}):p?(0,n.jsx)(W,{promptId:p,onClose:()=>x(null),accessToken:t,isAdmin:_,onDelete:C,onEdit:e=>{j(e),v(!0)}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.z,{onClick:()=>{p&&x(null),j(null),v(!0)},disabled:!t,children:"+ Add New Prompt"}),(0,n.jsx)(a.z,{onClick:()=>{p&&x(null),h(!0)},disabled:!t,variant:"secondary",children:"Upload .prompt File"})]})}),(0,n.jsx)(P,{promptsList:i,isLoading:d,onPromptClick:e=>{x(e)},onDeleteClick:(e,t)=>{w({id:e,name:t})},accessToken:t,isAdmin:_})]}),(0,n.jsx)($,{visible:u,onClose:()=>{h(!1)},accessToken:t,onSuccess:k}),N&&(0,n.jsxs)(l.Z,{title:"Delete Prompt",open:null!==N,onOk:S,onCancel:()=>{w(null)},confirmLoading:b,okText:"Delete",okButtonProps:{danger:!0},children:[(0,n.jsxs)("p",{children:["Are you sure you want to delete prompt: ",N.name," ?"]}),(0,n.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6399],{12579:function(e,t,s){s.d(t,{RM:function(){return a.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return o.Z},xs:function(){return i.Z},zx:function(){return n.Z}});var n=s(78489),r=s(21626),a=s(97214),l=s(28241),o=s(58834),i=s(69552),c=s(71876)},56399:function(e,t,s){s.d(t,{Z:function(){return eG}});var n=s(57437),r=s(2265),a=s(16312),l=s(22116),o=s(19250),i=s(12579),c=s(74998),d=s(44633),m=s(86462),p=s(49084),x=s(99981),u=s(23639),h=s(71594),g=s(24525),v=s(42673);let f=e=>{let t=new Set,s=/\{\{(\w+)\}\}/g;if(e.messages.forEach(e=>{let n;for(;null!==(n=s.exec(e.content));)t.add(n[1])}),e.developerMessage){let n;for(;null!==(n=s.exec(e.developerMessage));)t.add(n[1])}return Array.from(t)},j=e=>{let t=f(e),s="---\nmodel: ".concat(e.model,"\n");return void 0!==e.config.temperature&&(s+="temperature: ".concat(e.config.temperature,"\n")),void 0!==e.config.max_tokens&&(s+="max_tokens: ".concat(e.config.max_tokens,"\n")),void 0!==e.config.top_p&&(s+="top_p: ".concat(e.config.top_p,"\n")),s+="input:\n schema:\n",t.forEach(e=>{s+=" ".concat(e,": string\n")}),s+="output:\n format: text\n",e.tools&&e.tools.length>0&&(s+="tools:\n",e.tools.forEach(e=>{let t=JSON.parse(e.json);s+=" - ".concat(JSON.stringify(t),"\n")})),s+="---\n\n",e.developerMessage&&""!==e.developerMessage.trim()&&(s+="Developer: ".concat(e.developerMessage.trim(),"\n\n")),e.messages.forEach(e=>{let t=e.role.charAt(0).toUpperCase()+e.role.slice(1);s+="".concat(t,": ").concat(e.content,"\n\n")}),s.trim()},b=e=>{var t,s,n;let r=(null==e?void 0:null===(s=e.prompt_spec)||void 0===s?void 0:null===(t=s.litellm_params)||void 0===t?void 0:t.dotprompt_content)||"";if(!r)throw Error("No dotprompt_content found in API response");let a=r.split("---");if(a.length<3)throw Error("Invalid dotprompt format");let l=a[1],o=a.slice(2).join("---").trim(),i={};l.split("\n").forEach(e=>{let t=e.trim();if(t&&!t.startsWith("input:")&&!t.startsWith("output:")&&!t.startsWith("schema:")&&!t.startsWith("format:")){let e=t.indexOf(":");if(e>0){let s=t.substring(0,e).trim(),n=t.substring(e+1).trim();"temperature"===s||"max_tokens"===s||"top_p"===s?i[s]=parseFloat(n):"model"===s&&(i[s]=n)}}});let c="",d=[],m=o.split("\n"),p=null,x="";for(let e of m)e.startsWith("Developer:")?c=e.substring(10).trim():e.startsWith("User:")?(p&&x&&d.push({role:p,content:x.trim()}),p="user",x=e.substring(5).trim()):e.startsWith("Assistant:")?(p&&x&&d.push({role:p,content:x.trim()}),p="assistant",x=e.substring(10).trim()):e.trim()&&p&&(x+="\n"+e.trim());p&&x&&d.push({role:p,content:x.trim()});let u=(null==e?void 0:null===(n=e.prompt_spec)||void 0===n?void 0:n.prompt_id)||"Unnamed Prompt";return{name:N(u)||u,model:i.model||"gpt-4o",config:{temperature:i.temperature,max_tokens:i.max_tokens,top_p:i.top_p},tools:[],developerMessage:c,messages:d.length>0?d:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}},y=e=>{if(!e)return"1";let t=e.match(/[._-]v(\d+)$/);return t?t[1]:"1"},N=e=>e?e.replace(/[._-]v\d+$/,""):"",w=e=>{let t;if(!e)return{};let s={},n=/\{\{(\w+)\}\}/g;for(;null!==(t=n.exec(e));){let e=t[1];s[e]||(s[e]="example_".concat(e))}return s},_=e=>(null==e?void 0:e.prompt_id)||"",C=e=>{var t;let s=_(e);return(null==e?void 0:null===(t=e.litellm_params)||void 0===t?void 0:t.prompt_id)||s},k=e=>(null==e?void 0:e.version)?String(e.version):y(C(e)),S=e=>{try{var t;let s=e.litellm_params;if(null==s?void 0:s.dotprompt_content){let e=s.dotprompt_content.match(/model:\s*([^\n]+)/);if(e)return e[1].trim()}if(null==s?void 0:null===(t=s.prompt_data)||void 0===t?void 0:t.model)return s.prompt_data.model;if(null==s?void 0:s.model)return s.model;return null}catch(e){return console.error("Error extracting model:",e),null}},Z=(e,t)=>{if(!e)return null;let s=t.get(e);return s&&s.providers&&s.providers.length>0?s.providers[0]:null};var P=e=>{let{promptsList:t,isLoading:s,onPromptClick:a,onDeleteClick:l,accessToken:f,isAdmin:j}=e,[b,y]=(0,r.useState)([{id:"created_at",desc:!0}]),[N,w]=(0,r.useState)(new Map);(0,r.useEffect)(()=>{(async()=>{if(f)try{let e=await (0,o.modelHubCall)(f);if(null==e?void 0:e.data){let t=new Map;e.data.forEach(e=>{t.set(e.model_group,e)}),w(t)}}catch(e){console.error("Error fetching model hub data:",e)}})()},[f]);let _=e=>e?new Date(e).toLocaleString():"-",C=e=>{navigator.clipboard.writeText(e)},k=[{header:"Prompt ID",accessorKey:"prompt_id",cell:e=>{let t=String(e.getValue()||""),s=t.length>25?"".concat(t.slice(0,25),"..."):t;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(x.Z,{title:t,children:(0,n.jsx)(i.zx,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[220px] justify-start",onClick:()=>e.getValue()&&(null==a?void 0:a(e.getValue())),children:s})}),(0,n.jsx)(x.Z,{title:"Copy prompt ID",children:(0,n.jsx)(u.Z,{onClick:e=>{e.stopPropagation(),C(t)},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Model",accessorKey:"model",cell:e=>{let{row:t}=e,s=S(t.original);if(!s)return(0,n.jsx)("span",{className:"text-xs text-gray-400",children:"-"});let r=Z(s,N),{logo:a}=(0,v.dr)(r||"");return(0,n.jsx)(x.Z,{title:s,children:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:r&&a?(0,n.jsx)("img",{src:a,alt:"".concat(r," logo"),className:"w-4 h-4",onError:e=>{let t=e.currentTarget,s=t.parentElement;if(s&&s.contains(t))try{let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null==r?void 0:r.charAt(0))||"-",s.replaceChild(e,t)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}):(0,n.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,n.jsx)("span",{className:"max-w-[15ch] truncate block",children:s})]})})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:_(s.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:_(s.updated_at)})})}},{header:"Type",accessorKey:"prompt_info.prompt_type",cell:e=>{let{row:t}=e,s=t.original;return(0,n.jsx)(x.Z,{title:s.prompt_info.prompt_type,children:(0,n.jsx)("span",{className:"text-xs",children:s.prompt_info.prompt_type})})}},...j?[{header:"Actions",id:"actions",enableSorting:!1,cell:e=>{let{row:t}=e,s=t.original,r=s.prompt_id||"Unknown Prompt";return(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(x.Z,{title:"Delete prompt",children:(0,n.jsx)(i.zx,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),null==l||l(s.prompt_id,r)},icon:c.Z,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],P=(0,h.b7)({data:t,columns:k,state:{sorting:b},onSortingChange:y,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,n.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(i.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(i.ss,{children:P.getHeaderGroups().map(e=>(0,n.jsx)(i.SC,{children:e.headers.map(e=>(0,n.jsx)(i.xs,{className:"py-1 h-8",onClick:e.column.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,h.ie)(e.column.columnDef.header,e.getContext())}),(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(d.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(m.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(i.RM,{children:s?(0,n.jsx)(i.SC,{children:(0,n.jsx)(i.pj,{colSpan:k.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):t.length>0?P.getRowModel().rows.map(e=>(0,n.jsx)(i.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(i.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,h.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(i.SC,{children:(0,n.jsx)(i.pj,{colSpan:k.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No prompts found"})})})})})]})})})},T=s(84717),D=s(5545),E=s(10900),z=s(93416),O=s(59872),A=s(30401),I=s(78867),L=s(9114),M=s(37592),F=s(65869),B=s(11894),R=s(19431),J=s(17906),U=s(94263),V=e=>{let{promptId:t,model:s,promptVariables:a={},accessToken:o,version:i="1",proxySettings:c}=e,[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)("curl"),[u,h]=(0,r.useState)("basic"),[g,v]=(0,r.useState)(""),f=window.location.origin,j=null==c?void 0:c.LITELLM_UI_API_DOC_BASE_URL;j&&j.trim()?f=j:(null==c?void 0:c.PROXY_BASE_URL)&&(f=c.PROXY_BASE_URL);let b=o||"sk-1234",y=()=>{let e=Object.keys(a).length>0;if("curl"===p)return"basic"===u?"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,6).replace(/\n/g,"\n ")):"","\n }' | jq"):"messages"===u?"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,6).replace(/\n/g,"\n ")):"",',\n "messages": [\n {\n "role": "user",\n "content": "hi"\n }\n ]\n }\' | jq'):"curl -X POST '".concat(f,"/chat/completions' \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer ").concat(b,'\' \\\n -d \'{\n "model": "').concat(s,'",\n "prompt_id": "').concat(t,'",\n "prompt_version": ').concat(i,',\n "messages": [\n {\n "role": "user",\n "content": "Who are u"\n }\n ]\n }\' | jq');if("python"===p){let n='import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(b,'",\n base_url="').concat(f,'"\n)\n');return"basic"===u?"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n extra_body={\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):"","\n }\n)\n\nprint(response)"):"messages"===u?"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n messages=[\n {"role": "user", "content": "hi"}\n ],\n extra_body={\n "prompt_id": "').concat(t,'"').concat(e?',\n "prompt_variables": '.concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):"","\n }\n)\n\nprint(response)"):"".concat(n,'\nresponse = client.chat.completions.create(\n model="').concat(s,'",\n messages=[\n {"role": "user", "content": "Who are u"}\n ],\n extra_body={\n "prompt_id": "').concat(t,'",\n "prompt_version": ').concat(i,"\n }\n)\n\nprint(response)")}{let n="import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: \"".concat(b,'",\n baseURL: "').concat(f,'"\n});\n');return"basic"===u?"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n ').concat(e?'prompt_id: "'.concat(t,'",\n prompt_variables: ').concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):'prompt_id: "'.concat(t,'"'),"\n });\n \n console.log(response);\n}\n\nmain();"):"messages"===u?"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n messages: [\n { role: "user", content: "hi" }\n ],\n ').concat(e?'prompt_id: "'.concat(t,'",\n prompt_variables: ').concat(JSON.stringify(a,null,8).replace(/\n/g,"\n ")):'prompt_id: "'.concat(t,'"'),"\n });\n \n console.log(response);\n}\n\nmain();"):"".concat(n,'\nasync function main() {\n const response = await client.chat.completions.create({\n model: "').concat(s,'",\n messages: [\n { role: "user", content: "Who are u" }\n ],\n prompt_id: "').concat(t,'",\n prompt_version: ').concat(i,"\n });\n \n console.log(response);\n}\n\nmain();")}};return r.useEffect(()=>{d&&v(y())},[d,p,u,t,s,a]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R.z,{variant:"secondary",icon:B.Z,onClick:()=>{m(!0)},children:"Get Code"}),(0,n.jsxs)(l.Z,{title:"Generated Code",open:d,onCancel:()=>{m(!1)},footer:null,width:800,children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(R.x,{className:"font-medium block mb-1 text-gray-700",children:"Language"}),(0,n.jsx)(M.default,{value:p,onChange:e=>x(e),style:{width:180},options:[{value:"curl",label:"cURL"},{value:"python",label:"Python (OpenAI SDK)"},{value:"javascript",label:"JavaScript (OpenAI SDK)"}]})]}),(0,n.jsx)(D.ZP,{onClick:()=>{navigator.clipboard.writeText(g),L.Z.success("Copied to clipboard!")},children:"Copy to Clipboard"})]}),(0,n.jsx)(F.default,{activeKey:u,onChange:h,items:[{label:"Basic",key:"basic"},{label:"With Messages",key:"messages"},{label:"With Version",key:"version"}]}),(0,n.jsx)(J.Z,{language:"curl"===p?"bash":"python"===p?"python":"javascript",style:U.Z,wrapLines:!0,wrapLongLines:!0,className:"rounded-md mt-0",customStyle:{maxHeight:"60vh",overflowY:"auto",marginTop:0,borderTopLeftRadius:0,borderTopRightRadius:0},children:g})]})]})},W=e=>{var t,s,a;let{promptId:i,onClose:d,accessToken:m,isAdmin:p,onDelete:x,onEdit:u}=e,[h,g]=(0,r.useState)(null),[v,f]=(0,r.useState)(null),[j,b]=(0,r.useState)(null),[y,N]=(0,r.useState)(!0),[C,Z]=(0,r.useState)({}),[P,M]=(0,r.useState)(!1),[F,B]=(0,r.useState)(!1),R=async()=>{try{if(N(!0),!m)return;let e=await (0,o.getPromptInfo)(m,i);g(e.prompt_spec),f(e.raw_prompt_template),b(e)}catch(e){L.Z.fromBackend("Failed to load prompt information"),console.error("Error fetching prompt info:",e)}finally{N(!1)}};if((0,r.useEffect)(()=>{R()},[i,m]),y)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!h)return(0,n.jsx)("div",{className:"p-4",children:"Prompt not found"});let J=e=>e?new Date(e).toLocaleString():"-",U=async(e,t)=>{await (0,O.vQ)(e)&&(Z(e=>({...e,[t]:!0})),setTimeout(()=>{Z(e=>({...e,[t]:!1}))},2e3))},W=async()=>{if(m&&h){B(!0);try{await (0,o.deletePromptCall)(m,H),L.Z.success('Prompt "'.concat(H,'" deleted successfully')),null==x||x(),d()}catch(e){console.error("Error deleting prompt:",e),L.Z.fromBackend("Failed to delete prompt")}finally{B(!1),M(!1)}}},K=h&&S(h)||"gpt-4o",H=_(h),q=k(h);return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.zx,{icon:E.Z,variant:"light",onClick:d,className:"mb-4",children:"Back to Prompts"}),(0,n.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.Dx,{children:"Prompt Details"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(T.xv,{className:"text-gray-500 font-mono",children:H}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["prompt-id"]?(0,n.jsx)(A.Z,{size:12}):(0,n.jsx)(I.Z,{size:12}),onClick:()=>U(H,"prompt-id"),className:"left-2 z-10 transition-all duration-200 ".concat(C["prompt-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(V,{promptId:H,model:K,promptVariables:w(null==v?void 0:v.content),accessToken:m,version:q}),(0,n.jsx)(T.zx,{icon:z.Z,variant:"primary",onClick:()=>null==u?void 0:u(j),className:"flex items-center",children:"Prompt Studio"}),p&&(0,n.jsx)(T.zx,{icon:c.Z,variant:"secondary",onClick:()=>{M(!0)},className:"flex items-center",children:"Delete Prompt"})]})]})]}),(0,n.jsxs)(T.v0,{children:[(0,n.jsxs)(T.td,{className:"mb-4",children:[(0,n.jsx)(T.OK,{children:"Overview"},"overview"),v?(0,n.jsx)(T.OK,{children:"Prompt Template"},"prompt-template"):(0,n.jsx)(n.Fragment,{}),p?(0,n.jsx)(T.OK,{children:"Details"},"details"):(0,n.jsx)(n.Fragment,{}),(0,n.jsx)(T.OK,{children:"Raw JSON"},"raw-json")]}),(0,n.jsxs)(T.nP,{children:[(0,n.jsxs)(T.x4,{children:[(0,n.jsxs)(T.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Prompt ID"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(T.Dx,{className:"font-mono text-sm",children:H})})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Version"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:q}),(0,n.jsxs)(T.Ct,{color:"blue",className:"mt-1",children:["v",q]})]})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Prompt Type"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:(null===(t=h.prompt_info)||void 0===t?void 0:t.prompt_type)||"-"}),(0,n.jsx)(T.Ct,{color:"blue",className:"mt-1",children:(null===(s=h.prompt_info)||void 0===s?void 0:s.prompt_type)||"Unknown"})]})]}),(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(T.Dx,{children:J(h.created_at)}),(0,n.jsxs)(T.xv,{children:["Last Updated: ",J(h.updated_at)]})]})]})]}),h.litellm_params&&Object.keys(h.litellm_params).length>0&&(0,n.jsxs)(T.Zb,{className:"mt-6",children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"LiteLLM Parameters"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(h.litellm_params,null,2)})})]})]}),v&&(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(T.Dx,{children:"Prompt Template"}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["prompt-content"]?(0,n.jsx)(A.Z,{size:16}):(0,n.jsx)(I.Z,{size:16}),onClick:()=>U(v.content,"prompt-content"),className:"transition-all duration-200 ".concat(C["prompt-content"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:C["prompt-content"]?"Copied!":"Copy Content"})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Template ID"}),(0,n.jsx)("div",{className:"font-mono text-sm bg-gray-50 p-2 rounded",children:v.litellm_prompt_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Content"}),(0,n.jsx)("div",{className:"mt-2 p-4 bg-gray-50 rounded-md border overflow-auto max-h-96",children:(0,n.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:v.content})})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Template Metadata"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap overflow-auto max-h-64",children:JSON.stringify(v.metadata,null,2)})})]})]})]})}),p&&(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsx)(T.Dx,{className:"mb-4",children:"Prompt Details"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt ID"}),(0,n.jsx)("div",{className:"font-mono text-sm bg-gray-50 p-2 rounded",children:H})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt Type"}),(0,n.jsx)("div",{children:(null===(a=h.prompt_info)||void 0===a?void 0:a.prompt_type)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:J(h.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:J(h.updated_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"LiteLLM Parameters"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap overflow-auto max-h-96",children:JSON.stringify(h.litellm_params,null,2)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(T.xv,{className:"font-medium",children:"Prompt Info"}),(0,n.jsx)("div",{className:"mt-2 p-3 bg-gray-50 rounded-md border",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(h.prompt_info,null,2)})})]})]})]})}),(0,n.jsx)(T.x4,{children:(0,n.jsxs)(T.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(T.Dx,{children:"Raw API Response"}),(0,n.jsx)(D.ZP,{type:"text",size:"small",icon:C["raw-json"]?(0,n.jsx)(A.Z,{size:16}):(0,n.jsx)(I.Z,{size:16}),onClick:()=>U(JSON.stringify(j,null,2),"raw-json"),className:"transition-all duration-200 ".concat(C["raw-json"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100"),children:C["raw-json"]?"Copied!":"Copy JSON"})]}),(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border overflow-auto",children:(0,n.jsx)("pre",{className:"text-xs text-gray-800 whitespace-pre-wrap",children:JSON.stringify(j,null,2)})})]})})]})]}),(0,n.jsxs)(l.Z,{title:"Delete Prompt",open:P,onOk:W,onCancel:()=>{M(!1)},confirmLoading:F,okText:"Delete",okButtonProps:{danger:!0},children:[(0,n.jsxs)("p",{children:["Are you sure you want to delete prompt: ",(0,n.jsx)("strong",{children:H}),"?"]}),(0,n.jsx)("p",{children:"This action cannot be undone."})]})]})},K=s(10032),H=s(23496),q=s(65319),G=s(31283),X=s(3632);let{Option:Y}=M.default;var $=e=>{let{visible:t,onClose:s,accessToken:a,onSuccess:i}=e,[c]=K.Z.useForm(),[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)([]),[u,h]=(0,r.useState)("dotprompt"),g=()=>{c.resetFields(),x([]),h("dotprompt"),s()},v=async()=>{try{let e=await c.validateFields();if(console.log("values: ",e),!a){L.Z.fromBackend("Access token is required");return}if("dotprompt"===u&&0===p.length){L.Z.fromBackend("Please upload a .prompt file");return}m(!0);let t={};if("dotprompt"===u&&p.length>0){let s=p[0].originFileObj;try{let n=await (0,o.convertPromptFileToJson)(a,s);console.log("Conversion result:",n),t={prompt_id:e.prompt_id,litellm_params:{prompt_integration:"dotprompt",prompt_id:n.prompt_id,prompt_data:n.json_data},prompt_info:{prompt_type:"db"}}}catch(e){console.error("Error converting prompt file:",e),L.Z.fromBackend("Failed to convert prompt file to JSON"),m(!1);return}}try{await (0,o.createPromptCall)(a,t),L.Z.success("Prompt created successfully!"),g(),i()}catch(e){console.error("Error creating prompt:",e),L.Z.fromBackend("Failed to create prompt")}}catch(e){console.error("Form validation error:",e)}finally{m(!1)}};return(0,n.jsx)(l.Z,{title:"Add New Prompt",open:t,onCancel:g,footer:[(0,n.jsx)(D.ZP,{onClick:g,children:"Cancel"},"cancel"),(0,n.jsx)(D.ZP,{loading:d,onClick:v,children:"Create Prompt"},"submit")],width:600,children:(0,n.jsxs)(K.Z,{form:c,layout:"vertical",requiredMark:!1,children:[(0,n.jsx)(K.Z.Item,{label:"Prompt ID",name:"prompt_id",rules:[{required:!0,message:"Please enter a prompt ID"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Prompt ID can only contain letters, numbers, underscores, and hyphens"}],children:(0,n.jsx)(G.o,{placeholder:"Enter unique prompt ID (e.g., my_prompt_id)"})}),(0,n.jsx)(K.Z.Item,{label:"Prompt Integration",name:"prompt_integration",initialValue:"dotprompt",children:(0,n.jsx)(M.default,{value:u,onChange:h,children:(0,n.jsx)(Y,{value:"dotprompt",children:"dotprompt"})})}),"dotprompt"===u&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.Z,{}),(0,n.jsxs)(K.Z.Item,{label:"Prompt File",extra:"Upload a .prompt file that follows the Dotprompt specification",children:[(0,n.jsx)(q.default,{beforeUpload:e=>(e.name.endsWith(".prompt")||L.Z.fromBackend("Please upload a .prompt file"),!1),fileList:p,onChange:e=>{let{fileList:t}=e;x(t.slice(-1))},onRemove:()=>{x([])},children:(0,n.jsx)(D.ZP,{icon:(0,n.jsx)(X.Z,{}),children:"Select .prompt File"})}),p.length>0&&(0,n.jsxs)("div",{className:"mt-2 text-sm text-gray-600",children:["Selected: ",p[0].name]})]})]})]})})},Q=e=>{let{visible:t,initialJson:s,onSave:a,onClose:o}=e,[i,c]=(0,r.useState)(s||'{\n "type": "function",\n "function": {\n "name": "get_current_weather",\n "description": "Get the current weather in a given location",\n "parameters": {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": {\n "type": "string",\n "enum": ["celsius", "fahrenheit"]\n }\n },\n "required": ["location"]\n }\n }\n}'),[d,m]=(0,r.useState)(null),p=()=>{m(null),o()};return(0,n.jsx)(l.Z,{title:(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsx)("span",{className:"text-lg font-medium",children:"Add Tool"})}),open:t,onCancel:p,width:800,footer:[(0,n.jsx)(D.ZP,{onClick:p,children:"Cancel"},"cancel"),(0,n.jsx)(D.ZP,{type:"primary",onClick:()=>{try{JSON.parse(i),m(null),a(i)}catch(e){m("Invalid JSON format. Please check your syntax.")}},children:"Add"},"save")],children:(0,n.jsxs)("div",{className:"space-y-3",children:[d&&(0,n.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:d}),(0,n.jsx)("textarea",{value:i,onChange:e=>c(e.target.value),className:"w-full min-h-[400px] px-4 py-3 border border-gray-300 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",placeholder:"Paste your tool JSON here..."})]})})},ee=s(4260),et=s(32660),es=s(91723),en=s(83229),er=e=>{let{promptName:t,onNameChange:s,onBack:r,onSave:l,isSaving:o,editMode:i=!1,onShowHistory:c,version:d,promptModel:m="gpt-4o",promptVariables:p={},accessToken:x,proxySettings:u}=e;return(0,n.jsxs)("div",{className:"bg-white border-b border-gray-200 px-6 py-3 flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,n.jsx)(a.z,{icon:et.Z,variant:"light",onClick:r,size:"xs",children:"Back"}),(0,n.jsx)(ee.default,{value:t,onChange:e=>s(e.target.value),className:"text-base font-medium border-none shadow-none",style:{width:"200px"}}),d&&(0,n.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium",children:d}),(0,n.jsx)("span",{className:"px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:"Draft"}),(0,n.jsx)("span",{className:"text-xs text-gray-400",children:"Unsaved changes"})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(V,{promptId:t,model:m,promptVariables:p,accessToken:x,version:(null==d?void 0:d.replace("v",""))||"1",proxySettings:u}),i&&c&&(0,n.jsx)(a.z,{icon:es.Z,variant:"secondary",onClick:c,children:"History"}),(0,n.jsx)(a.z,{icon:en.Z,onClick:l,loading:o,disabled:o,children:i?"Update":"Save"})]})]})},ea=s(92280),el=s(98728),eo=s(76593),ei=e=>{let{model:t,temperature:s=1,maxTokens:a=1e3,accessToken:l,onModelChange:o,onTemperatureChange:i,onMaxTokensChange:c}=e,[d,m]=(0,r.useState)(!1);return(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"w-[300px]",children:(0,n.jsx)(eo.Z,{accessToken:l||"",value:t,onChange:o,showLabel:!1})}),(0,n.jsxs)("button",{onClick:()=>m(!d),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[(0,n.jsx)(el.Z,{size:16}),(0,n.jsx)("span",{children:"Parameters"})]}),d&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-30",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-96",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Model Parameters"}),(0,n.jsx)("button",{onClick:()=>m(!1),className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ea.x,{className:"text-sm text-gray-700",children:"Temperature"}),(0,n.jsx)(ee.default,{type:"number",size:"small",min:0,max:2,step:.1,value:s,onChange:e=>i(parseFloat(e.target.value)||0),className:"w-20"})]})}),(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ea.x,{className:"text-sm text-gray-700",children:"Max Tokens"}),(0,n.jsx)(ee.default,{type:"number",size:"small",min:1,max:32768,value:a,onChange:e=>c(parseInt(e.target.value)||1e3),className:"w-24"})]})})]})]})})]})},ec=s(78801),ed=s(99397),em=s(27413),ep=e=>{let{tools:t,onAddTool:s,onEditTool:r,onRemoveTool:a}=e;return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsx)(ec.x,{className:"text-sm font-medium",children:"Tools"}),(0,n.jsxs)("button",{onClick:s,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,n.jsx)(ed.Z,{size:14,className:"mr-1"}),"Add"]})]}),0===t.length?(0,n.jsx)(ec.x,{className:"text-gray-500 text-xs",children:"No tools added"}):(0,n.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 border border-gray-200 rounded",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium text-xs truncate",children:e.name}),(0,n.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 ml-2",children:[(0,n.jsx)("button",{onClick:()=>r(t),className:"text-xs text-blue-600 hover:text-blue-700",children:"Edit"}),(0,n.jsx)("button",{onClick:()=>a(t),className:"text-gray-400 hover:text-red-500",children:(0,n.jsx)(em.Z,{size:14})})]})]},t))})]})},ex=s(79326),eu=s(3810),eh=s(13377);let{TextArea:eg}=ee.default;var ev=e=>{let{value:t,onChange:s,placeholder:a,rows:l=4,className:o}=e,[i,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(""),p=()=>{d.trim()&&i&&(s(t.substring(0,i.start)+"{{".concat(d,"}}")+t.substring(i.end)),c(null),m(""))},x=(()=>{let e;let s=/\{\{(\w+)\}\}/g,n=[];for(;null!==(e=s.exec(t));)n.push({name:e[1],start:e.index,end:e.index+e[0].length});return n})();return(0,n.jsxs)("div",{className:"variable-textarea-container ".concat(o),children:[(0,n.jsx)("style",{children:"\n .variable-highlight-text {\n color: #f97316;\n background-color: #fff7ed;\n border-radius: 4px;\n padding: 0 2px;\n border: 1px solid #fed7aa;\n font-family: monospace;\n }\n "}),(0,n.jsx)(eg,{value:t,onChange:e=>s(e.target.value),placeholder:a,rows:l,className:"font-sans"}),x.length>0&&(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 items-center",children:[(0,n.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Detected variables:"}),x.map((e,t)=>(0,n.jsx)(ex.Z,{content:(0,n.jsxs)("div",{className:"p-2",style:{minWidth:"200px"},children:[(0,n.jsx)("div",{className:"text-xs text-gray-500 mb-2",children:"Edit variable name"}),(0,n.jsx)(ee.default,{size:"small",value:d,onChange:e=>m(e.target.value),onPressEnter:p,placeholder:"Variable name",autoFocus:!0}),(0,n.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,n.jsx)("button",{onClick:p,className:"text-xs px-2 py-1 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Save"}),(0,n.jsx)("button",{onClick:()=>{c(null),m("")},className:"text-xs px-2 py-1 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})]})]}),open:(null==i?void 0:i.start)===e.start,onOpenChange:e=>{e||(c(null),m(""))},trigger:"click",children:(0,n.jsx)(eu.Z,{color:"orange",className:"cursor-pointer hover:opacity-80 transition-all m-0",icon:(0,n.jsx)(eh.Z,{}),onClick:()=>{c({oldName:e.name,start:e.start,end:e.end}),m(e.name)},children:e.name})},"".concat(e.start,"-").concat(t)))]})]})},ef=e=>{let{value:t,onChange:s}=e;return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsx)(ec.x,{className:"block mb-2 text-sm font-medium",children:"Developer message"}),(0,n.jsx)(ec.x,{className:"text-gray-500 text-xs mb-2",children:"Optional system instructions for the model"}),(0,n.jsx)(ev,{value:t,onChange:s,rows:3,placeholder:"e.g., You are a helpful assistant..."})]})},ej=s(41905);let{Option:eb}=M.default;var ey=e=>{let{messages:t,onAddMessage:s,onUpdateMessage:a,onRemoveMessage:l,onMoveMessage:o}=e,[i,c]=(0,r.useState)(null),[d,m]=(0,r.useState)(null),p=e=>{c(e)},x=(e,t)=>{e.preventDefault(),m(t)},u=(e,t)=>{e.preventDefault(),null!==i&&i!==t&&o(i,t),c(null),m(null)},h=()=>{c(null),m(null)};return(0,n.jsxs)(ec.Z,{className:"p-3",children:[(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)(ec.x,{className:"text-sm font-medium",children:"Prompt messages"}),(0,n.jsxs)(ec.x,{className:"text-gray-500 text-xs mt-1",children:["Use ",(0,n.jsx)("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"{{variable}}"})," syntax for template variables"]})]}),(0,n.jsx)("div",{className:"space-y-2",children:t.map((e,s)=>(0,n.jsxs)("div",{draggable:!0,onDragStart:()=>p(s),onDragOver:e=>x(e,s),onDrop:e=>u(e,s),onDragEnd:h,className:"border border-gray-300 rounded overflow-hidden bg-white transition-all ".concat(i===s?"opacity-50":""," ").concat(d===s&&i!==s?"border-blue-500 border-2":""),children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-2 py-1.5 border-b border-gray-300 flex items-center justify-between",children:[(0,n.jsxs)(M.default,{value:e.role,onChange:e=>a(s,"role",e),style:{width:100},size:"small",bordered:!1,children:[(0,n.jsx)(eb,{value:"user",children:"User"}),(0,n.jsx)(eb,{value:"assistant",children:"Assistant"}),(0,n.jsx)(eb,{value:"system",children:"System"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[t.length>1&&(0,n.jsx)("button",{onClick:()=>l(s),className:"text-gray-400 hover:text-red-500",children:(0,n.jsx)(em.Z,{size:14})}),(0,n.jsx)("div",{className:"cursor-grab active:cursor-grabbing text-gray-400 hover:text-gray-600",children:(0,n.jsx)(ej.Z,{size:16})})]})]}),(0,n.jsx)("div",{className:"p-2",children:(0,n.jsx)(ev,{value:e.content,onChange:e=>a(s,"content",e),rows:3,placeholder:"Enter prompt content..."})})]},s))}),(0,n.jsxs)("button",{onClick:s,className:"mt-2 text-xs text-blue-600 hover:text-blue-700 flex items-center",children:[(0,n.jsx)(ed.Z,{size:14,className:"mr-1"}),"Add message"]})]})},eN=s(26430);let ew=(e,t)=>{let[s,n]=(0,r.useState)(!1),[a,l]=(0,r.useState)([]),[i,c]=(0,r.useState)(""),[d,m]=(0,r.useState)({}),[p,x]=(0,r.useState)(!1),[u,h]=(0,r.useState)(null),g=(0,r.useRef)(null),v=f(e),b=v.every(e=>d[e]&&""!==d[e].trim()),y=()=>{g.current&&setTimeout(()=>{var e;null===(e=g.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})},100)};(0,r.useEffect)(()=>{y()},[a]);let N=async()=>{let s;if(!t){L.Z.fromBackend("Access token is required");return}if(v.length>0&&!b){L.Z.fromBackend("Please fill in all template variables");return}if(!i.trim())return;!p&&v.length>0&&x(!0);let r={role:"user",content:i};l(e=>[...e,r]),c("");let m=new AbortController;h(m),n(!0);let u=Date.now();try{let n,r;let c=j(e),p=(0,o.getProxyBaseUrl)(),x={dotprompt_content:c};0===a.length?x.prompt_variables=d:x.conversation_history=[...a.map(e=>({role:e.role,content:e.content})),{role:"user",content:i}];let h=await fetch("".concat(p,"/prompts/test"),{method:"POST",headers:{[(0,o.getGlobalLitellmHeaderName)()]:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(!h.ok){let e=await h.text();throw Error("HTTP error! status: ".concat(h.status,", ").concat(e))}if(!h.body)throw Error("No response body");let v=h.body.getReader(),b=new TextDecoder,N="";for(l(e=>[...e,{role:"assistant",content:""}]);;){let{done:e,value:t}=await v.read();if(e)break;for(let e of b.decode(t).split("\n"))if(e.startsWith("data: ")){let t=e.slice(6);if("[DONE]"===t)continue;try{var g,f,y;let e=JSON.parse(t);!n&&e.model&&(n=e.model),e.usage&&(r=e.usage);let a=null===(y=e.choices)||void 0===y?void 0:null===(f=y[0])||void 0===f?void 0:null===(g=f.delta)||void 0===g?void 0:g.content;a&&(s||(s=Date.now()-u),N+=a,l(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:N,model:n,timeToFirstToken:s},t}))}catch(e){console.error("Error parsing chunk:",e)}}}let w=Date.now()-u;l(e=>{let t=[...e];return t[t.length-1]={...t[t.length-1],totalLatency:w,usage:r},t})}catch(e){"AbortError"===e.name?console.log("Request was cancelled"):(console.error("Error testing prompt:",e),l(t=>{let s=t[t.length-1];return s&&"assistant"===s.role&&""===s.content?[...t.slice(0,-1),{role:"assistant",content:"Error: ".concat(e.message)}]:[...t,{role:"assistant",content:"Error: ".concat(e.message)}]}))}finally{n(!1),h(null)}};return{isLoading:s,messages:a,inputMessage:i,variables:d,variablesFilled:p,extractedVariables:v,allVariablesFilled:b,messagesEndRef:g,setInputMessage:c,handleSendMessage:N,handleCancelRequest:()=>{u&&(u.abort(),h(null),n(!1),L.Z.info("Request cancelled"))},handleClearConversation:()=>{l([]),x(!1),L.Z.success("Chat history cleared.")},handleKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),N())},handleVariableChange:(e,t)=>{m({...d,[e]:t})}}};var e_=e=>{let{extractedVariables:t,variables:s,onVariableChange:r}=e;return 0===t.length?null:(0,n.jsxs)("div",{className:"p-4 border-b border-gray-200 bg-blue-50",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Fill in template variables to start testing"}),(0,n.jsx)("div",{className:"space-y-2",children:t.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-xs text-gray-600 mb-1 font-medium",children:["{{",e,"}}"]}),(0,n.jsx)(ee.default,{value:s[e]||"",onChange:t=>r(e,t.target.value),placeholder:"Enter value for ".concat(e),size:"small"})]},e))})]})},eC=s(61935),ek=s(10353),eS=s(69993),eZ=e=>{let{hasVariables:t}=e;return(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(eS.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)("span",{className:"text-base",children:t?"Fill in the variables above, then type a message to start testing":"Type a message below to start testing your prompt"})]})},eP=s(15883),eT=s(62831),eD=s(38398),eE=e=>{let{message:t}=e;return(0,n.jsx)("div",{className:"mb-4 flex ".concat("user"===t.role?"justify-end":"justify-start"),children:(0,n.jsxs)("div",{className:"max-w-[85%] rounded-lg shadow-sm p-3.5 px-4",style:{backgroundColor:"user"===t.role?"#f0f8ff":"#ffffff",border:"user"===t.role?"1px solid #e6f0fa":"1px solid #f0f0f0"},children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded-full mr-1",style:{backgroundColor:"user"===t.role?"#e6f0fa":"#f5f5f5"},children:"user"===t.role?(0,n.jsx)(eP.Z,{style:{fontSize:"12px",color:"#2563eb"}}):(0,n.jsx)(eS.Z,{style:{fontSize:"12px",color:"#4b5563"}})}),(0,n.jsx)("strong",{className:"text-sm capitalize",children:t.role}),"assistant"===t.role&&t.model&&(0,n.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-normal",children:t.model})]}),(0,n.jsxs)("div",{className:"whitespace-pre-wrap break-words max-w-full message-content",style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",hyphens:"auto"},children:["assistant"===t.role?(0,n.jsx)(eT.UG,{components:{code(e){let{node:t,inline:s,className:r,children:a,...l}=e,o=/language-(\w+)/.exec(r||"");return!s&&o?(0,n.jsx)(J.Z,{style:U.Z,language:o[1],PreTag:"div",className:"rounded-md my-2",wrapLines:!0,wrapLongLines:!0,...l,children:String(a).replace(/\n$/,"")}):(0,n.jsx)("code",{className:"".concat(r," px-1.5 py-0.5 rounded bg-gray-100 text-sm font-mono"),style:{wordBreak:"break-word"},...l,children:a})},pre:e=>{let{node:t,...s}=e;return(0,n.jsx)("pre",{style:{overflowX:"auto",maxWidth:"100%"},...s})}},children:t.content}):(0,n.jsx)("div",{className:"whitespace-pre-wrap",children:t.content}),"assistant"===t.role&&(t.timeToFirstToken||t.totalLatency||t.usage)&&(0,n.jsx)(eD.Z,{timeToFirstToken:t.timeToFirstToken,totalLatency:t.totalLatency,usage:t.usage})]})]})})},ez=e=>{let{messages:t,isLoading:s,hasVariables:r,messagesEndRef:a}=e,l=(0,n.jsx)(eC.Z,{style:{fontSize:24},spin:!0});return(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 pb-0",children:[0===t.length&&(0,n.jsx)(eZ,{hasVariables:r}),t.map((e,t)=>(0,n.jsx)(eE,{message:e},t)),s&&(0,n.jsx)("div",{className:"flex justify-center items-center my-4",children:(0,n.jsx)(ek.Z,{indicator:l})}),(0,n.jsx)("div",{ref:a,style:{height:"1px"}})]})},eO=e=>{let{extractedVariables:t,variables:s}=e,r=t.filter(e=>!s[e]||""===s[e].trim());return 0===r.length?null:(0,n.jsx)("div",{className:"mb-3 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)("span",{className:"text-yellow-600 text-sm",children:"⚠️"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium mb-1",children:"Please fill in all template variables above"}),(0,n.jsxs)("p",{className:"text-xs text-yellow-700",children:["Missing: ",r.map(e=>"{{".concat(e,"}}")).join(", ")]})]})]})})},eA=s(79276);let{TextArea:eI}=ee.default;var eL=e=>{let{inputMessage:t,isLoading:s,isDisabled:r,onInputChange:l,onSend:o,onKeyDown:i,onCancel:c}=e;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center flex-1 bg-white border border-gray-300 rounded-xl px-3 py-1 min-h-[44px]",children:[(0,n.jsx)(eI,{value:t,onChange:e=>l(e.target.value),onKeyDown:i,placeholder:"Type your message... (Shift+Enter for new line)",disabled:s,className:"flex-1",autoSize:{minRows:1,maxRows:4},style:{resize:"none",border:"none",boxShadow:"none",background:"transparent",padding:"4px 0",fontSize:"14px",lineHeight:"20px"}}),(0,n.jsx)(a.z,{onClick:o,disabled:r,className:"flex-shrink-0 ml-2 !w-8 !h-8 !min-w-8 !p-0 !rounded-full !bg-blue-600 hover:!bg-blue-700 disabled:!bg-gray-300 !border-none !text-white disabled:!text-gray-500 !flex !items-center !justify-center",children:(0,n.jsx)(eA.Z,{style:{fontSize:"14px"}})})]}),s&&(0,n.jsx)(a.z,{onClick:c,className:"bg-red-50 hover:bg-red-100 text-red-600 border-red-200",children:"Cancel"})]})},eM=e=>{let{prompt:t,accessToken:s}=e,{isLoading:r,messages:l,inputMessage:o,variables:i,variablesFilled:c,extractedVariables:d,allVariablesFilled:m,messagesEndRef:p,setInputMessage:x,handleSendMessage:u,handleCancelRequest:h,handleClearConversation:g,handleKeyDown:v,handleVariableChange:f}=ew(t,s);return(0,n.jsxs)("div",{className:"flex flex-col h-full bg-white",children:[!c&&(0,n.jsx)(e_,{extractedVariables:d,variables:i,onVariableChange:f}),l.length>0&&(0,n.jsx)("div",{className:"p-3 border-b border-gray-200 bg-white flex justify-end",children:(0,n.jsx)(a.z,{onClick:g,className:"bg-gray-100 hover:bg-gray-200 text-gray-700 border-gray-300",icon:eN.Z,children:"Clear Chat"})}),(0,n.jsx)(ez,{messages:l,isLoading:r,hasVariables:d.length>0,messagesEndRef:p}),(0,n.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-white",children:[(0,n.jsx)(eO,{extractedVariables:d,variables:i}),(0,n.jsx)(eL,{inputMessage:o,isLoading:r,isDisabled:r||!o.trim()||d.length>0&&!m,onInputChange:x,onSend:u,onKeyDown:v,onCancel:h})]})]})},eF=e=>{let{visible:t,promptName:s,isSaving:r,onNameChange:a,onPublish:o,onCancel:i}=e;return(0,n.jsx)(l.Z,{title:"Publish Prompt",open:t,onCancel:i,footer:[(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(R.z,{variant:"secondary",onClick:i,children:"Cancel"}),(0,n.jsx)(R.z,{onClick:o,loading:r,children:"Publish"})]},"footer")],children:(0,n.jsxs)("div",{className:"py-4",children:[(0,n.jsx)(R.x,{className:"mb-2",children:"Name"}),(0,n.jsx)(ee.default,{value:s,onChange:e=>a(e.target.value),placeholder:"Enter prompt name",onPressEnter:o,autoFocus:!0}),(0,n.jsx)(R.x,{className:"text-gray-500 text-xs mt-2",children:"Published prompts can be used in API calls and are versioned for easy tracking."})]})})},eB=e=>{let{prompt:t}=e,s=j(t);return(0,n.jsxs)("div",{className:"p-6",children:[(0,n.jsxs)("div",{className:"mb-4",children:[(0,n.jsx)("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Generated .prompt file"}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:"This is the dotprompt format that will be saved to the database"})]}),(0,n.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto",children:(0,n.jsx)("pre",{className:"text-sm text-gray-900 font-mono whitespace-pre-wrap",children:s})})]})},eR=s(57840),eJ=s(63134),eU=s(50337),eV=s(35631);let{Text:eW}=eR.default;var eK=e=>{let{isOpen:t,onClose:s,accessToken:a,promptId:l,activeVersionId:i,onSelectVersion:c}=e,[d,m]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{t&&a&&l&&u()},[t,a,l]);let u=async()=>{x(!0);try{let e=l.includes(".v")?l.split(".v")[0]:l,t=await (0,o.getPromptVersions)(a,e);m(t.prompts)}catch(e){console.error("Error fetching prompt versions:",e)}finally{x(!1)}},h=e=>{var t;if(e.version)return"v".concat(e.version);let s=(null===(t=e.litellm_params)||void 0===t?void 0:t.prompt_id)||e.prompt_id;return s.includes(".v")?"v".concat(s.split(".v")[1]):s.includes("_v")?"v".concat(s.split("_v")[1]):"v1"},g=e=>e?new Date(e).toLocaleString():"-";return(0,n.jsx)(eJ.Z,{title:"Version History",placement:"right",onClose:s,open:t,width:400,mask:!1,maskClosable:!1,children:p?(0,n.jsx)(eU.Z,{active:!0,paragraph:{rows:4}}):0===d.length?(0,n.jsx)("div",{className:"text-center py-8 text-gray-500",children:"No version history available."}):(0,n.jsx)(eV.Z,{dataSource:d,renderItem:(e,t)=>{var s;let r=e.version||parseInt(h(e).replace("v","")),a=null;i&&(i.includes(".v")?a=parseInt(i.split(".v")[1]):i.includes("_v")&&(a=parseInt(i.split("_v")[1])));let l=a?r===a:0===t;return(0,n.jsxs)("div",{className:"mb-4 p-4 rounded-lg border cursor-pointer transition-all hover:shadow-md ".concat(l?"border-blue-500 bg-blue-50":"border-gray-200 bg-white hover:border-blue-300"),onClick:()=>null==c?void 0:c(e),children:[(0,n.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(eu.Z,{className:"m-0",children:h(e)}),0===t&&(0,n.jsx)(eu.Z,{color:"blue",className:"m-0",children:"Latest"})]}),l&&(0,n.jsx)(eu.Z,{color:"green",className:"m-0",children:"Active"})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(eW,{className:"text-sm text-gray-600 font-medium",children:g(e.created_at)}),(0,n.jsx)(eW,{type:"secondary",className:"text-xs",children:(null===(s=e.prompt_info)||void 0===s?void 0:s.prompt_type)==="db"?"Saved to Database":"Config Prompt"})]})]},"".concat(e.prompt_id,"-v").concat(e.version||r))}})})},eH=e=>{var t;let{onClose:s,onSuccess:a,accessToken:l,initialPromptData:i}=e,[c,d]=(0,r.useState)((()=>{if(i)try{return b(i)}catch(e){console.error("Error parsing existing prompt:",e),L.Z.fromBackend("Failed to parse prompt data")}return{name:"New prompt",model:"gpt-4o",config:{temperature:1,max_tokens:1e3},tools:[],developerMessage:"",messages:[{role:"user",content:"Enter task specifics. Use {{template_variables}} for dynamic inputs"}]}})()),[m,p]=(0,r.useState)(!!i),[x,u]=(0,r.useState)(!1),[h,g]=(0,r.useState)((()=>{var e;if(!(null==i?void 0:i.prompt_spec))return;let t=i.prompt_spec.prompt_id,s=i.prompt_spec.version||(null===(e=i.prompt_spec.litellm_params)||void 0===e?void 0:e.prompt_id);return"number"==typeof s?"".concat(t,".v").concat(s):"string"==typeof s&&(s.includes(".v")||s.includes("_v"))?s:t})()),[v,f]=(0,r.useState)(!1),[y,N]=(0,r.useState)(!1),[w,_]=(0,r.useState)(null),[C,k]=(0,r.useState)(!1),[S,Z]=(0,r.useState)("pretty"),P=e=>{void 0!==e?_(e):_(null),f(!0)},T=async()=>{if(!l){L.Z.fromBackend("Access token is required");return}if(!c.name||""===c.name.trim()){L.Z.fromBackend("Please enter a valid prompt name");return}k(!0);try{var e;let t=c.name.replace(/[^a-zA-Z0-9_-]/g,"_").toLowerCase(),n=j(c),r={prompt_id:t,litellm_params:{prompt_integration:"dotprompt",prompt_id:t,dotprompt_content:n},prompt_info:{prompt_type:"db"}};m&&(null==i?void 0:null===(e=i.prompt_spec)||void 0===e?void 0:e.prompt_id)?(await (0,o.updatePromptCall)(l,i.prompt_spec.prompt_id,r),L.Z.success("Prompt updated successfully!")):(await (0,o.createPromptCall)(l,r),L.Z.success("Prompt created successfully!")),a(),s()}catch(e){console.error("Error saving prompt:",e),L.Z.fromBackend(m?"Failed to update prompt":"Failed to save prompt")}finally{k(!1),N(!1)}},D=h&&h.includes(".v")?"v".concat(h.split(".v")[1]):null;return(0,n.jsxs)("div",{className:"flex h-full bg-white",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,n.jsx)(er,{promptName:c.name,onNameChange:e=>d({...c,name:e}),onBack:s,onSave:()=>{c.name&&""!==c.name.trim()&&"New prompt"!==c.name?T():N(!0)},isSaving:C,editMode:m,onShowHistory:()=>u(!0),version:D,promptModel:c.model,promptVariables:(()=>{let e;let t={},s=[c.developerMessage,...c.messages.map(e=>e.content)].join(" "),n=/\{\{(\w+)\}\}/g;for(;null!==(e=n.exec(s));){let s=e[1];t[s]||(t[s]="example_".concat(s))}return t})(),accessToken:l}),(0,n.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,n.jsxs)("div",{className:"w-1/2 overflow-y-auto bg-white border-r border-gray-200 flex-shrink-0",children:[(0,n.jsxs)("div",{className:"border-b border-gray-200 bg-white px-6 py-4 flex items-center gap-3",children:[(0,n.jsx)(ei,{model:c.model,temperature:c.config.temperature,maxTokens:c.config.max_tokens,accessToken:l,onModelChange:e=>d({...c,model:e}),onTemperatureChange:e=>d({...c,config:{...c.config,temperature:e}}),onMaxTokensChange:e=>d({...c,config:{...c.config,max_tokens:e}})}),(0,n.jsxs)("div",{className:"ml-auto inline-flex items-center bg-gray-200 rounded-full p-0.5",children:[(0,n.jsx)("button",{className:"px-3 py-1 text-xs font-medium rounded-full transition-colors ".concat("pretty"===S?"bg-white text-gray-900 shadow-sm":"text-gray-600"),onClick:()=>Z("pretty"),children:"PRETTY"}),(0,n.jsx)("button",{className:"px-3 py-1 text-xs font-medium rounded-full transition-colors ".concat("dotprompt"===S?"bg-white text-gray-900 shadow-sm":"text-gray-600"),onClick:()=>Z("dotprompt"),children:"DOTPROMPT"})]})]}),"pretty"===S?(0,n.jsxs)("div",{className:"p-6 space-y-4 pb-20",children:[(0,n.jsx)(ep,{tools:c.tools,onAddTool:()=>P(),onEditTool:P,onRemoveTool:e=>{d({...c,tools:c.tools.filter((t,s)=>s!==e)})}}),(0,n.jsx)(ef,{value:c.developerMessage,onChange:e=>d({...c,developerMessage:e})}),(0,n.jsx)(ey,{messages:c.messages,onAddMessage:()=>{d({...c,messages:[...c.messages,{role:"user",content:""}]})},onUpdateMessage:(e,t,s)=>{let n=[...c.messages];n[e][t]=s,d({...c,messages:n})},onRemoveMessage:e=>{c.messages.length>1&&d({...c,messages:c.messages.filter((t,s)=>s!==e)})},onMoveMessage:(e,t)=>{let s=[...c.messages],[n]=s.splice(e,1);s.splice(t,0,n),d({...c,messages:s})}})]}):(0,n.jsx)(eB,{prompt:c})]}),(0,n.jsx)("div",{className:"w-1/2 flex-shrink-0",children:(0,n.jsx)(eM,{prompt:c,accessToken:l})})]})]}),(0,n.jsx)(eF,{visible:y,promptName:c.name,isSaving:C,onNameChange:e=>d({...c,name:e}),onPublish:T,onCancel:()=>N(!1)}),v&&(0,n.jsx)(Q,{visible:v,initialJson:null!==w?c.tools[w].json:"",onSave:e=>{try{var t,s;let n=JSON.parse(e),r={name:(null===(t=n.function)||void 0===t?void 0:t.name)||"Unnamed Tool",description:(null===(s=n.function)||void 0===s?void 0:s.description)||"",json:e};if(null!==w){let e=[...c.tools];e[w]=r,d({...c,tools:e})}else d({...c,tools:[...c.tools,r]});f(!1),_(null)}catch(e){L.Z.fromBackend("Invalid JSON format")}},onClose:()=>{f(!1),_(null)}}),(0,n.jsx)(eK,{isOpen:x,onClose:()=>u(!1),accessToken:l,promptId:(null==i?void 0:null===(t=i.prompt_spec)||void 0===t?void 0:t.prompt_id)||c.name,activeVersionId:h,onSelectVersion:e=>{try{let t=b({prompt_spec:e});d(t);let s=e.version||1;g("".concat(e.prompt_id,".v").concat(s))}catch(e){console.error("Error loading version:",e),L.Z.fromBackend("Failed to load prompt version")}}})]})},eq=s(20347),eG=e=>{let{accessToken:t,userRole:s}=e,[i,c]=(0,r.useState)([]),[d,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[g,v]=(0,r.useState)(!1),[f,j]=(0,r.useState)(null),[b,y]=(0,r.useState)(!1),[N,w]=(0,r.useState)(null),_=!!s&&(0,eq.tY)(s),C=async()=>{if(t){m(!0);try{let e=await (0,o.getPromptsList)(t);console.log("prompts: ".concat(JSON.stringify(e))),c(e.prompts)}catch(e){console.error("Error fetching prompts:",e)}finally{m(!1)}}};(0,r.useEffect)(()=>{C()},[t]);let k=()=>{C(),v(!1),j(null),x(null)},S=async()=>{if(N&&t){y(!0);try{await (0,o.deletePromptCall)(t,N.id),L.Z.success('Prompt "'.concat(N.name,'" deleted successfully')),C()}catch(e){console.error("Error deleting prompt:",e),L.Z.fromBackend("Failed to delete prompt")}finally{y(!1),w(null)}}};return(0,n.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[g?(0,n.jsx)(eH,{onClose:()=>{v(!1),j(null)},onSuccess:k,accessToken:t,initialPromptData:f}):p?(0,n.jsx)(W,{promptId:p,onClose:()=>x(null),accessToken:t,isAdmin:_,onDelete:C,onEdit:e=>{j(e),v(!0)}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(a.z,{onClick:()=>{p&&x(null),j(null),v(!0)},disabled:!t,children:"+ Add New Prompt"}),(0,n.jsx)(a.z,{onClick:()=>{p&&x(null),h(!0)},disabled:!t,variant:"secondary",children:"Upload .prompt File"})]})}),(0,n.jsx)(P,{promptsList:i,isLoading:d,onPromptClick:e=>{x(e)},onDeleteClick:(e,t)=>{w({id:e,name:t})},accessToken:t,isAdmin:_})]}),(0,n.jsx)($,{visible:u,onClose:()=>{h(!1)},accessToken:t,onSuccess:k}),N&&(0,n.jsxs)(l.Z,{title:"Delete Prompt",open:null!==N,onOk:S,onCancel:()=>{w(null)},confirmLoading:b,okText:"Delete",okButtonProps:{danger:!0},children:[(0,n.jsxs)("p",{children:["Are you sure you want to delete prompt: ",N.name," ?"]}),(0,n.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6537-7dac00cfbcc977de.js b/litellm/proxy/_experimental/out/_next/static/chunks/6537-8996330966afd86d.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/6537-7dac00cfbcc977de.js rename to litellm/proxy/_experimental/out/_next/static/chunks/6537-8996330966afd86d.js index dff30dde32..e4a978b6ee 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6537-7dac00cfbcc977de.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6537-8996330966afd86d.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6537],{86537:function(e,s,r){r.d(s,{d:function(){return e4},o:function(){return ss}});var t=r(57437),l=r(20347),a=r(67187),n=r(78489),i=r(12485),o=r(18135),c=r(35242),d=r(29706),m=r(77991),u=r(84264),x=r(96761),h=r(57840),p=r(37592),g=r(22116),j=r(76188),v=r(99981),f=r(2265),y=r(68474),b=r(11713),N=r(90246),_=r(19250),w=r(39760);let Z=(0,N.n)("mcpServerHealth"),C=e=>{let{accessToken:s}=(0,w.Z)();return(0,b.a)({queryKey:[...Z.lists(),{serverIds:e}],queryFn:async()=>await (0,_.fetchMCPServerHealth)(s,e),enabled:!!s,refetchInterval:3e4})};var S=r(9114),k=r(12322),A=r(10032),P=r(4260),M=r(15424),O=r(64504);let I={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic",OAUTH2:"oauth2"},T={SSE:"sse"},L=e=>(console.log(e),null==e)?T.SSE:e,E=e=>null==e?I.NONE:e;var z=r(19015),q=r(44851),U=r(33866),R=r(62670),V=r(58630),F=r(12514),B=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(R.Z,{className:"text-green-600"}),(0,t.jsx)(x.Z,{children:"Cost Configuration"}),(0,t.jsx)(v.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(M.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(v.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(M.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(z.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(u.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(v.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(M.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(q.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(V.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(U.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(u.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(u.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(z.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(u.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(u.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(u.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})},H=r(10353),K=r(51653),D=r(5545),J=r(83669),G=r(29271),Y=r(89245);let W=e=>{var s,r;let{accessToken:t,oauthAccessToken:l,formValues:a,enabled:n=!0}=e,[i,o]=(0,f.useState)([]),[c,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),[x,h]=(0,f.useState)(null),[p,g]=(0,f.useState)(!1),j=a.auth_type===I.OAUTH2,v=!!(a.url&&a.transport&&a.auth_type&&t&&(!j||l)),y=JSON.stringify(null!==(s=a.static_headers)&&void 0!==s?s:{}),b=JSON.stringify(null!==(r=a.credentials)&&void 0!==r?r:{}),N=async()=>{if(t&&a.url&&(!j||l)){d(!0),u(null);try{let e=Array.isArray(a.static_headers)?a.static_headers.reduce((e,s)=>{var r;let t=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return t&&(e[t]=(null==s?void 0:s.value)!=null?String(s.value):""),e},{}):!Array.isArray(a.static_headers)&&a.static_headers&&"object"==typeof a.static_headers?Object.entries(a.static_headers).reduce((e,s)=>{let[r,t]=s;return r&&(e[r]=null!=t?String(t):""),e},{}):{},s=a.credentials&&"object"==typeof a.credentials?Object.entries(a.credentials).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,r={server_id:a.server_id||"",server_name:a.server_name||"",url:a.url,transport:a.transport,auth_type:a.auth_type,authorization_url:a.authorization_url,token_url:a.token_url,registration_url:a.registration_url,mcp_info:a.mcp_info,static_headers:e};s&&Object.keys(s).length>0&&(r.credentials=s);let n=await (0,_.testMCPToolsListRequest)(t,r,l);if(n.tools&&!n.error)o(n.tools),u(null),h(null),n.tools.length>0&&!p&&g(!0);else{let e=n.message||"Failed to retrieve tools list";u(e),h(n.stack_trace||null),o([]),g(!1)}}catch(e){console.error("Tools fetch error:",e),u(e instanceof Error?e.message:String(e)),h(null),o([]),g(!1)}finally{d(!1)}}},w=()=>{o([]),u(null),h(null),g(!1)};return(0,f.useEffect)(()=>{n&&(v?N():w())},[a.url,a.transport,a.auth_type,t,n,l,v,y,b]),{tools:i,isLoadingTools:c,toolsError:m,toolsErrorStackTrace:x,hasShownSuccessMessage:p,canFetchTools:v,fetchTools:N,clearTools:w}};var $=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,toolsErrorStackTrace:c,canFetchTools:d,fetchTools:m}=W({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});return((0,f.useEffect)(()=>{null==a||a(n)},[n,a]),d||l.url)?(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(J.Z,{className:"text-blue-600"}),(0,t.jsx)(x.Z,{children:"Connection Status"})]}),!d&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(u.Z,{className:"text-gray-500 text-sm",children:["Server: ",l.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(H.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(u.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)(J.Z,{className:"mr-1"}),(0,t.jsx)(u.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(G.Z,{className:"mr-1"}),(0,t.jsx)(u.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(H.Z,{size:"large"}),(0,t.jsx)(u.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(K.Z,{message:"Connection Failed",description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:o}),c&&(0,t.jsx)(q.default,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,t.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:c})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,t.jsx)(D.ZP,{icon:(0,t.jsx)(Y.Z,{}),onClick:m,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)(J.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(u.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},Q=r(61994),X=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,f.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:h}=W({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});(0,f.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let p=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return h||l.url?(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(V.Z,{className:"text-blue-600"}),(0,t.jsx)(x.Z,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(U.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(u.Z,{className:"text-blue-800 text-sm",children:[(0,t.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(H.Z,{size:"large"}),(0,t.jsx)(u.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&h&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!h&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)(J.Z,{className:"text-green-600"}),(0,t.jsxs)(u.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>p(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(Q.Z,{checked:a.includes(e.name),onChange:()=>p(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.Z,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(u.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(u.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},ee=e=>{let{isVisible:s}=e;return s?(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(v.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(P.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null},es=r(63709),er=r(58760),et=r(45246),el=r(96473);let{Panel:ea}=q.default;var en=e=>{var s;let{availableAccessGroups:r,mcpServer:l,searchValue:a,setSearchValue:n,getAccessGroupOptions:i}=e,o=A.Z.useFormInstance();return(0,f.useEffect)(()=>{if(l){if(l.extra_headers&&o.setFieldValue("extra_headers",l.extra_headers),l.static_headers){let e=Object.entries(l.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}});o.setFieldValue("static_headers",e)}"boolean"==typeof l.allow_all_keys&&o.setFieldValue("allow_all_keys",l.allow_all_keys)}else o.setFieldValue("allow_all_keys",!1)},[l,o]),(0,t.jsx)(q.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(ea,{header:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Allow All LiteLLM Keys",(0,t.jsx)(v.Z,{title:"When enabled, every API key can access this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:'Enable if this server should be "public" to all keys.'})]}),(0,t.jsx)(A.Z.Item,{name:"allow_all_keys",valuePropName:"checked",initialValue:null!==(s=null==l?void 0:l.allow_all_keys)&&void 0!==s&&s,className:"mb-0",children:(0,t.jsx)(es.Z,{})})]}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(v.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(p.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>n(e),tokenSeparators:[","],options:i(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(v.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==l?void 0:l.extra_headers)&&l.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[l.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:(null==l?void 0:l.extra_headers)&&l.extra_headers.length>0?"Currently: ".concat(l.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,t.jsx)(v.Z,{title:"Send these key-value headers with every request to this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,t.jsx)(A.Z.List,{name:"static_headers",children:(e,s)=>{let{add:r,remove:l}=s;return(0,t.jsxs)("div",{className:"space-y-3",children:[e.map(e=>{let{key:s,name:r,...a}=e;return(0,t.jsxs)(er.Z,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,t.jsx)(A.Z.Item,{...a,name:[r,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,t.jsx)(P.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,t.jsx)(A.Z.Item,{...a,name:[r,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,t.jsx)(P.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,t.jsx)(et.Z,{onClick:()=>l(r),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},s)}),(0,t.jsx)(D.ZP,{type:"dashed",onClick:()=>r(),icon:(0,t.jsx)(el.Z,{}),block:!0,children:"Add Static Header"})]})}})})]})},"permissions")})};let ei=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},eo=e=>{let{token:s,baseUrl:r}=ei(e);return s?r+"...":e},ec=e=>{let{token:s}=ei(e);return{maskedUrl:eo(e),hasToken:!!s}},ed=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),em=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),eu=e=>{let s=new Uint8Array(e),r="";return s.forEach(e=>r+=String.fromCharCode(e)),btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},ex=()=>{let e=new Uint8Array(32);return window.crypto.getRandomValues(e),eu(e.buffer)},eh=async e=>{let s=new TextEncoder().encode(e);return eu(await window.crypto.subtle.digest("SHA-256",s))},ep=e=>{let{accessToken:s,getCredentials:r,getTemporaryPayload:t,onTokenReceived:l,onBeforeRedirect:a}=e,[n,i]=(0,f.useState)("idle"),[o,c]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),u="litellm-mcp-oauth-flow-state",x="litellm-mcp-oauth-result",h="litellm-mcp-oauth-return-url",p=()=>{try{window.sessionStorage.removeItem(u),window.sessionStorage.removeItem(x),window.sessionStorage.removeItem(h)}catch(e){console.warn("Failed to clear OAuth storage",e)}},g=()=>{{let e=window.location.pathname||"",s=e.indexOf("/ui"),r=(s>=0?e.slice(0,s+3):"").replace(/\/+$/,"");return"".concat(window.location.origin).concat(r,"/mcp/oauth/callback")}},j=()=>g(),v=(0,f.useCallback)(async()=>{let e=r()||{};if(!s){c("Missing admin token"),S.Z.error("Access token missing. Please re-authenticate and try again.");return}let l=t();if(!l||!l.url||!l.transport){let e="Please complete server URL and transport before starting OAuth.";c(e),S.Z.error(e);return}try{var n,o,d;i("authorizing"),c(null);let r=await (0,_.cacheTemporaryMcpServer)(s,l),t=null==r?void 0:null===(n=r.server_id)||void 0===n?void 0:n.trim();if(!t)throw Error("Temporary MCP server identifier missing. Please retry.");let m={};if(!((null===(o=l.credentials)||void 0===o?void 0:o.client_id)&&(null===(d=l.credentials)||void 0===d?void 0:d.client_secret))){let e=await (0,_.registerMcpOAuthClient)(s,t,{client_name:l.alias||l.server_name||t,grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:l.credentials&&l.credentials.client_secret?"client_secret_post":"none"});m={clientId:null==e?void 0:e.client_id,clientSecret:null==e?void 0:e.client_secret}}let x=ex(),p=await eh(x),g=crypto.randomUUID(),v=m.clientId||e.client_id,f=Array.isArray(e.scopes)?e.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,y=(0,_.buildMcpOAuthAuthorizeUrl)({serverId:t,clientId:v,redirectUri:j(),state:g,codeChallenge:p,scope:f}),b={state:g,codeVerifier:x,clientId:v,clientSecret:m.clientSecret||e.client_secret,serverId:t,redirectUri:j()};if(a)try{a()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{window.sessionStorage.setItem(u,JSON.stringify(b)),window.sessionStorage.setItem(h,window.location.href)}catch(e){throw console.error("Unable to persist OAuth state",e),Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=y}catch(s){console.error("Failed to start OAuth flow",s),i("error");let e=s instanceof Error?s.message:String(s);c(e),S.Z.error(e)}},[s,r,t,a]),y=(0,f.useCallback)(async()=>{let e=null,s=null;try{let r=window.sessionStorage.getItem(x);if(!r)return;e=JSON.parse(r),s=JSON.parse(window.sessionStorage.getItem(u)||"null")}catch(e){console.error("Failed to read OAuth session state",e),p(),c("Failed to resume OAuth flow. Please retry."),i("error"),S.Z.error("Failed to resume OAuth flow. Please retry.");return}if(e){window.sessionStorage.removeItem(x);try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("Missing OAuth session state. Please retry.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");i("exchanging");let r=await (0,_.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});l(r),m(r),i("success"),c(null),S.Z.success("OAuth token retrieved successfully")}catch(s){console.error("OAuth flow failed",s);let e=s instanceof Error?s.message:String(s);c(e),i("error"),S.Z.error(e)}finally{p()}}},[l]);return(0,f.useEffect)(()=>{let e=!1;return(async()=>{e||await y()})(),()=>{e=!0}},[y]),{startOAuthFlow:v,status:n,error:o,tokenResponse:d}},eg="".concat("../ui/assets/logos/","mcp_logo.png"),ej=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],ev=[...ej,I.OAUTH2],ef="litellm-mcp-oauth-create-state";var ey=e=>{var s;let{userRole:r,accessToken:a,onCreateSuccess:n,isModalVisible:i,setModalVisible:o,availableAccessGroups:c}=e,[d]=A.Z.useForm(),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)({}),[j,y]=(0,f.useState)({}),[b,N]=(0,f.useState)(null),[w,Z]=(0,f.useState)(!1),[C,k]=(0,f.useState)([]),[T,L]=(0,f.useState)([]),[E,z]=(0,f.useState)(""),[q,U]=(0,f.useState)(""),[R,V]=(0,f.useState)(null),F=j.auth_type,H=!!F&&ej.includes(F),K=F===I.OAUTH2,{startOAuthFlow:D,status:J,error:G,tokenResponse:Y}=ep({accessToken:a,getCredentials:()=>d.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=d.getFieldsValue(!0),s=e.url,r=e.transport||E;if(!s||!r)return null;let t=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:s,transport:r,auth_type:I.OAUTH2,credentials:e.credentials,authorization_url:e.authorization_url,token_url:e.token_url,registration_url:e.registration_url,mcp_access_groups:e.mcp_access_groups,static_headers:t,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;V(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=d.getFieldsValue(!0);window.sessionStorage.setItem(ef,JSON.stringify({modalVisible:i,formValues:e,transportType:E,costConfig:x,allowedTools:T,searchValue:q,aliasManuallyEdited:w}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});f.useEffect(()=>{let e=window.sessionStorage.getItem(ef);if(e)try{var s;let r=JSON.parse(e);r.modalVisible&&o(!0);let t=(null===(s=r.formValues)||void 0===s?void 0:s.transport)||r.transportType||"";t&&z(t),r.formValues&&N({values:r.formValues,transport:t}),r.costConfig&&h(r.costConfig),r.allowedTools&&L(r.allowedTools),r.searchValue&&U(r.searchValue),"boolean"==typeof r.aliasManuallyEdited&&Z(r.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(ef)}},[d,o]),f.useEffect(()=>{b&&(E||b.transport,(!b.transport||E)&&(d.setFieldsValue(b.values),y(b.values),N(null)))},[b,d,E]);let W=async e=>{u(!0);try{let{static_headers:s,stdio_config:r,credentials:t,allow_all_keys:l,...i}=e,c=i.mcp_access_groups,m=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},u=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,p={};if(r&&"stdio"===E)try{let e=JSON.parse(r),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);if(r.length>0){let t=r[0];s=e.mcpServers[t],i.server_name||(i.server_name=t.replace(/-/g,"_"))}}p={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",p)}catch(e){S.Z.fromBackend("Invalid JSON in stdio configuration");return}let g={...i,...p,stdio_config:void 0,mcp_info:{server_name:i.server_name||i.url,description:i.description,mcp_server_cost_info:Object.keys(x).length>0?x:null},mcp_access_groups:c,alias:i.alias,allowed_tools:T.length>0?T:null,allow_all_keys:!!l,static_headers:m};if(g.static_headers=m,i.auth_type&&ev.includes(i.auth_type)&&u&&Object.keys(u).length>0&&(g.credentials=u),console.log("Payload: ".concat(JSON.stringify(g))),null!=a){let e=await (0,_.createMCPServer)(a,g);S.Z.success("MCP Server created successfully"),d.resetFields(),h({}),k([]),L([]),Z(!1),o(!1),n(e)}}catch(e){S.Z.fromBackend("Error creating MCP Server: "+e)}finally{u(!1)}},Q=()=>{d.resetFields(),h({}),k([]),L([]),Z(!1),o(!1)};return(f.useEffect(()=>{if(!w&&j.server_name){let e=j.server_name.replace(/\s+/g,"_");d.setFieldsValue({alias:e}),y(s=>({...s,alias:e}))}},[j.server_name]),f.useEffect(()=>{i||y({})},[i]),(0,l.tY)(r))?(0,t.jsx)(g.Z,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("img",{src:eg,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:i,width:1e3,onCancel:Q,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(A.Z,{form:d,onFinish:W,onValuesChange:(e,s)=>y(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(v.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>em(s)}],children:(0,t.jsx)(O.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(v.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,t.jsx)(O.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>Z(!0)})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description!!!!!!!!!"}],children:(0,t.jsx)(O.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{z(e),"stdio"===e?d.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0}):d.setFieldsValue({command:void 0,args:void 0,env:void 0})},value:E,children:[(0,t.jsx)(p.default.Option,{value:"http",children:"HTTP"}),(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==E&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>ed(s)}],children:(0,t.jsx)(P.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==E&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),"stdio"!==E&&H&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{required:!0,message:"Please enter the authentication value"}],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==E&&K&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter OAuth client ID",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter OAuth client secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(v.Z,{title:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the authorization endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the token endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional orverride for the dynamic client registration endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(O.z,{variant:"secondary",onClick:D,disabled:"authorizing"===J||"exchanging"===J,children:"authorizing"===J?"Waiting for authorization...":"exchanging"===J?"Exchanging authorization code...":"Authorize & Fetch Token"}),G&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:G}),"success"===J&&(null==Y?void 0:Y.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=Y.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)(ee,{isVisible:"stdio"===E})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(en,{availableAccessGroups:c,mcpServer:null,searchValue:q,setSearchValue:U,getAccessGroupOptions:()=>{let e=c.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return q&&!c.some(e=>e.toLowerCase().includes(q.toLowerCase()))&&e.push({value:q,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:q}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)($,{accessToken:a,oauthAccessToken:R,formValues:j,onToolsLoaded:k})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(X,{accessToken:a,oauthAccessToken:R,formValues:j,allowedTools:T,existingAllowedTools:null,onAllowedToolsChange:L})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{value:x,onChange:h,tools:C.filter(e=>T.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(O.z,{variant:"secondary",onClick:Q,children:"Cancel"}),(0,t.jsx)(O.z,{variant:"primary",loading:m,children:m?"Creating...":"Add MCP Server"})]})]})})}):null},eb=r(5945),eN=r(64935),e_=r(30401),ew=r(78867),eZ=r(11239),eC=r(54001),eS=r(96137),ek=r(96362),eA=r(80221),eP=r(29202),eM=r(59872);let{Title:eO,Text:eI}=h.default,{Panel:eT}=q.default,eL=e=>{let{icon:s,title:r,description:l,children:a,serverName:n,accessGroups:i=["dev"]}=e,[o,c]=(0,f.useState)(!1),d=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(o&&n){let s=[n.replace(/\s+/g,"_"),...i].join(",");e["x-mcp-servers"]=[s]}return e};return(0,t.jsxs)(eb.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eO,{level:5,className:"mb-0",children:r}),(0,t.jsx)(eI,{className:"text-gray-600",children:l})]})]}),n&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(A.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(es.Z,{size:"small",checked:o,onChange:c}),(0,t.jsxs)(eI,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),o&&(0,t.jsx)(K.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['["',n.replace(/\s+/g,"_"),'"]']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'["dev-group"]'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),f.Children.map(a,e=>{if(f.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return f.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(d(),null,8)))})}return e})]})};var eE=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,_.getProxyBaseUrl)(),[l,a]=(0,f.useState)({}),[n,h]=(0,f.useState)({openai:[],litellm:[],cursor:[],http:[]}),[p]=(0,f.useState)("Zapier_MCP"),g=async(e,s)=>{await (0,eM.vQ)(e)&&(a(e=>({...e,[s]:!0})),setTimeout(()=>{a(e=>({...e,[s]:!1}))},2e3))},j=e=>{let{code:s,copyKey:r,title:a,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(eN.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(eI,{strong:!0,className:"text-gray-700",children:a})]}),(0,t.jsxs)(eb.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:l[r]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>g(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(l[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},v=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(eI,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(u.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,t.jsxs)(o.Z,{className:"w-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eN.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eZ.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eA.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eP.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eN.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(eI,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eL,{icon:(0,t.jsx)(eC.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(eI,{children:["Get your API key from the"," ",(0,t.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,t.jsx)(ek.Z,{size:12})]})]})}),(0,t.jsx)(j,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eS.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(j,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eZ.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(eI,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eL,{icon:(0,t.jsx)(eC.Z,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(j,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eS.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:p,accessGroups:["dev"],children:(0,t.jsx)(j,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eA.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(eI,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,t.jsxs)(eb.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eO,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(v,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(eI,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(v,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(eI,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(v,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(eI,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(j,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eP.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(eI,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eP.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(j,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(D.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(ek.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},ez=r(58927),eq=r(53410),eU=r(74998);let eR=(e,s,r,l,a)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=ec(s.original.url);return(0,t.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",n=r.last_health_check,i=r.health_check_error;if(a)return(0,t.jsxs)("div",{className:"flex items-center text-gray-500",children:[(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-1",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,t.jsx)("span",{className:"text-xs",children:"Loading..."})]});let o=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),n&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(n).toLocaleString()]}),i&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:i})]}),!n&&!i&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(v.Z,{title:o,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(v.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.Z,{title:"Edit MCP Server",children:(0,t.jsx)(ez.J,{icon:eq.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(v.Z,{title:"Delete MCP Server",children:(0,t.jsx)(ez.J,{icon:eU.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer hover:text-red-600"})})]})}}];var eV=r(77331),eF=r(82376),eB=r(71437),eH=r(67101),eK=r(47323),eD=r(49566);let eJ=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],eG=[...eJ,I.OAUTH2],eY="litellm-mcp-oauth-edit-state";var eW=e=>{var s;let{mcpServer:r,accessToken:l,onCancel:a,onSuccess:u,availableAccessGroups:x}=e,[h]=A.Z.useForm(),[g,j]=(0,f.useState)({}),[y,b]=(0,f.useState)([]),[N,w]=(0,f.useState)(!1),[Z,C]=(0,f.useState)(""),[k,P]=(0,f.useState)(!1),[O,T]=(0,f.useState)([]),[L,E]=(0,f.useState)(null),z=A.Z.useWatch("auth_type",h),q=!!z&&eJ.includes(z),U=z===I.OAUTH2,[R,V]=(0,f.useState)(null),{startOAuthFlow:F,status:H,error:K,tokenResponse:J}=ep({accessToken:l,getCredentials:()=>h.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=h.getFieldsValue(!0),s=e.url||r.url,t=e.transport||r.transport;if(!s||!t)return null;let l=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:r.server_id,server_name:e.server_name||r.server_name||r.alias,alias:e.alias||r.alias,description:e.description||r.description,url:s,transport:t,auth_type:I.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups||r.mcp_access_groups,static_headers:l,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;V(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=h.getFieldsValue(!0);window.sessionStorage.setItem(eY,JSON.stringify({serverId:r.server_id,formValues:e,costConfig:g,allowedTools:O,searchValue:Z,aliasManuallyEdited:k}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),G=f.useMemo(()=>r.static_headers?Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}}):[],[r.static_headers]),Y=f.useMemo(()=>({...r,static_headers:G}),[r,G]);(0,f.useEffect)(()=>{var e;(null===(e=r.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&j(r.mcp_info.mcp_server_cost_info)},[r]),(0,f.useEffect)(()=>{r.allowed_tools&&T(r.allowed_tools)},[r]),(0,f.useEffect)(()=>{let e=window.sessionStorage.getItem(eY);if(e)try{let s=JSON.parse(e);if(!s||s.serverId!==r.server_id)return;s.formValues&&E({...r,...s.formValues}),s.costConfig&&j(s.costConfig),s.allowedTools&&T(s.allowedTools),s.searchValue&&C(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&P(s.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(eY)}},[h,r]),(0,f.useEffect)(()=>{if(!L)return;let e=L.transport||r.transport;if(e&&e!==h.getFieldValue("transport")){h.setFieldsValue({transport:e});return}h.setFieldsValue(L),E(null)},[L,h,r.transport]),(0,f.useEffect)(()=>{if(r.mcp_access_groups){let e=r.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));h.setFieldValue("mcp_access_groups",e)}},[r]),(0,f.useEffect)(()=>{W()},[r,l,R]);let W=async()=>{if(l&&r.url&&(r.auth_type!==I.OAUTH2||R)){w(!0);try{let e={server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info,authorization_url:r.authorization_url,token_url:r.token_url,registration_url:r.registration_url},s=await (0,_.testMCPToolsListRequest)(l,e,R);s.tools&&!s.error?b(s.tools):(console.error("Failed to fetch tools:",s.message),b([]))}catch(e){console.error("Tools fetch error:",e),b([])}finally{w(!1)}}},$=async e=>{if(l)try{let{static_headers:s,credentials:t,allow_all_keys:a,...n}=e,i=(n.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),o=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},c=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,d={...n,server_id:r.server_id,mcp_info:{server_name:n.server_name||n.url,description:n.description,mcp_server_cost_info:Object.keys(g).length>0?g:null},mcp_access_groups:i,alias:n.alias,extra_headers:n.extra_headers||[],allowed_tools:O.length>0?O:null,disallowed_tools:n.disallowed_tools||[],static_headers:o,allow_all_keys:!!(null!=a?a:r.allow_all_keys)};n.auth_type&&eG.includes(n.auth_type)&&c&&Object.keys(c).length>0&&(d.credentials=c);let m=await (0,_.updateMCPServer)(l,d);S.Z.success("MCP Server updated successfully"),u(m)}catch(e){S.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(o.Z,{children:[(0,t.jsxs)(c.Z,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(i.Z,{children:"Server Configuration"}),(0,t.jsx)(i.Z,{children:"Cost Configuration"})]}),(0,t.jsxs)(m.Z,{className:"mt-6",children:[(0,t.jsx)(d.Z,{children:(0,t.jsxs)(A.Z,{form:h,onFinish:$,initialValues:Y,layout:"vertical",children:[(0,t.jsx)(A.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>em(s)}],children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>em(s)}],children:(0,t.jsx)(eD.Z,{onChange:()=>P(!0)})}),(0,t.jsx)(A.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>ed(s)}],children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{children:[(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"http",children:"HTTP"})]})}),(0,t.jsx)(A.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),q&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),U&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(v.Z,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the authorization endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the token endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the dynamic client registration endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(n.Z,{variant:"secondary",onClick:F,disabled:"authorizing"===H||"exchanging"===H,children:"authorizing"===H?"Waiting for authorization...":"exchanging"===H?"Exchanging authorization code...":"Authorize & Fetch Token"}),K&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:K}),"success"===H&&(null==J?void 0:J.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=J.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(en,{availableAccessGroups:x,mcpServer:r,searchValue:Z,setSearchValue:C,getAccessGroupOptions:()=>{let e=x.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return Z&&!x.some(e=>e.toLowerCase().includes(Z.toLowerCase()))&&e.push({value:Z,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:Z}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(X,{accessToken:l,oauthAccessToken:R,formValues:{server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},allowedTools:O,existingAllowedTools:r.allowed_tools||null,onAllowedToolsChange:T})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(D.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(n.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(d.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(B,{value:g,onChange:j,tools:y,disabled:N}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(D.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(n.Z,{onClick:()=>h.submit(),children:"Save Changes"})]})]})})]})]})},e$=r(92280),eQ=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(e$.x,{className:"font-medium",children:s}),(0,t.jsxs)(e$.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(e$.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(e$.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(e$.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(e$.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})};let eX=e=>{var s,r,l,a,h;let{mcpServer:p,onBack:g,isEditing:j,isProxyAdmin:v,accessToken:y,userRole:b,userID:N,availableAccessGroups:_}=e,[w,Z]=(0,f.useState)(j),[C,S]=(0,f.useState)(!1),[k,A]=(0,f.useState)({}),[P,M]=(0,f.useState)(0),{maskedUrl:O,hasToken:I}=ec(p.url),T=(e,s)=>I?s?e:O:e,z=async(e,s)=>{await (0,eM.vQ)(e)&&(A(e=>({...e,[s]:!0})),setTimeout(()=>{A(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Z,{icon:eV.Z,variant:"light",className:"mb-4",onClick:g,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(x.Z,{children:p.server_name}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-server_name"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),p.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:p.alias}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-alias"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(u.Z,{className:"text-gray-500 font-mono",children:p.server_id}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-server-id"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(o.Z,{index:P,onIndexChange:M,children:[(0,t.jsx)(c.Z,{className:"mb-4",children:[(0,t.jsx)(i.Z,{children:"Overview"},"overview"),(0,t.jsx)(i.Z,{children:"MCP Tools"},"tools"),...v?[(0,t.jsx)(i.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(eH.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(x.Z,{children:L(null!==(a=p.transport)&&void 0!==a?a:void 0)})})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(u.Z,{children:E(null!==(h=p.auth_type)&&void 0!==h?h:void 0)})})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(u.Z,{className:"break-all overflow-wrap-anywhere",children:T(p.url,C)}),I&&(0,t.jsx)("button",{onClick:()=>S(!C),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eK.Z,{icon:C?eF.Z:eB.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(F.Z,{className:"mt-2",children:[(0,t.jsx)(x.Z,{children:"Cost Configuration"}),(0,t.jsx)(eQ,{costConfig:null===(s=p.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(ss,{serverId:p.server_id,accessToken:y,auth_type:p.auth_type,userRole:b,userID:N,serverAlias:p.alias})}),(0,t.jsx)(d.Z,{children:(0,t.jsxs)(F.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(x.Z,{children:"MCP Server Settings"}),w?null:(0,t.jsx)(n.Z,{variant:"light",onClick:()=>Z(!0),children:"Edit Settings"})]}),w?(0,t.jsx)(eW,{mcpServer:p,accessToken:y,onCancel:()=>Z(!1),onSuccess:e=>{Z(!1),g()},availableAccessGroups:_}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:p.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:p.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:p.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[T(p.url,C),I&&(0,t.jsx)("button",{onClick:()=>S(!C),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eK.Z,{icon:C?eF.Z:eB.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:L(p.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=p.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:E(p.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Allow All LiteLLM Keys"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[p.allow_all_keys?(0,t.jsx)("span",{className:"px-2 py-1 bg-green-50 text-green-700 rounded-md text-sm",children:"Enabled"}):(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 rounded-md text-sm",children:"Disabled"}),p.allow_all_keys&&(0,t.jsx)(u.Z,{className:"text-xs text-gray-500",children:"All keys can access this MCP server"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:p.mcp_access_groups&&p.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:p.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(u.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:p.allowed_tools&&p.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:p.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(u.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(eQ,{costConfig:null===(l=p.mcp_info)||void 0===l?void 0:l.mcp_server_cost_info})]})]})]})})]})]})]})},{Text:e0,Title:e2}=h.default,{Option:e1}=p.default;var e4=e=>{let{accessToken:s,userRole:r,userID:h}=e,{data:b,isLoading:N,refetch:w}=(0,y.F)(),{data:Z,isLoading:A}=C((0,f.useMemo)(()=>null==b?void 0:b.map(e=>e.server_id),[b])),P=(0,f.useMemo)(()=>{if(!b)return[];if(!Z)return b;let e=new Map(Z.map(e=>[e.server_id,e.status]));return b.map(s=>{let r=e.get(s.server_id);return{...s,status:r||s.status}})},[b,Z]);f.useEffect(()=>{b&&(console.log("MCP Servers fetched:",b),b.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[b]);let[M,O]=(0,f.useState)(null),[I,T]=(0,f.useState)(!1),[L,E]=(0,f.useState)(null),[z,q]=(0,f.useState)(!1),[U,R]=(0,f.useState)("all"),[V,F]=(0,f.useState)("all"),[B,H]=(0,f.useState)([]),[K,D]=(0,f.useState)(!1),[J,G]=(0,f.useState)(!1),Y="Internal User"===r;(0,f.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);(null==s?void 0:s.serverId)&&(E(s.serverId),q(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let W=f.useMemo(()=>{if(!P)return[];let e=new Set,s=[];return P.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[P]),$=f.useMemo(()=>P?Array.from(new Set(P.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[P]),Q=(0,f.useCallback)((e,s)=>{if(!P)return H([]);let r=P;if("personal"===e){H([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),H(r)},[P]);(0,f.useEffect)(()=>{Q(U,V)},[P,U,V,Q]);let X=f.useMemo(()=>eR(null!=r?r:"",e=>{E(e),q(!1)},e=>{E(e),q(!0)},ee,A),[r,A]);function ee(e){O(e),T(!0)}let es=async()=>{if(null!=M&&null!=s)try{G(!0),await (0,_.deleteMCPServer)(s,M),S.Z.success("Deleted MCP Server successfully"),w()}catch(e){console.error("Error deleting the mcp server:",e)}finally{G(!1),T(!1),O(null)}},er=M?(b||[]).find(e=>e.server_id===M):null,et=f.useMemo(()=>B.find(e=>e.server_id===L)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},[B,L]),el=f.useCallback(()=>{q(!1),E(null),w()},[w]);return s&&r&&h?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(g.Z,{open:I,title:"Delete MCP Server?",onOk:es,okText:J?"Deleting...":"Delete",onCancel:()=>{T(!1),O(null)},cancelText:"Cancel",cancelButtonProps:{disabled:J},okButtonProps:{danger:!0},confirmLoading:J,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e0,{children:"Are you sure you want to delete this MCP Server? This action cannot be undone."}),er&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(e2,{level:5,className:"mb-3 text-gray-900",children:"Server Information"}),(0,t.jsxs)(j.Z,{column:1,size:"small",children:[er.server_name&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server Name"}),children:(0,t.jsx)(e0,{className:"text-sm",children:er.server_name})}),er.alias&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Alias"}),children:(0,t.jsx)(e0,{className:"text-sm",children:er.alias})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server ID"}),children:(0,t.jsx)(e0,{code:!0,className:"text-sm",children:er.server_id})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"URL"}),children:(0,t.jsx)(e0,{code:!0,className:"text-sm",children:er.url})})]})]})]})}),(0,t.jsx)(ey,{userRole:r,accessToken:s,onCreateSuccess:e=>{H(s=>[...s,e]),D(!1)},isModalVisible:K,setModalVisible:D,availableAccessGroups:$}),(0,t.jsx)(x.Z,{children:"MCP Servers"}),(0,t.jsx)(u.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,l.tY)(r)&&(0,t.jsx)(n.Z,{className:"mt-4 mb-4",onClick:()=>D(!0),children:"+ Add New MCP Server"}),(0,t.jsxs)(o.Z,{className:"w-full h-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(i.Z,{children:"All Servers"}),(0,t.jsx)(i.Z,{children:"Connect"})]})}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:L?(0,t.jsx)(eX,{mcpServer:et,onBack:el,isProxyAdmin:(0,l.tY)(r),isEditing:z,accessToken:s,userID:h,userRole:r,availableAccessGroups:$},L):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(u.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(p.default,{value:U,onChange:e=>{R(e),Q(e,V)},style:{width:300},children:[(0,t.jsx)(e1,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:Y?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(e1,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),W.map(e=>(0,t.jsx)(e1,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(u.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(v.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,t.jsx)(a.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(p.default,{value:V,onChange:e=>{F(e),Q(U,e)},style:{width:300},children:[(0,t.jsx)(e1,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),$.map(e=>(0,t.jsx)(e1,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(k.w,{data:B,columns:X,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:N,noDataMessage:"No MCP servers configured",loadingMessage:"\uD83D\uDE85 Loading MCP servers..."})})]})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(eE,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:h}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},e5=r(21770);let e6=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function e3(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>e7(e)).filter(e=>void 0!==e);let s=e7(e);return void 0===s?[]:[s]}function e7(e,s){if(!e)return;let r=void 0!==s?s:e.default;if("object"===e.type){let s=e6(r)?{...r}:{};return e.properties&&Object.entries(e.properties).forEach(e=>{let[r,t]=e;s[r]=e7(t,s[r])}),s}if("array"===e.type){if(Array.isArray(r)){let s=e.items;if(!s)return r;if(0===r.length){let e=e3(s);return e.length?e:r}return Array.isArray(s)?r.map((e,r)=>{var t;return e7(null!==(t=s[r])&&void 0!==t?t:s[s.length-1],e)}):r.map(e=>e7(s,e))}return void 0!==r?r:e3(e.items)}if(void 0!==r)return r;switch(e.type){case"integer":case"number":return 0;case"boolean":return!1;default:return""}}let e8=e=>{let s=e7(e);if("object"===e.type||"array"===e.type){let r="array"===e.type?[]:{};return JSON.stringify(null!=s?s:r,null,2)}return s};function e9(e){let{tool:s,onSubmit:r,isLoading:l,result:a,error:n,onClose:i}=e,[o]=A.Z.useForm(),[c,d]=f.useState("formatted"),[m,u]=f.useState(null),[x,h]=f.useState(null),p=f.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),g=f.useMemo(()=>p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{type:"object",properties:p.properties.params.properties,required:p.properties.params.required||[]}:p,[p]);f.useEffect(()=>{if(o.resetFields(),!g.properties)return;let e={};Object.entries(g.properties).forEach(s=>{let[r,t]=s;e[r]=e8(t)}),o.setFieldsValue(e)},[o,g,s]),f.useEffect(()=>{m&&(a||n)&&h(Date.now()-m)},[a,n,m]);let j=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},y=async()=>{await j(JSON.stringify(a,null,2))?S.Z.success("Result copied to clipboard"):S.Z.fromBackend("Failed to copy result")},b=async()=>{await j(s.name)?S.Z.success("Tool name copied to clipboard"):S.Z.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:b,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(O.z,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(v.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(M.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(A.Z,{form:o,onFinish:e=>{u(Date.now()),h(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=g.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":case"integer":{let e=Number(l);s[t]=Number.isNaN(e)?l:"integer"===a.type?Math.trunc(e):e;break}case"object":case"array":try{let e="string"==typeof l?JSON.parse(l):l,r="object"===a.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),n="array"===a.type&&Array.isArray(e);"object"===a.type&&r||"array"===a.type&&n?s[t]=e:s[t]=l}catch(e){s[t]=l}break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),r(p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(O.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===g.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(g.properties).map(e=>{var r,l,a,n;let[i,o]=e,c=e8(o),d="".concat(s.name,"-").concat(i);return(0,t.jsxs)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(r=g.required)||void 0===r?void 0:r.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),o.description&&(0,t.jsx)(v.Z,{title:o.description,children:(0,t.jsx)(M.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,initialValue:c,rules:[{required:null===(l=g.required)||void 0===l?void 0:l.includes(i),message:"Please enter ".concat(i)},..."object"===o.type||"array"===o.type?[{validator:(e,s)=>{var r;if((null==s||""===s)&&!(null===(r=g.required)||void 0===r?void 0:r.includes(i)))return Promise.resolve();try{let e="string"==typeof s?JSON.parse(s):s,r="object"===o.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),t="array"===o.type&&Array.isArray(e);if("object"===o.type&&r||"array"===o.type&&t)return Promise.resolve();return Promise.reject(Error("object"===o.type?"Please enter a JSON object":"Please enter a JSON array"))}catch(e){return Promise.reject(Error("Invalid JSON"))}}}]:[]],className:"mb-3",children:["string"===o.type&&o.enum&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:null!=c?c:"",children:[!(null===(a=g.required)||void 0===a?void 0:a.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),o.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===o.type&&!o.enum&&(0,t.jsx)(O.o,{placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:"",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),("number"===o.type||"integer"===o.type)&&(0,t.jsx)("input",{type:"number",step:"integer"===o.type?1:"any",placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:0,className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===o.type&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null!=c&&c).toString(),children:[!(null===(n=g.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]}),("object"===o.type||"array"===o.type)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("textarea",{rows:"object"===o.type?6:4,placeholder:o.description||("object"===o.type?"Enter JSON object for ".concat(i):"Enter JSON array for ".concat(i)),defaultValue:null!=c?c:"object"===o.type?"{}":"[]",spellCheck:!1,"data-testid":"textarea-".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm font-mono"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"object"===o.type?"Provide a valid JSON object.":"Provide a valid JSON array."})]})]},d)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(O.z,{onClick:()=>o.submit(),disabled:l,variant:"primary",className:"w-full",loading:l,children:l?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:a||n||l?(0,t.jsxs)("div",{className:"space-y-3",children:[a&&!l&&!n&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>d("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>d("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:y,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[l&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!l&&!n&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,t.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var se=r(69993),ss=e=>{let{serverId:s,accessToken:r,auth_type:l,userRole:a,userID:n,serverAlias:i}=e,[o,c]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),[h,p]=(0,f.useState)(null),{data:g,isLoading:j,error:v}=(0,b.a)({queryKey:["mcpTools",s],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,_.listMCPTools)(r,s)},enabled:!!r,staleTime:3e4}),{mutate:y,isPending:N}=(0,e5.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,_.callMCPTool)(r,s,e.tool.name,e.arguments)}catch(e){throw e}},onSuccess:e=>{m(e.content),p(null)},onError:e=>{p(e),m(null)}}),w=(null==g?void 0:g.tools)||[];return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(F.Z,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(x.Z,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(u.Z,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(V.Z,{className:"mr-2"})," Available Tools",w.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:w.length})]}),j&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==g?void 0:g.error)&&!j&&!w.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",g.message]})}),!j&&!(null==g?void 0:g.error)&&(!w||0===w.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!j&&!(null==g?void 0:g.error)&&w.length>0&&(0,t.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:w.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==o?void 0:o.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{c(e),m(null),p(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==o?void 0:o.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(x.Z,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(e9,{tool:o,onSubmit:e=>{y({tool:o,arguments:e})},result:d,error:h,isLoading:N,onClose:()=>c(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(se.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(u.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(u.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6537],{86537:function(e,s,r){r.d(s,{d:function(){return e4},o:function(){return ss}});var t=r(57437),l=r(20347),a=r(67187),n=r(78489),i=r(12485),o=r(18135),c=r(35242),d=r(29706),m=r(77991),u=r(84264),x=r(96761),h=r(57840),p=r(37592),g=r(22116),j=r(76188),v=r(99981),f=r(2265),y=r(68474),b=r(11713),N=r(90246),_=r(19250),w=r(39760);let Z=(0,N.n)("mcpServerHealth"),C=e=>{let{accessToken:s}=(0,w.Z)();return(0,b.a)({queryKey:[...Z.lists(),{serverIds:e}],queryFn:async()=>await (0,_.fetchMCPServerHealth)(s,e),enabled:!!s,refetchInterval:3e4})};var S=r(9114),k=r(60493),A=r(10032),P=r(4260),M=r(15424),O=r(64504);let I={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic",OAUTH2:"oauth2"},T={SSE:"sse"},L=e=>(console.log(e),null==e)?T.SSE:e,E=e=>null==e?I.NONE:e;var z=r(19015),q=r(44851),U=r(33866),R=r(62670),V=r(58630),F=r(12514),B=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(R.Z,{className:"text-green-600"}),(0,t.jsx)(x.Z,{children:"Cost Configuration"}),(0,t.jsx)(v.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(M.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(v.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(M.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(z.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(u.Z,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(v.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(M.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(q.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(V.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(U.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(u.Z,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(u.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(z.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(u.Z,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(u.Z,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(u.Z,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})},H=r(10353),K=r(51653),D=r(5545),J=r(83669),G=r(29271),Y=r(89245);let W=e=>{var s,r;let{accessToken:t,oauthAccessToken:l,formValues:a,enabled:n=!0}=e,[i,o]=(0,f.useState)([]),[c,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),[x,h]=(0,f.useState)(null),[p,g]=(0,f.useState)(!1),j=a.auth_type===I.OAUTH2,v=!!(a.url&&a.transport&&a.auth_type&&t&&(!j||l)),y=JSON.stringify(null!==(s=a.static_headers)&&void 0!==s?s:{}),b=JSON.stringify(null!==(r=a.credentials)&&void 0!==r?r:{}),N=async()=>{if(t&&a.url&&(!j||l)){d(!0),u(null);try{let e=Array.isArray(a.static_headers)?a.static_headers.reduce((e,s)=>{var r;let t=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return t&&(e[t]=(null==s?void 0:s.value)!=null?String(s.value):""),e},{}):!Array.isArray(a.static_headers)&&a.static_headers&&"object"==typeof a.static_headers?Object.entries(a.static_headers).reduce((e,s)=>{let[r,t]=s;return r&&(e[r]=null!=t?String(t):""),e},{}):{},s=a.credentials&&"object"==typeof a.credentials?Object.entries(a.credentials).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,r={server_id:a.server_id||"",server_name:a.server_name||"",url:a.url,transport:a.transport,auth_type:a.auth_type,authorization_url:a.authorization_url,token_url:a.token_url,registration_url:a.registration_url,mcp_info:a.mcp_info,static_headers:e};s&&Object.keys(s).length>0&&(r.credentials=s);let n=await (0,_.testMCPToolsListRequest)(t,r,l);if(n.tools&&!n.error)o(n.tools),u(null),h(null),n.tools.length>0&&!p&&g(!0);else{let e=n.message||"Failed to retrieve tools list";u(e),h(n.stack_trace||null),o([]),g(!1)}}catch(e){console.error("Tools fetch error:",e),u(e instanceof Error?e.message:String(e)),h(null),o([]),g(!1)}finally{d(!1)}}},w=()=>{o([]),u(null),h(null),g(!1)};return(0,f.useEffect)(()=>{n&&(v?N():w())},[a.url,a.transport,a.auth_type,t,n,l,v,y,b]),{tools:i,isLoadingTools:c,toolsError:m,toolsErrorStackTrace:x,hasShownSuccessMessage:p,canFetchTools:v,fetchTools:N,clearTools:w}};var $=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,toolsErrorStackTrace:c,canFetchTools:d,fetchTools:m}=W({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});return((0,f.useEffect)(()=>{null==a||a(n)},[n,a]),d||l.url)?(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(J.Z,{className:"text-blue-600"}),(0,t.jsx)(x.Z,{children:"Connection Status"})]}),!d&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(u.Z,{className:"text-gray-500 text-sm",children:["Server: ",l.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(H.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(u.Z,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)(J.Z,{className:"mr-1"}),(0,t.jsx)(u.Z,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(G.Z,{className:"mr-1"}),(0,t.jsx)(u.Z,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(H.Z,{size:"large"}),(0,t.jsx)(u.Z,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(K.Z,{message:"Connection Failed",description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:o}),c&&(0,t.jsx)(q.default,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,t.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:c})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,t.jsx)(D.ZP,{icon:(0,t.jsx)(Y.Z,{}),onClick:m,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)(J.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(u.Z,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},Q=r(61994),X=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,f.useRef)(0),{tools:c,isLoadingTools:d,toolsError:m,canFetchTools:h}=W({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});(0,f.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let p=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return h||l.url?(0,t.jsx)(F.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(V.Z,{className:"text-blue-600"}),(0,t.jsx)(x.Z,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(U.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(u.Z,{className:"text-blue-800 text-sm",children:[(0,t.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(H.Z,{size:"large"}),(0,t.jsx)(u.Z,{className:"ml-3",children:"Loading tools..."})]}),m&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm text-red-500",children:m})]}),!d&&!m&&0===c.length&&h&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!h&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(V.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(u.Z,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(u.Z,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!m&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)(J.Z,{className:"text-green-600"}),(0,t.jsxs)(u.Z,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>p(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(Q.Z,{checked:a.includes(e.name),onChange:()=>p(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.Z,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(u.Z,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(u.Z,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},ee=e=>{let{isVisible:s}=e;return s?(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(v.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[{required:!0,message:"Please enter stdio configuration"},{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(P.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null},es=r(63709),er=r(58760),et=r(45246),el=r(96473);let{Panel:ea}=q.default;var en=e=>{var s;let{availableAccessGroups:r,mcpServer:l,searchValue:a,setSearchValue:n,getAccessGroupOptions:i}=e,o=A.Z.useFormInstance();return(0,f.useEffect)(()=>{if(l){if(l.extra_headers&&o.setFieldValue("extra_headers",l.extra_headers),l.static_headers){let e=Object.entries(l.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}});o.setFieldValue("static_headers",e)}"boolean"==typeof l.allow_all_keys&&o.setFieldValue("allow_all_keys",l.allow_all_keys)}else o.setFieldValue("allow_all_keys",!1)},[l,o]),(0,t.jsx)(q.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(ea,{header:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Allow All LiteLLM Keys",(0,t.jsx)(v.Z,{title:"When enabled, every API key can access this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:'Enable if this server should be "public" to all keys.'})]}),(0,t.jsx)(A.Z.Item,{name:"allow_all_keys",valuePropName:"checked",initialValue:null!==(s=null==l?void 0:l.allow_all_keys)&&void 0!==s&&s,className:"mb-0",children:(0,t.jsx)(es.Z,{})})]}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(v.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(p.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>n(e),tokenSeparators:[","],options:i(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(v.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==l?void 0:l.extra_headers)&&l.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[l.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:(null==l?void 0:l.extra_headers)&&l.extra_headers.length>0?"Currently: ".concat(l.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,t.jsx)(v.Z,{title:"Send these key-value headers with every request to this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,t.jsx)(A.Z.List,{name:"static_headers",children:(e,s)=>{let{add:r,remove:l}=s;return(0,t.jsxs)("div",{className:"space-y-3",children:[e.map(e=>{let{key:s,name:r,...a}=e;return(0,t.jsxs)(er.Z,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,t.jsx)(A.Z.Item,{...a,name:[r,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,t.jsx)(P.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,t.jsx)(A.Z.Item,{...a,name:[r,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,t.jsx)(P.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,t.jsx)(et.Z,{onClick:()=>l(r),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},s)}),(0,t.jsx)(D.ZP,{type:"dashed",onClick:()=>r(),icon:(0,t.jsx)(el.Z,{}),block:!0,children:"Add Static Header"})]})}})})]})},"permissions")})};let ei=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},eo=e=>{let{token:s,baseUrl:r}=ei(e);return s?r+"...":e},ec=e=>{let{token:s}=ei(e);return{maskedUrl:eo(e),hasToken:!!s}},ed=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),em=e=>e&&e.includes("-")?Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve(),eu=e=>{let s=new Uint8Array(e),r="";return s.forEach(e=>r+=String.fromCharCode(e)),btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},ex=()=>{let e=new Uint8Array(32);return window.crypto.getRandomValues(e),eu(e.buffer)},eh=async e=>{let s=new TextEncoder().encode(e);return eu(await window.crypto.subtle.digest("SHA-256",s))},ep=e=>{let{accessToken:s,getCredentials:r,getTemporaryPayload:t,onTokenReceived:l,onBeforeRedirect:a}=e,[n,i]=(0,f.useState)("idle"),[o,c]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),u="litellm-mcp-oauth-flow-state",x="litellm-mcp-oauth-result",h="litellm-mcp-oauth-return-url",p=()=>{try{window.sessionStorage.removeItem(u),window.sessionStorage.removeItem(x),window.sessionStorage.removeItem(h)}catch(e){console.warn("Failed to clear OAuth storage",e)}},g=()=>{{let e=window.location.pathname||"",s=e.indexOf("/ui"),r=(s>=0?e.slice(0,s+3):"").replace(/\/+$/,"");return"".concat(window.location.origin).concat(r,"/mcp/oauth/callback")}},j=()=>g(),v=(0,f.useCallback)(async()=>{let e=r()||{};if(!s){c("Missing admin token"),S.Z.error("Access token missing. Please re-authenticate and try again.");return}let l=t();if(!l||!l.url||!l.transport){let e="Please complete server URL and transport before starting OAuth.";c(e),S.Z.error(e);return}try{var n,o,d;i("authorizing"),c(null);let r=await (0,_.cacheTemporaryMcpServer)(s,l),t=null==r?void 0:null===(n=r.server_id)||void 0===n?void 0:n.trim();if(!t)throw Error("Temporary MCP server identifier missing. Please retry.");let m={};if(!((null===(o=l.credentials)||void 0===o?void 0:o.client_id)&&(null===(d=l.credentials)||void 0===d?void 0:d.client_secret))){let e=await (0,_.registerMcpOAuthClient)(s,t,{client_name:l.alias||l.server_name||t,grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:l.credentials&&l.credentials.client_secret?"client_secret_post":"none"});m={clientId:null==e?void 0:e.client_id,clientSecret:null==e?void 0:e.client_secret}}let x=ex(),p=await eh(x),g=crypto.randomUUID(),v=m.clientId||e.client_id,f=Array.isArray(e.scopes)?e.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,y=(0,_.buildMcpOAuthAuthorizeUrl)({serverId:t,clientId:v,redirectUri:j(),state:g,codeChallenge:p,scope:f}),b={state:g,codeVerifier:x,clientId:v,clientSecret:m.clientSecret||e.client_secret,serverId:t,redirectUri:j()};if(a)try{a()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{window.sessionStorage.setItem(u,JSON.stringify(b)),window.sessionStorage.setItem(h,window.location.href)}catch(e){throw console.error("Unable to persist OAuth state",e),Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=y}catch(s){console.error("Failed to start OAuth flow",s),i("error");let e=s instanceof Error?s.message:String(s);c(e),S.Z.error(e)}},[s,r,t,a]),y=(0,f.useCallback)(async()=>{let e=null,s=null;try{let r=window.sessionStorage.getItem(x);if(!r)return;e=JSON.parse(r),s=JSON.parse(window.sessionStorage.getItem(u)||"null")}catch(e){console.error("Failed to read OAuth session state",e),p(),c("Failed to resume OAuth flow. Please retry."),i("error"),S.Z.error("Failed to resume OAuth flow. Please retry.");return}if(e){window.sessionStorage.removeItem(x);try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("Missing OAuth session state. Please retry.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");i("exchanging");let r=await (0,_.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});l(r),m(r),i("success"),c(null),S.Z.success("OAuth token retrieved successfully")}catch(s){console.error("OAuth flow failed",s);let e=s instanceof Error?s.message:String(s);c(e),i("error"),S.Z.error(e)}finally{p()}}},[l]);return(0,f.useEffect)(()=>{let e=!1;return(async()=>{e||await y()})(),()=>{e=!0}},[y]),{startOAuthFlow:v,status:n,error:o,tokenResponse:d}},eg="".concat("../ui/assets/logos/","mcp_logo.png"),ej=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],ev=[...ej,I.OAUTH2],ef="litellm-mcp-oauth-create-state";var ey=e=>{var s;let{userRole:r,accessToken:a,onCreateSuccess:n,isModalVisible:i,setModalVisible:o,availableAccessGroups:c}=e,[d]=A.Z.useForm(),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)({}),[j,y]=(0,f.useState)({}),[b,N]=(0,f.useState)(null),[w,Z]=(0,f.useState)(!1),[C,k]=(0,f.useState)([]),[T,L]=(0,f.useState)([]),[E,z]=(0,f.useState)(""),[q,U]=(0,f.useState)(""),[R,V]=(0,f.useState)(null),F=j.auth_type,H=!!F&&ej.includes(F),K=F===I.OAUTH2,{startOAuthFlow:D,status:J,error:G,tokenResponse:Y}=ep({accessToken:a,getCredentials:()=>d.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=d.getFieldsValue(!0),s=e.url,r=e.transport||E;if(!s||!r)return null;let t=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:s,transport:r,auth_type:I.OAUTH2,credentials:e.credentials,authorization_url:e.authorization_url,token_url:e.token_url,registration_url:e.registration_url,mcp_access_groups:e.mcp_access_groups,static_headers:t,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;V(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=d.getFieldsValue(!0);window.sessionStorage.setItem(ef,JSON.stringify({modalVisible:i,formValues:e,transportType:E,costConfig:x,allowedTools:T,searchValue:q,aliasManuallyEdited:w}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});f.useEffect(()=>{let e=window.sessionStorage.getItem(ef);if(e)try{var s;let r=JSON.parse(e);r.modalVisible&&o(!0);let t=(null===(s=r.formValues)||void 0===s?void 0:s.transport)||r.transportType||"";t&&z(t),r.formValues&&N({values:r.formValues,transport:t}),r.costConfig&&h(r.costConfig),r.allowedTools&&L(r.allowedTools),r.searchValue&&U(r.searchValue),"boolean"==typeof r.aliasManuallyEdited&&Z(r.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(ef)}},[d,o]),f.useEffect(()=>{b&&(E||b.transport,(!b.transport||E)&&(d.setFieldsValue(b.values),y(b.values),N(null)))},[b,d,E]);let W=async e=>{u(!0);try{let{static_headers:s,stdio_config:r,credentials:t,allow_all_keys:l,...i}=e,c=i.mcp_access_groups,m=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},u=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,p={};if(r&&"stdio"===E)try{let e=JSON.parse(r),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);if(r.length>0){let t=r[0];s=e.mcpServers[t],i.server_name||(i.server_name=t.replace(/-/g,"_"))}}p={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",p)}catch(e){S.Z.fromBackend("Invalid JSON in stdio configuration");return}let g={...i,...p,stdio_config:void 0,mcp_info:{server_name:i.server_name||i.url,description:i.description,mcp_server_cost_info:Object.keys(x).length>0?x:null},mcp_access_groups:c,alias:i.alias,allowed_tools:T.length>0?T:null,allow_all_keys:!!l,static_headers:m};if(g.static_headers=m,i.auth_type&&ev.includes(i.auth_type)&&u&&Object.keys(u).length>0&&(g.credentials=u),console.log("Payload: ".concat(JSON.stringify(g))),null!=a){let e=await (0,_.createMCPServer)(a,g);S.Z.success("MCP Server created successfully"),d.resetFields(),h({}),k([]),L([]),Z(!1),o(!1),n(e)}}catch(e){S.Z.fromBackend("Error creating MCP Server: "+e)}finally{u(!1)}},Q=()=>{d.resetFields(),h({}),k([]),L([]),Z(!1),o(!1)};return(f.useEffect(()=>{if(!w&&j.server_name){let e=j.server_name.replace(/\s+/g,"_");d.setFieldsValue({alias:e}),y(s=>({...s,alias:e}))}},[j.server_name]),f.useEffect(()=>{i||y({})},[i]),(0,l.tY)(r))?(0,t.jsx)(g.Z,{title:(0,t.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,t.jsx)("img",{src:eg,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:i,width:1e3,onCancel:Q,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(A.Z,{form:d,onFinish:W,onValuesChange:(e,s)=>y(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(v.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Hyphens '-' are not allowed; use underscores '_' instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>em(s)}],children:(0,t.jsx)(O.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(v.Z,{title:"A short, unique identifier for this server. Defaults to the server name with spaces replaced by underscores.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>s&&s.includes("-")?Promise.reject("Alias cannot contain '-' (hyphen). Please use '_' (underscore) instead."):Promise.resolve()}],children:(0,t.jsx)(O.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>Z(!0)})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description!!!!!!!!!"}],children:(0,t.jsx)(O.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{z(e),"stdio"===e?d.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0}):d.setFieldsValue({command:void 0,args:void 0,env:void 0})},value:E,children:[(0,t.jsx)(p.default.Option,{value:"http",children:"HTTP"}),(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==E&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>ed(s)}],children:(0,t.jsx)(P.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==E&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),"stdio"!==E&&H&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{required:!0,message:"Please enter the authentication value"}],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==E&&K&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter OAuth client ID",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(O.o,{type:"password",placeholder:"Enter OAuth client secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(v.Z,{title:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the authorization endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the token endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional orverride for the dynamic client registration endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,t.jsx)(O.o,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(O.z,{variant:"secondary",onClick:D,disabled:"authorizing"===J||"exchanging"===J,children:"authorizing"===J?"Waiting for authorization...":"exchanging"===J?"Exchanging authorization code...":"Authorize & Fetch Token"}),G&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:G}),"success"===J&&(null==Y?void 0:Y.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=Y.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)(ee,{isVisible:"stdio"===E})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(en,{availableAccessGroups:c,mcpServer:null,searchValue:q,setSearchValue:U,getAccessGroupOptions:()=>{let e=c.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return q&&!c.some(e=>e.toLowerCase().includes(q.toLowerCase()))&&e.push({value:q,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:q}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)($,{accessToken:a,oauthAccessToken:R,formValues:j,onToolsLoaded:k})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(X,{accessToken:a,oauthAccessToken:R,formValues:j,allowedTools:T,existingAllowedTools:null,onAllowedToolsChange:L})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(B,{value:x,onChange:h,tools:C.filter(e=>T.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(O.z,{variant:"secondary",onClick:Q,children:"Cancel"}),(0,t.jsx)(O.z,{variant:"primary",loading:m,children:m?"Creating...":"Add MCP Server"})]})]})})}):null},eb=r(5945),eN=r(64935),e_=r(30401),ew=r(78867),eZ=r(11239),eC=r(54001),eS=r(96137),ek=r(96362),eA=r(80221),eP=r(29202),eM=r(59872);let{Title:eO,Text:eI}=h.default,{Panel:eT}=q.default,eL=e=>{let{icon:s,title:r,description:l,children:a,serverName:n,accessGroups:i=["dev"]}=e,[o,c]=(0,f.useState)(!1),d=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(o&&n){let s=[n.replace(/\s+/g,"_"),...i].join(",");e["x-mcp-servers"]=[s]}return e};return(0,t.jsxs)(eb.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eO,{level:5,className:"mb-0",children:r}),(0,t.jsx)(eI,{className:"text-gray-600",children:l})]})]}),n&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(A.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(es.Z,{size:"small",checked:o,onChange:c}),(0,t.jsxs)(eI,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),o&&(0,t.jsx)(K.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['["',n.replace(/\s+/g,"_"),'"]']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'["dev-group"]'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'["Server1,dev-group"]'})]})]})})]}),f.Children.map(a,e=>{if(f.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return f.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(d(),null,8)))})}return e})]})};var eE=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,_.getProxyBaseUrl)(),[l,a]=(0,f.useState)({}),[n,h]=(0,f.useState)({openai:[],litellm:[],cursor:[],http:[]}),[p]=(0,f.useState)("Zapier_MCP"),g=async(e,s)=>{await (0,eM.vQ)(e)&&(a(e=>({...e,[s]:!0})),setTimeout(()=>{a(e=>({...e,[s]:!1}))},2e3))},j=e=>{let{code:s,copyKey:r,title:a,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(eN.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(eI,{strong:!0,className:"text-gray-700",children:a})]}),(0,t.jsxs)(eb.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:l[r]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>g(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(l[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},v=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(eI,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(u.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,t.jsxs)(o.Z,{className:"w-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eN.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eZ.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eA.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eP.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eN.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(eI,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eL,{icon:(0,t.jsx)(eC.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(eI,{children:["Get your API key from the"," ",(0,t.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,t.jsx)(ek.Z,{size:12})]})]})}),(0,t.jsx)(j,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eS.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(j,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eZ.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(eI,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eL,{icon:(0,t.jsx)(eC.Z,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(j,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eS.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:p,accessGroups:["dev"],children:(0,t.jsx)(j,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eA.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(eI,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,t.jsxs)(eb.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eO,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(v,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(eI,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(v,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(eI,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(v,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(eI,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eN.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev"],children:(0,t.jsx)(j,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": ["Zapier_MCP,dev"]\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(er.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eP.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eO,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(eI,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(eL,{icon:(0,t.jsx)(eP.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(er.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(eI,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(j,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(j,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(D.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(ek.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},ez=r(58927),eq=r(53410),eU=r(74998);let eR=(e,s,r,l,a)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,{maskedUrl:r}=ec(s.original.url);return(0,t.jsx)("span",{className:"font-mono text-sm",children:r})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",n=r.last_health_check,i=r.health_check_error;if(a)return(0,t.jsxs)("div",{className:"flex items-center text-gray-500",children:[(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-1",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,t.jsx)("span",{className:"text-xs",children:"Loading..."})]});let o=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),n&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(n).toLocaleString()]}),i&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:i})]}),!n&&!i&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(v.Z,{title:o,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(v.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.Z,{title:"Edit MCP Server",children:(0,t.jsx)(ez.J,{icon:eq.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(v.Z,{title:"Delete MCP Server",children:(0,t.jsx)(ez.J,{icon:eU.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer hover:text-red-600"})})]})}}];var eV=r(10900),eF=r(82376),eB=r(71437),eH=r(67101),eK=r(47323),eD=r(49566);let eJ=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],eG=[...eJ,I.OAUTH2],eY="litellm-mcp-oauth-edit-state";var eW=e=>{var s;let{mcpServer:r,accessToken:l,onCancel:a,onSuccess:u,availableAccessGroups:x}=e,[h]=A.Z.useForm(),[g,j]=(0,f.useState)({}),[y,b]=(0,f.useState)([]),[N,w]=(0,f.useState)(!1),[Z,C]=(0,f.useState)(""),[k,P]=(0,f.useState)(!1),[O,T]=(0,f.useState)([]),[L,E]=(0,f.useState)(null),z=A.Z.useWatch("auth_type",h),q=!!z&&eJ.includes(z),U=z===I.OAUTH2,[R,V]=(0,f.useState)(null),{startOAuthFlow:F,status:H,error:K,tokenResponse:J}=ep({accessToken:l,getCredentials:()=>h.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=h.getFieldsValue(!0),s=e.url||r.url,t=e.transport||r.transport;if(!s||!t)return null;let l=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:r.server_id,server_name:e.server_name||r.server_name||r.alias,alias:e.alias||r.alias,description:e.description||r.description,url:s,transport:t,auth_type:I.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups||r.mcp_access_groups,static_headers:l,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;V(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=h.getFieldsValue(!0);window.sessionStorage.setItem(eY,JSON.stringify({serverId:r.server_id,formValues:e,costConfig:g,allowedTools:O,searchValue:Z,aliasManuallyEdited:k}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),G=f.useMemo(()=>r.static_headers?Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}}):[],[r.static_headers]),Y=f.useMemo(()=>({...r,static_headers:G}),[r,G]);(0,f.useEffect)(()=>{var e;(null===(e=r.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&j(r.mcp_info.mcp_server_cost_info)},[r]),(0,f.useEffect)(()=>{r.allowed_tools&&T(r.allowed_tools)},[r]),(0,f.useEffect)(()=>{let e=window.sessionStorage.getItem(eY);if(e)try{let s=JSON.parse(e);if(!s||s.serverId!==r.server_id)return;s.formValues&&E({...r,...s.formValues}),s.costConfig&&j(s.costConfig),s.allowedTools&&T(s.allowedTools),s.searchValue&&C(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&P(s.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(eY)}},[h,r]),(0,f.useEffect)(()=>{if(!L)return;let e=L.transport||r.transport;if(e&&e!==h.getFieldValue("transport")){h.setFieldsValue({transport:e});return}h.setFieldsValue(L),E(null)},[L,h,r.transport]),(0,f.useEffect)(()=>{if(r.mcp_access_groups){let e=r.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));h.setFieldValue("mcp_access_groups",e)}},[r]),(0,f.useEffect)(()=>{W()},[r,l,R]);let W=async()=>{if(l&&r.url&&(r.auth_type!==I.OAUTH2||R)){w(!0);try{let e={server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info,authorization_url:r.authorization_url,token_url:r.token_url,registration_url:r.registration_url},s=await (0,_.testMCPToolsListRequest)(l,e,R);s.tools&&!s.error?b(s.tools):(console.error("Failed to fetch tools:",s.message),b([]))}catch(e){console.error("Tools fetch error:",e),b([])}finally{w(!1)}}},$=async e=>{if(l)try{let{static_headers:s,credentials:t,allow_all_keys:a,...n}=e,i=(n.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),o=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},c=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,d={...n,server_id:r.server_id,mcp_info:{server_name:n.server_name||n.url,description:n.description,mcp_server_cost_info:Object.keys(g).length>0?g:null},mcp_access_groups:i,alias:n.alias,extra_headers:n.extra_headers||[],allowed_tools:O.length>0?O:null,disallowed_tools:n.disallowed_tools||[],static_headers:o,allow_all_keys:!!(null!=a?a:r.allow_all_keys)};n.auth_type&&eG.includes(n.auth_type)&&c&&Object.keys(c).length>0&&(d.credentials=c);let m=await (0,_.updateMCPServer)(l,d);S.Z.success("MCP Server updated successfully"),u(m)}catch(e){S.Z.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(o.Z,{children:[(0,t.jsxs)(c.Z,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(i.Z,{children:"Server Configuration"}),(0,t.jsx)(i.Z,{children:"Cost Configuration"})]}),(0,t.jsxs)(m.Z,{className:"mt-6",children:[(0,t.jsx)(d.Z,{children:(0,t.jsxs)(A.Z,{form:h,onFinish:$,initialValues:Y,layout:"vertical",children:[(0,t.jsx)(A.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>em(s)}],children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>em(s)}],children:(0,t.jsx)(eD.Z,{onChange:()=>P(!0)})}),(0,t.jsx)(A.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>ed(s)}],children:(0,t.jsx)(eD.Z,{})}),(0,t.jsx)(A.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{children:[(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"http",children:"HTTP"})]})}),(0,t.jsx)(A.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),q&&(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),U&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(eD.Z,{type:"password",placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(v.Z,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the authorization endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the token endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the dynamic client registration endpoint.",children:(0,t.jsx)(M.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,t.jsx)(eD.Z,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(n.Z,{variant:"secondary",onClick:F,disabled:"authorizing"===H||"exchanging"===H,children:"authorizing"===H?"Waiting for authorization...":"exchanging"===H?"Exchanging authorization code...":"Authorize & Fetch Token"}),K&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:K}),"success"===H&&(null==J?void 0:J.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=J.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(en,{availableAccessGroups:x,mcpServer:r,searchValue:Z,setSearchValue:C,getAccessGroupOptions:()=>{let e=x.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return Z&&!x.some(e=>e.toLowerCase().includes(Z.toLowerCase()))&&e.push({value:Z,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:Z}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(X,{accessToken:l,oauthAccessToken:R,formValues:{server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info},allowedTools:O,existingAllowedTools:r.allowed_tools||null,onAllowedToolsChange:T})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(D.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(n.Z,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(d.Z,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(B,{value:g,onChange:j,tools:y,disabled:N}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(D.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(n.Z,{onClick:()=>h.submit(),children:"Save Changes"})]})]})})]})]})},e$=r(92280),eQ=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e$.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(e$.x,{className:"font-medium",children:s}),(0,t.jsxs)(e$.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(e$.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(e$.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(e$.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(e$.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})};let eX=e=>{var s,r,l,a,h;let{mcpServer:p,onBack:g,isEditing:j,isProxyAdmin:v,accessToken:y,userRole:b,userID:N,availableAccessGroups:_}=e,[w,Z]=(0,f.useState)(j),[C,S]=(0,f.useState)(!1),[k,A]=(0,f.useState)({}),[P,M]=(0,f.useState)(0),{maskedUrl:O,hasToken:I}=ec(p.url),T=(e,s)=>I?s?e:O:e,z=async(e,s)=>{await (0,eM.vQ)(e)&&(A(e=>({...e,[s]:!0})),setTimeout(()=>{A(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Z,{icon:eV.Z,variant:"light",className:"mb-4",onClick:g,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(x.Z,{children:p.server_name}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-server_name"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),p.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:p.alias}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-alias"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(u.Z,{className:"text-gray-500 font-mono",children:p.server_id}),(0,t.jsx)(D.ZP,{type:"text",size:"small",icon:k["mcp-server-id"]?(0,t.jsx)(e_.Z,{size:12}):(0,t.jsx)(ew.Z,{size:12}),onClick:()=>z(p.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(k["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(o.Z,{index:P,onIndexChange:M,children:[(0,t.jsx)(c.Z,{className:"mb-4",children:[(0,t.jsx)(i.Z,{children:"Overview"},"overview"),(0,t.jsx)(i.Z,{children:"MCP Tools"},"tools"),...v?[(0,t.jsx)(i.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(eH.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(x.Z,{children:L(null!==(a=p.transport)&&void 0!==a?a:void 0)})})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(u.Z,{children:E(null!==(h=p.auth_type)&&void 0!==h?h:void 0)})})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(u.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(u.Z,{className:"break-all overflow-wrap-anywhere",children:T(p.url,C)}),I&&(0,t.jsx)("button",{onClick:()=>S(!C),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eK.Z,{icon:C?eF.Z:eB.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(F.Z,{className:"mt-2",children:[(0,t.jsx)(x.Z,{children:"Cost Configuration"}),(0,t.jsx)(eQ,{costConfig:null===(s=p.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(ss,{serverId:p.server_id,accessToken:y,auth_type:p.auth_type,userRole:b,userID:N,serverAlias:p.alias})}),(0,t.jsx)(d.Z,{children:(0,t.jsxs)(F.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(x.Z,{children:"MCP Server Settings"}),w?null:(0,t.jsx)(n.Z,{variant:"light",onClick:()=>Z(!0),children:"Edit Settings"})]}),w?(0,t.jsx)(eW,{mcpServer:p,accessToken:y,onCancel:()=>Z(!1),onSuccess:e=>{Z(!1),g()},availableAccessGroups:_}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:p.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:p.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:p.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[T(p.url,C),I&&(0,t.jsx)("button",{onClick:()=>S(!C),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eK.Z,{icon:C?eF.Z:eB.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:L(p.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=p.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:E(p.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Allow All LiteLLM Keys"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[p.allow_all_keys?(0,t.jsx)("span",{className:"px-2 py-1 bg-green-50 text-green-700 rounded-md text-sm",children:"Enabled"}):(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 rounded-md text-sm",children:"Disabled"}),p.allow_all_keys&&(0,t.jsx)(u.Z,{className:"text-xs text-gray-500",children:"All keys can access this MCP server"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:p.mcp_access_groups&&p.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:p.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(u.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:p.allowed_tools&&p.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:p.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(u.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(eQ,{costConfig:null===(l=p.mcp_info)||void 0===l?void 0:l.mcp_server_cost_info})]})]})]})})]})]})]})},{Text:e0,Title:e2}=h.default,{Option:e1}=p.default;var e4=e=>{let{accessToken:s,userRole:r,userID:h}=e,{data:b,isLoading:N,refetch:w}=(0,y.F)(),{data:Z,isLoading:A}=C((0,f.useMemo)(()=>null==b?void 0:b.map(e=>e.server_id),[b])),P=(0,f.useMemo)(()=>{if(!b)return[];if(!Z)return b;let e=new Map(Z.map(e=>[e.server_id,e.status]));return b.map(s=>{let r=e.get(s.server_id);return{...s,status:r||s.status}})},[b,Z]);f.useEffect(()=>{b&&(console.log("MCP Servers fetched:",b),b.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[b]);let[M,O]=(0,f.useState)(null),[I,T]=(0,f.useState)(!1),[L,E]=(0,f.useState)(null),[z,q]=(0,f.useState)(!1),[U,R]=(0,f.useState)("all"),[V,F]=(0,f.useState)("all"),[B,H]=(0,f.useState)([]),[K,D]=(0,f.useState)(!1),[J,G]=(0,f.useState)(!1),Y="Internal User"===r;(0,f.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);(null==s?void 0:s.serverId)&&(E(s.serverId),q(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let W=f.useMemo(()=>{if(!P)return[];let e=new Set,s=[];return P.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[P]),$=f.useMemo(()=>P?Array.from(new Set(P.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[P]),Q=(0,f.useCallback)((e,s)=>{if(!P)return H([]);let r=P;if("personal"===e){H([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),H(r)},[P]);(0,f.useEffect)(()=>{Q(U,V)},[P,U,V,Q]);let X=f.useMemo(()=>eR(null!=r?r:"",e=>{E(e),q(!1)},e=>{E(e),q(!0)},ee,A),[r,A]);function ee(e){O(e),T(!0)}let es=async()=>{if(null!=M&&null!=s)try{G(!0),await (0,_.deleteMCPServer)(s,M),S.Z.success("Deleted MCP Server successfully"),w()}catch(e){console.error("Error deleting the mcp server:",e)}finally{G(!1),T(!1),O(null)}},er=M?(b||[]).find(e=>e.server_id===M):null,et=f.useMemo(()=>B.find(e=>e.server_id===L)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},[B,L]),el=f.useCallback(()=>{q(!1),E(null),w()},[w]);return s&&r&&h?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(g.Z,{open:I,title:"Delete MCP Server?",onOk:es,okText:J?"Deleting...":"Delete",onCancel:()=>{T(!1),O(null)},cancelText:"Cancel",cancelButtonProps:{disabled:J},okButtonProps:{danger:!0},confirmLoading:J,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e0,{children:"Are you sure you want to delete this MCP Server? This action cannot be undone."}),er&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(e2,{level:5,className:"mb-3 text-gray-900",children:"Server Information"}),(0,t.jsxs)(j.Z,{column:1,size:"small",children:[er.server_name&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server Name"}),children:(0,t.jsx)(e0,{className:"text-sm",children:er.server_name})}),er.alias&&(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Alias"}),children:(0,t.jsx)(e0,{className:"text-sm",children:er.alias})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server ID"}),children:(0,t.jsx)(e0,{code:!0,className:"text-sm",children:er.server_id})}),(0,t.jsx)(j.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"URL"}),children:(0,t.jsx)(e0,{code:!0,className:"text-sm",children:er.url})})]})]})]})}),(0,t.jsx)(ey,{userRole:r,accessToken:s,onCreateSuccess:e=>{H(s=>[...s,e]),D(!1)},isModalVisible:K,setModalVisible:D,availableAccessGroups:$}),(0,t.jsx)(x.Z,{children:"MCP Servers"}),(0,t.jsx)(u.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,l.tY)(r)&&(0,t.jsx)(n.Z,{className:"mt-4 mb-4",onClick:()=>D(!0),children:"+ Add New MCP Server"}),(0,t.jsxs)(o.Z,{className:"w-full h-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(i.Z,{children:"All Servers"}),(0,t.jsx)(i.Z,{children:"Connect"})]})}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:L?(0,t.jsx)(eX,{mcpServer:et,onBack:el,isProxyAdmin:(0,l.tY)(r),isEditing:z,accessToken:s,userID:h,userRole:r,availableAccessGroups:$},L):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(u.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(p.default,{value:U,onChange:e=>{R(e),Q(e,V)},style:{width:300},children:[(0,t.jsx)(e1,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:Y?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(e1,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),W.map(e=>(0,t.jsx)(e1,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(u.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(v.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,t.jsx)(a.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(p.default,{value:V,onChange:e=>{F(e),Q(U,e)},style:{width:300},children:[(0,t.jsx)(e1,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),$.map(e=>(0,t.jsx)(e1,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(k.w,{data:B,columns:X,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:N,noDataMessage:"No MCP servers configured",loadingMessage:"\uD83D\uDE85 Loading MCP servers..."})})]})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(eE,{})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:h}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))},e5=r(21770);let e6=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function e3(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>e7(e)).filter(e=>void 0!==e);let s=e7(e);return void 0===s?[]:[s]}function e7(e,s){if(!e)return;let r=void 0!==s?s:e.default;if("object"===e.type){let s=e6(r)?{...r}:{};return e.properties&&Object.entries(e.properties).forEach(e=>{let[r,t]=e;s[r]=e7(t,s[r])}),s}if("array"===e.type){if(Array.isArray(r)){let s=e.items;if(!s)return r;if(0===r.length){let e=e3(s);return e.length?e:r}return Array.isArray(s)?r.map((e,r)=>{var t;return e7(null!==(t=s[r])&&void 0!==t?t:s[s.length-1],e)}):r.map(e=>e7(s,e))}return void 0!==r?r:e3(e.items)}if(void 0!==r)return r;switch(e.type){case"integer":case"number":return 0;case"boolean":return!1;default:return""}}let e8=e=>{let s=e7(e);if("object"===e.type||"array"===e.type){let r="array"===e.type?[]:{};return JSON.stringify(null!=s?s:r,null,2)}return s};function e9(e){let{tool:s,onSubmit:r,isLoading:l,result:a,error:n,onClose:i}=e,[o]=A.Z.useForm(),[c,d]=f.useState("formatted"),[m,u]=f.useState(null),[x,h]=f.useState(null),p=f.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),g=f.useMemo(()=>p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{type:"object",properties:p.properties.params.properties,required:p.properties.params.required||[]}:p,[p]);f.useEffect(()=>{if(o.resetFields(),!g.properties)return;let e={};Object.entries(g.properties).forEach(s=>{let[r,t]=s;e[r]=e8(t)}),o.setFieldsValue(e)},[o,g,s]),f.useEffect(()=>{m&&(a||n)&&h(Date.now()-m)},[a,n,m]);let j=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},y=async()=>{await j(JSON.stringify(a,null,2))?S.Z.success("Result copied to clipboard"):S.Z.fromBackend("Failed to copy result")},b=async()=>{await j(s.name)?S.Z.success("Tool name copied to clipboard"):S.Z.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:b,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(O.z,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(v.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(M.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(A.Z,{form:o,onFinish:e=>{u(Date.now()),h(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=g.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":case"integer":{let e=Number(l);s[t]=Number.isNaN(e)?l:"integer"===a.type?Math.trunc(e):e;break}case"object":case"array":try{let e="string"==typeof l?JSON.parse(l):l,r="object"===a.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),n="array"===a.type&&Array.isArray(e);"object"===a.type&&r||"array"===a.type&&n?s[t]=e:s[t]=l}catch(e){s[t]=l}break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),r(p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(O.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===g.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(g.properties).map(e=>{var r,l,a,n;let[i,o]=e,c=e8(o),d="".concat(s.name,"-").concat(i);return(0,t.jsxs)(A.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(r=g.required)||void 0===r?void 0:r.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),o.description&&(0,t.jsx)(v.Z,{title:o.description,children:(0,t.jsx)(M.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,initialValue:c,rules:[{required:null===(l=g.required)||void 0===l?void 0:l.includes(i),message:"Please enter ".concat(i)},..."object"===o.type||"array"===o.type?[{validator:(e,s)=>{var r;if((null==s||""===s)&&!(null===(r=g.required)||void 0===r?void 0:r.includes(i)))return Promise.resolve();try{let e="string"==typeof s?JSON.parse(s):s,r="object"===o.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),t="array"===o.type&&Array.isArray(e);if("object"===o.type&&r||"array"===o.type&&t)return Promise.resolve();return Promise.reject(Error("object"===o.type?"Please enter a JSON object":"Please enter a JSON array"))}catch(e){return Promise.reject(Error("Invalid JSON"))}}}]:[]],className:"mb-3",children:["string"===o.type&&o.enum&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:null!=c?c:"",children:[!(null===(a=g.required)||void 0===a?void 0:a.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),o.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===o.type&&!o.enum&&(0,t.jsx)(O.o,{placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:"",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),("number"===o.type||"integer"===o.type)&&(0,t.jsx)("input",{type:"number",step:"integer"===o.type?1:"any",placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:0,className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===o.type&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null!=c&&c).toString(),children:[!(null===(n=g.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]}),("object"===o.type||"array"===o.type)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("textarea",{rows:"object"===o.type?6:4,placeholder:o.description||("object"===o.type?"Enter JSON object for ".concat(i):"Enter JSON array for ".concat(i)),defaultValue:null!=c?c:"object"===o.type?"{}":"[]",spellCheck:!1,"data-testid":"textarea-".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm font-mono"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"object"===o.type?"Provide a valid JSON object.":"Provide a valid JSON array."})]})]},d)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(O.z,{onClick:()=>o.submit(),disabled:l,variant:"primary",className:"w-full",loading:l,children:l?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:a||n||l?(0,t.jsxs)("div",{className:"space-y-3",children:[a&&!l&&!n&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>d("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>d("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:y,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[l&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!l&&!n&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,t.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var se=r(69993),ss=e=>{let{serverId:s,accessToken:r,auth_type:l,userRole:a,userID:n,serverAlias:i}=e,[o,c]=(0,f.useState)(null),[d,m]=(0,f.useState)(null),[h,p]=(0,f.useState)(null),{data:g,isLoading:j,error:v}=(0,b.a)({queryKey:["mcpTools",s],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,_.listMCPTools)(r,s)},enabled:!!r,staleTime:3e4}),{mutate:y,isPending:N}=(0,e5.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,_.callMCPTool)(r,s,e.tool.name,e.arguments)}catch(e){throw e}},onSuccess:e=>{m(e.content),p(null)},onError:e=>{p(e),m(null)}}),w=(null==g?void 0:g.tools)||[];return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(F.Z,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(x.Z,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(u.Z,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(V.Z,{className:"mr-2"})," Available Tools",w.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:w.length})]}),j&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==g?void 0:g.error)&&!j&&!w.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",g.message]})}),!j&&!(null==g?void 0:g.error)&&(!w||0===w.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!j&&!(null==g?void 0:g.error)&&w.length>0&&(0,t.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:w.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==o?void 0:o.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{c(e),m(null),p(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==o?void 0:o.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(x.Z,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(e9,{tool:o,onSubmit:e=>{y({tool:o,arguments:e})},result:d,error:h,isLoading:N,onClose:()=>c(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(se.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(u.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(u.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/665-6f3d12bbec1f88a4.js b/litellm/proxy/_experimental/out/_next/static/chunks/665-83a99a77afeb7734.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/665-6f3d12bbec1f88a4.js rename to litellm/proxy/_experimental/out/_next/static/chunks/665-83a99a77afeb7734.js index 13e7560e68..bc3eb86e6f 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/665-6f3d12bbec1f88a4.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/665-83a99a77afeb7734.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[665],{84717:function(e,s,a){a.d(s,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var t=a(41649),l=a(78489),r=a(12514),i=a(67101),n=a(12485),d=a(18135),o=a(35242),c=a(29706),m=a(77991),u=a(84264),x=a(96761)},40728:function(e,s,a){a.d(s,{C:function(){return t.Z},x:function(){return l.Z}});var t=a(41649),l=a(84264)},64504:function(e,s,a){a.d(s,{o:function(){return l.Z},z:function(){return t.Z}});var t=a(78489),l=a(49566)},49282:function(e,s,a){var t=a(2265),l=a(39760),r=a(39623);s.Z=()=>{let[e,s]=(0,t.useState)([]),{accessToken:a,userId:i,userRole:n}=(0,l.Z)();return(0,t.useEffect)(()=>{(async()=>{s(await (0,r.Z)(a,i,n,null))})()},[a,i,n]),{teams:e,setTeams:s}}},39623:function(e,s,a){a.d(s,{Z:function(){return l}});var t=a(19250);let l=async(e,s,a,l)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,(null==l?void 0:l.organization_id)||null,s):await (0,t.teamListCall)(e,(null==l?void 0:l.organization_id)||null)},21609:function(e,s,a){a.d(s,{Z:function(){return c}});var t=a(57437),l=a(57840),r=a(22116),i=a(51653),n=a(76188),d=a(4260),o=a(2265);function c(e){let{isOpen:s,title:a,alertMessage:c,message:m,resourceInformationTitle:u,resourceInformation:x,onCancel:g,onOk:h,confirmLoading:p,requiredConfirmation:v}=e,{Title:j,Text:y}=l.default,[b,_]=(0,o.useState)("");return(0,o.useEffect)(()=>{s&&_("")},[s]),(0,t.jsx)(r.Z,{title:a,open:s,onOk:h,onCancel:g,confirmLoading:p,okText:p?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!v&&b!==v||p},cancelButtonProps:{disabled:p},children:(0,t.jsxs)("div",{className:"space-y-4",children:[c&&(0,t.jsx)(i.Z,{message:c,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(j,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:x&&x.map(e=>{let{label:s,value:a,...l}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:s}),children:(0,t.jsx)(y,{...l,children:null!=a?a:"-"})},s)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(y,{children:m})}),v&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(y,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(y,{children:"Type "}),(0,t.jsx)(y,{strong:!0,type:"danger",children:v}),(0,t.jsx)(y,{children:" to confirm deletion:"})]}),(0,t.jsx)(d.default,{value:b,onChange:e=>_(e.target.value),placeholder:v,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},67479:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:a,loading:u,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,a){var t=a(57437);a(2265);var l=a(40728),r=a(82182),i=a(91777),n=a(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:a=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[a,t]=s;return t===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var a;let i=c(e.callback_name),d=null===(a=n.Dg[i])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,t.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(l.C,{color:"red",size:"xs",children:a.length})]}),a.length>0?(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,s)=>{var a;let r=n.RD[e]||e,d=null===(a=n.Dg[r])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,t.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,t.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},60131:function(e,s,a){a.d(s,{Z:function(){return v}});var t=a(57437),l=a(2265),r=a(92280),i=a(40728),n=a(79814),d=a(19250),o=function(e){let{vectorStores:s,accessToken:a}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(a&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(a);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[a,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=a(25327),m=a(86462),u=a(47686),x=a(99981),g=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[g,h]=(0,l.useState)([]),[p,v]=(0,l.useState)([]),[j,y]=(0,l.useState)(new Set),b=e=>{y(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?h(e):e.data&&Array.isArray(e.data)&&h(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(a.bind(a,19250)).then(e=>e.fetchMCPAccessGroups(o));v(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=g.find(s=>s.server_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(a,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],w=N.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:w})]}),w>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,r=j.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>l&&b(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),r?(0,t.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,s)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},h=a(3497),p=function(e){let{agents:s,agentAccessGroups:a=[],accessToken:r}=e,[n,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(r&&s.length>0)try{let e=await (0,d.getAgentsList)(r);e&&e.agents&&Array.isArray(e.agents)&&o(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[r,s.length]);let c=e=>{let s=n.find(s=>s.agent_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.agent_name," (").concat(a,")")}return e},m=[...s.map(e=>({type:"agent",value:e})),...a.map(e=>({type:"accessGroup",value:e}))],u=m.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(i.C,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:m.map((e,s)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:c(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})},v=function(e){let{objectPermission:s,variant:a="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(null==s?void 0:s.agents)||[],x=(null==s?void 0:s.agent_access_groups)||[],h=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:n,accessToken:i}),(0,t.jsx)(g,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i}),(0,t.jsx)(p,{agents:u,agentAccessGroups:x,accessToken:i})]});return"card"===a?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),h]}):(0,t.jsxs)("div",{className:"".concat(l),children:[(0,t.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),h]})}},87972:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getPoliciesList)(d);console.log("Policies response:",e),e.policies&&(console.log("Policies data:",e.policies),m(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting policies is a premium feature.":"Select policies",onChange:e=>{console.log("Selected policies:",e),s(e)},value:a,loading:u,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping policy:",e),{label:"".concat(e.policy_name).concat(e.description?" - ".concat(e.description):""),value:e.policy_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},21425:function(e,s,a){var t=a(57437);a(2265);var l=a(54507);s.Z=e=>{let{value:s,onChange:a,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,t.jsx)(l.Z,{value:s,onChange:a,disabledCallbacks:r,onDisabledCallbacksChange:i})}},50665:function(e,s,a){a.d(s,{Z:function(){return ec}});var t=a(57437),l=a(49282),r=a(59872),i=a(33304),n=a(77331),d=a(23628),o=a(74998),c=a(84717),m=a(10032),u=a(5545),x=a(99981),g=a(30401),h=a(78867),p=a(2265),v=a(20347),j=a(97434),y=a(40728),b=a(58710),_=e=>{let{autoRotate:s=!1,rotationInterval:a,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:n="card",className:o=""}=e,c=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)},m=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(y.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(y.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.x,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(y.x,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(s||l||r||i)&&(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(y.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(y.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(y.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(d.Z,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(y.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===n?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(y.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(y.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})},f=a(21609);let N=["logging"],w=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!N.includes(s)})):{},k=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],Z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(w(e),null,s)},S=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...a}=e;return a};var C=a(27799),A=a(9114),I=a(19250),P=a(60131),L=a(39760),D=a(78489),M=a(49804),T=a(67101),E=a(84264),R=a(49566),F=a(96761),V=a(22116),O=a(19015),z=a(92668),K=a(29233);function G(e){let{selectedToken:s,visible:a,onClose:l,onKeyUpdate:r}=e,{accessToken:i}=(0,L.Z)(),[n]=m.Z.useForm(),[d,o]=(0,p.useState)(null),[c,u]=(0,p.useState)(null),[x,g]=(0,p.useState)(null),[h,v]=(0,p.useState)(!1),[j,y]=(0,p.useState)(!1),[b,_]=(0,p.useState)(null);(0,p.useEffect)(()=>{a&&s&&i&&(n.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),_(i),y(s.key_name===i))},[a,s,n,i]),(0,p.useEffect)(()=>{a||(o(null),v(!1),y(!1),_(null),n.resetFields())},[a,n]);let f=e=>{if(!e)return null;try{let s;let a=new Date;if(e.endsWith("s"))s=(0,z.I)(a,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,z.I)(a,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,z.I)(a,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,p.useEffect)(()=>{(null==c?void 0:c.duration)?g(f(c.duration)):g(null)},[null==c?void 0:c.duration]);let N=async()=>{if(s&&b){v(!0);try{let e=await n.validateFields(),a=await (0,I.regenerateKeyCall)(b,s.token||s.token_id,e);o(a.key),A.Z.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let t={token:a.token||a.key_id||s.token,key_name:a.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?f(e.duration):s.expires,...a};console.log("Updated key data with new token:",t),r&&r(t),v(!1)}catch(e){console.error("Error regenerating key:",e),A.Z.fromBackend(e),v(!1)}}},w=()=>{o(null),v(!1),y(!1),_(null),n.resetFields(),l()};return(0,t.jsx)(V.Z,{title:"Regenerate Virtual Key",open:a,onCancel:w,footer:d?[(0,t.jsx)(D.Z,{onClick:w,children:"Close"},"close")]:[(0,t.jsx)(D.Z,{onClick:w,className:"mr-2",children:"Cancel"},"cancel"),(0,t.jsx)(D.Z,{onClick:N,disabled:h,children:h?"Regenerating...":"Regenerate"},"regenerate")],children:d?(0,t.jsxs)(T.Z,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(F.Z,{children:"Regenerated Key"}),(0,t.jsx)(M.Z,{numColSpan:1,children:(0,t.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,t.jsxs)(M.Z,{numColSpan:1,children:[(0,t.jsx)(E.Z,{className:"mt-3",children:"Key Alias:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,t.jsx)(E.Z,{className:"mt-3",children:"New Virtual Key:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:d})}),(0,t.jsx)(K.CopyToClipboard,{text:d,onCopy:()=>A.Z.success("Virtual Key copied to clipboard"),children:(0,t.jsx)(D.Z,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,t.jsxs)(m.Z,{form:n,layout:"vertical",onValuesChange:e=>{"duration"in e&&u(s=>({...s,duration:e.duration}))},children:[(0,t.jsx)(m.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,t.jsx)(R.Z,{disabled:!0})}),(0,t.jsx)(m.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(O.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,t.jsx)(O.Z,{style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,t.jsx)(O.Z,{style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,t.jsx)(R.Z,{placeholder:""})}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),x&&(0,t.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",x]})]})})}var U=a(85968),B=a(67479),q=a(87972),W=a(15424),J=a(64504),$=a(37592),Q=a(4260),Y=a(63709),H=a(82586),X=a(62099),ee=a(95096),es=a(65895),ea=a(97492),et=a(68473),el=a(71098),er=a(24199),ei=a(21425),en=a(97415);let ed=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function eo(e){var s,a,l,r,i,n,d,o,c,u,g,h,v,y;let{keyData:b,onCancel:_,onSubmit:f,teams:N,accessToken:w,userID:C,userRole:P,premiumUser:L=!1}=e,[D]=m.Z.useForm(),[M,T]=(0,p.useState)([]),[E,R]=(0,p.useState)({}),F=null==N?void 0:N.find(e=>e.team_id===b.team_id),[V,O]=(0,p.useState)([]),[z,K]=(0,p.useState)(Array.isArray(null===(s=b.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[]),[G,U]=(0,p.useState)(b.auto_rotate||!1),[eo,ec]=(0,p.useState)(b.rotation_interval||""),[em,eu]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=async()=>{if(C&&P&&w)try{if(null===b.team_id){let e=(await (0,I.modelAvailableCall)(w,C,P)).data.map(e=>e.id);O(e)}else if(null==F?void 0:F.team_id){let e=await (0,el.wk)(C,P,w,F.team_id);O(Array.from(new Set([...F.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(w)try{let e=await (0,I.getPromptsList)(w);T(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[C,P,w,F,b.team_id]),(0,p.useEffect)(()=>{D.setFieldValue("disabled_callbacks",z)},[D,z]);let ex=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,eg={...b,token:b.token||b.token_id,budget_duration:ex(b.budget_duration),metadata:Z(S(b.metadata)),guardrails:null===(a=b.metadata)||void 0===a?void 0:a.guardrails,disable_global_guardrails:(null===(l=b.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=b.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=b.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=b.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=b.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=b.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(c=b.object_permission)||void 0===c?void 0:c.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(u=b.object_permission)||void 0===u?void 0:u.agents)||[],accessGroups:(null===(g=b.object_permission)||void 0===g?void 0:g.agent_access_groups)||[]},logging_settings:k(b.metadata),disabled_callbacks:Array.isArray(null===(h=b.metadata)||void 0===h?void 0:h.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[],auto_rotate:b.auto_rotate||!1,...b.rotation_interval&&{rotation_interval:b.rotation_interval},allowed_routes:b.allowed_routes};(0,p.useEffect)(()=>{var e,s,a,t,l,r,i,n,d;D.setFieldsValue({...b,token:b.token||b.token_id,budget_duration:ex(b.budget_duration),metadata:Z(S(b.metadata)),guardrails:null===(e=b.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=b.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(a=b.metadata)||void 0===a?void 0:a.prompts,tags:null===(t=b.metadata)||void 0===t?void 0:t.tags,vector_stores:(null===(l=b.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=b.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=b.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=b.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:k(b.metadata),disabled_callbacks:Array.isArray(null===(d=b.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[],auto_rotate:b.auto_rotate||!1,...b.rotation_interval&&{rotation_interval:b.rotation_interval},allowed_routes:b.allowed_routes})},[b,D]),(0,p.useEffect)(()=>{D.setFieldValue("auto_rotate",G)},[G,D]),(0,p.useEffect)(()=>{eo&&D.setFieldValue("rotation_interval",eo)},[eo,D]),(0,p.useEffect)(()=>{(async()=>{if(w)try{let e=await (0,I.tagListCall)(w);R(e)}catch(e){A.Z.fromBackend("Error fetching tags: "+e)}})()},[w]),console.log("premiumUser:",L);let eh=async e=>{try{eu(!0),await f(e)}finally{eu(!1)}};return(0,t.jsxs)(m.Z,{form:D,onFinish:eh,initialValues:eg,layout:"vertical",children:[(0,t.jsx)(m.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(J.o,{})}),(0,t.jsx)(m.Z.Item,{label:"Models",name:"models",children:(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)($.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[V.length>0&&(0,t.jsx)($.default.Option,{value:"all-team-models",children:"All Team Models"}),V.map(e=>(0,t.jsx)($.default.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(m.Z.Item,{label:"Key Type",children:(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=ed(s("allowed_routes"));return(0,t.jsxs)($.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":a("allowed_routes",[]);break;case"llm_api":a("allowed_routes",["llm_api_routes"]);break;case"management":a("allowed_routes",["management_routes"]),a("models",[])}},children:[(0,t.jsx)($.default.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,t.jsx)($.default.Option,{value:"llm_api",label:"LLM API",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)($.default.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(m.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(er.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(m.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)($.default,{placeholder:"n/a",children:[(0,t.jsx)($.default.Option,{value:"daily",children:"Daily"}),(0,t.jsx)($.default.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)($.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(m.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(es.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(m.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(es.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(m.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(m.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(Q.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(m.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(Q.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(m.Z.Item,{label:"Guardrails",name:"guardrails",children:w&&(0,t.jsx)(B.Z,{onChange:e=>{D.setFieldValue("guardrails",e)},accessToken:w,disabled:!L})}),(0,t.jsx)(m.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(x.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(W.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(Y.Z,{disabled:!L,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(m.Z.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(x.Z,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)(W.Z,{style:{marginLeft:"4px"}})})]}),name:"policies",children:w&&(0,t.jsx)(q.Z,{onChange:e=>{D.setFieldValue("policies",e)},accessToken:w,disabled:!L})}),(0,t.jsx)(m.Z.Item,{label:"Tags",name:"tags",children:(0,t.jsx)($.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(E).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(m.Z.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(x.Z,{title:L?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)($.default,{mode:"tags",style:{width:"100%"},disabled:!L,placeholder:L?Array.isArray(null===(v=b.metadata)||void 0===v?void 0:v.prompts)&&b.metadata.prompts.length>0?"Current: ".concat(b.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:M.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(m.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(x.Z,{title:L?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(ee.Z,{onChange:e=>D.setFieldValue("allowed_passthrough_routes",e),value:D.getFieldValue("allowed_passthrough_routes"),accessToken:w||"",placeholder:L?Array.isArray(null===(y=b.metadata)||void 0===y?void 0:y.allowed_passthrough_routes)&&b.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(b.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!L})})}),(0,t.jsx)(m.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(en.Z,{onChange:e=>D.setFieldValue("vector_stores",e),value:D.getFieldValue("vector_stores"),accessToken:w||"",placeholder:"Select vector stores"})}),(0,t.jsx)(m.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(ea.Z,{onChange:e=>D.setFieldValue("mcp_servers_and_groups",e),value:D.getFieldValue("mcp_servers_and_groups"),accessToken:w||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(m.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(Q.default,{type:"hidden"})}),(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(et.Z,{accessToken:w||"",selectedServers:(null===(e=D.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:D.getFieldValue("mcp_tool_permissions")||{},onChange:e=>D.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(m.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(H.Z,{onChange:e=>D.setFieldValue("agents_and_groups",e),value:D.getFieldValue("agents_and_groups"),accessToken:w||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(m.Z.Item,{label:"Team ID",name:"team_id",children:(0,t.jsx)($.default,{placeholder:"Select team",showSearch:!0,style:{width:"100%"},filterOption:(e,s)=>{var a,t;let l=null==N?void 0:N.find(e=>e.team_id===(null==s?void 0:s.value));return!!l&&null!==(t=null===(a=l.team_alias)||void 0===a?void 0:a.toLowerCase().includes(e.toLowerCase()))&&void 0!==t&&t},children:null==N?void 0:N.map(e=>(0,t.jsx)($.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,t.jsx)(m.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(ei.Z,{value:D.getFieldValue("logging_settings"),onChange:e=>D.setFieldValue("logging_settings",e),disabledCallbacks:z,onDisabledCallbacksChange:e=>{K((0,j.PA)(e)),D.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(m.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(Q.default.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(X.Z,{form:D,autoRotationEnabled:G,onAutoRotationChange:U,rotationInterval:eo,onRotationIntervalChange:ec}),(0,t.jsx)(m.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(Q.default,{})})]}),(0,t.jsx)(m.Z.Item,{name:"token",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(J.z,{variant:"secondary",onClick:_,disabled:em,children:"Cancel"}),(0,t.jsx)(J.z,{type:"submit",loading:em,children:"Save Changes"})]})})]})}function ec(e){var s,a,y,b,N,w,D,M,T,E,R,F,V;let{onClose:O,keyData:z,teams:K,onKeyDataUpdate:B,onDelete:q,backButtonText:W="Back to Keys"}=e,{accessToken:J,userId:$,userRole:Q,premiumUser:Y}=(0,L.Z)(),{teams:H}=(0,l.Z)(),[X,ee]=(0,p.useState)(!1),[es]=m.Z.useForm(),[ea,et]=(0,p.useState)(!1),[el,er]=(0,p.useState)(!1),[ei,en]=(0,p.useState)(""),[ed,ec]=(0,p.useState)(!1),[em,eu]=(0,p.useState)({}),[ex,eg]=(0,p.useState)(z),[eh,ep]=(0,p.useState)(null),[ev,ej]=(0,p.useState)(!1),[ey,eb]=(0,p.useState)({}),[e_,ef]=(0,p.useState)(!1);if((0,p.useEffect)(()=>{z&&eg(z)},[z]),(0,p.useEffect)(()=>{(async()=>{var e;let s=null==ex?void 0:null===(e=ex.metadata)||void 0===e?void 0:e.policies;if(!J||!s||!Array.isArray(s)||0===s.length)return;ef(!0);let a={};try{await Promise.all(s.map(async e=>{try{let s=await (0,I.getPolicyInfoWithGuardrails)(J,e);a[e]=s.resolved_guardrails||[]}catch(s){console.error("Failed to fetch guardrails for policy ".concat(e,":"),s),a[e]=[]}})),eb(a)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{ef(!1)}})()},[J,null==ex?void 0:null===(s=ex.metadata)||void 0===s?void 0:s.policies]),(0,p.useEffect)(()=>{if(ev){let e=setTimeout(()=>{ej(!1)},5e3);return()=>clearTimeout(e)}},[ev]),!ex)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(c.zx,{icon:n.Z,variant:"light",onClick:O,className:"mb-4",children:W}),(0,t.jsx)(c.xv,{children:"Key not found"})]});let eN=async e=>{try{var s,a,t,l;if(!J)return;let r=e.token;if(e.key=r,Y||(delete e.guardrails,delete e.prompts),e.max_budget=(0,i.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...ex.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...ex.object_permission,mcp_servers:s||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:s,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:s||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,i.C)(e.max_budget),e.tpm_limit=(0,i.C)(e.tpm_limit),e.rpm_limit=(0,i.C)(e.rpm_limit),e.max_parallel_requests=(0,i.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(a=e.disabled_callbacks)||void 0===a?void 0:a.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),A.Z.error("Invalid metadata JSON");return}else{let{tags:s,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(t=e.guardrails)||void 0===t?void 0:t.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,I.keyUpdateCall)(J,e);eg(e=>e?{...e,...n}:void 0),B&&B(n),A.Z.success("Key updated successfully"),ee(!1)}catch(e){A.Z.fromBackend((0,U.O)(e)),console.error("Error updating key:",e)}},ew=async()=>{try{if(er(!0),!J)return;await (0,I.keyDeleteCall)(J,ex.token||ex.token_id),A.Z.success("Key deleted successfully"),q&&q(),O()}catch(e){console.error("Error deleting the key:",e),A.Z.fromBackend(e)}finally{er(!1),et(!1),en("")}},ek=async(e,s)=>{await (0,r.vQ)(e)&&(eu(e=>({...e,[s]:!0})),setTimeout(()=>{eu(e=>({...e,[s]:!1}))},2e3))},eZ=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)};console.log("userRole",Q);let eS=(0,v.P4)(Q||"")||H&&(0,v._p)(null==H?void 0:null===(a=H.filter(e=>e.team_id===ex.team_id)[0])||void 0===a?void 0:a.members_with_roles,$||"")||$===ex.user_id&&"Internal Viewer"!==Q;return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.zx,{icon:n.Z,variant:"light",onClick:O,className:"mb-4",children:W}),(0,t.jsx)(c.Dx,{children:ex.key_alias||"Virtual Key"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,t.jsx)(c.xv,{className:"text-gray-500 font-mono text-sm",children:ex.token_id||ex.token})]}),(0,t.jsx)(u.ZP,{type:"text",size:"small",icon:em["key-id"]?(0,t.jsx)(g.Z,{size:12}):(0,t.jsx)(h.Z,{size:12}),onClick:()=>ek(ex.token_id||ex.token,"key-id"),className:"ml-2 transition-all duration-200".concat(em["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)(c.xv,{className:"text-sm text-gray-500",children:ex.updated_at&&ex.updated_at!==ex.created_at?"Updated: ".concat(eZ(ex.updated_at)):"Created: ".concat(eZ(ex.created_at))}),ev&&(0,t.jsx)(c.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),eh&&(0,t.jsx)(c.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),eS&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(x.Z,{title:Y?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,t.jsx)("span",{className:"inline-block",children:(0,t.jsx)(c.zx,{icon:d.Z,variant:"secondary",onClick:()=>ec(!0),className:"flex items-center",disabled:!Y,children:"Regenerate Key"})})}),(0,t.jsx)(c.zx,{icon:o.Z,variant:"secondary",onClick:()=>et(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,t.jsx)(G,{selectedToken:ex,visible:ed,onClose:()=>ec(!1),onKeyUpdate:e=>{eg(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),ep(new Date),ej(!0),B&&B({...e,created_at:new Date().toLocaleString()})}}),(0,t.jsx)(f.Z,{isOpen:ea,title:"Delete Key",alertMessage:"This action is irreversible and will immediately revoke access for any applications using this key.",message:"Are you sure you want to delete this Virtual Key?",resourceInformationTitle:"Key Information",resourceInformation:[{label:"Key Alias",value:(null==ex?void 0:ex.key_alias)||"-"},{label:"Key ID",value:(null==ex?void 0:ex.token_id)||(null==ex?void 0:ex.token)||"-",code:!0},{label:"Team ID",value:(null==ex?void 0:ex.team_id)||"-",code:!0},{label:"Spend",value:(null==ex?void 0:ex.spend)?"$".concat((0,r.pw)(ex.spend,4)):"$0.0000"}],onCancel:()=>{et(!1),en("")},onOk:ew,confirmLoading:el,requiredConfirmation:null==ex?void 0:ex.key_alias}),(0,t.jsxs)(c.v0,{children:[(0,t.jsxs)(c.td,{className:"mb-4",children:[(0,t.jsx)(c.OK,{children:"Overview"}),(0,t.jsx)(c.OK,{children:"Settings"})]}),(0,t.jsxs)(c.nP,{children:[(0,t.jsx)(c.x4,{children:(0,t.jsxs)(c.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(c.Dx,{children:["$",(0,r.pw)(ex.spend,4)]}),(0,t.jsxs)(c.xv,{children:["of"," ",null!==ex.max_budget?"$".concat((0,r.pw)(ex.max_budget)):"Unlimited"]})]})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(c.xv,{children:["TPM: ",null!==ex.tpm_limit?ex.tpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["RPM: ",null!==ex.rpm_limit?ex.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:ex.models&&ex.models.length>0?ex.models.map((e,s)=>(0,t.jsx)(c.Ct,{color:"red",children:e},s)):(0,t.jsx)(c.xv,{children:"No models specified"})})]}),(0,t.jsx)(c.Zb,{children:(0,t.jsx)(P.Z,{objectPermission:ex.object_permission,variant:"inline",accessToken:J})}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{className:"font-medium mb-3",children:"Guardrails"}),Array.isArray(null===(y=ex.metadata)||void 0===y?void 0:y.guardrails)&&ex.metadata.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:ex.metadata.guardrails.map((e,s)=>(0,t.jsx)(c.Ct,{color:"blue",children:e},s))}):(0,t.jsx)(c.xv,{className:"text-gray-500",children:"No guardrails configured"}),"boolean"==typeof(null===(b=ex.metadata)||void 0===b?void 0:b.disable_global_guardrails)&&!0===ex.metadata.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(c.Ct,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{className:"font-medium mb-3",children:"Policies"}),Array.isArray(null===(N=ex.metadata)||void 0===N?void 0:N.policies)&&ex.metadata.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:ex.metadata.policies.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Ct,{color:"purple",children:e}),e_&&(0,t.jsx)(c.xv,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!e_&&ey[e]&&ey[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(c.xv,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:ey[e].map((e,s)=>(0,t.jsx)(c.Ct,{color:"blue",size:"xs",children:e},s))})]})]},s))}):(0,t.jsx)(c.xv,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)(C.Z,{loggingConfigs:k(ex.metadata),disabledCallbacks:Array.isArray(null===(w=ex.metadata)||void 0===w?void 0:w.litellm_disabled_callbacks)?(0,j.PA)(ex.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(_,{autoRotate:ex.auto_rotate,rotationInterval:ex.rotation_interval,lastRotationAt:ex.last_rotation_at,keyRotationAt:ex.key_rotation_at,nextRotationAt:ex.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(c.x4,{children:(0,t.jsxs)(c.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(c.Dx,{children:"Key Settings"}),!X&&Q&&v.LQ.includes(Q)&&(0,t.jsx)(c.zx,{onClick:()=>ee(!0),children:"Edit Settings"})]}),X?(0,t.jsx)(eo,{keyData:ex,onCancel:()=>ee(!1),onSubmit:eN,teams:K,accessToken:J,userID:$,userRole:Q,premiumUser:Y}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(c.xv,{className:"font-mono",children:ex.token_id||ex.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(c.xv,{children:ex.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(c.xv,{className:"font-mono",children:ex.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(c.xv,{children:ex.team_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Organization"}),(0,t.jsx)(c.xv,{children:ex.organization_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(c.xv,{children:eZ(ex.created_at)})]}),eh&&(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.xv,{children:eZ(eh)}),(0,t.jsx)(c.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Expires"}),(0,t.jsx)(c.xv,{children:ex.expires?eZ(ex.expires):"Never"})]}),(0,t.jsx)(_,{autoRotate:ex.auto_rotate,rotationInterval:ex.rotation_interval,lastRotationAt:ex.last_rotation_at,keyRotationAt:ex.key_rotation_at,nextRotationAt:ex.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(c.xv,{children:["$",(0,r.pw)(ex.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Budget"}),(0,t.jsx)(c.xv,{children:null!==ex.max_budget?"$".concat((0,r.pw)(ex.max_budget,2)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(D=ex.metadata)||void 0===D?void 0:D.tags)&&ex.metadata.tags.length>0?ex.metadata.tags.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(c.xv,{children:Array.isArray(null===(M=ex.metadata)||void 0===M?void 0:M.prompts)&&ex.metadata.prompts.length>0?ex.metadata.prompts.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(c.xv,{children:Array.isArray(null===(T=ex.metadata)||void 0===T?void 0:T.allowed_passthrough_routes)&&ex.metadata.allowed_passthrough_routes.length>0?ex.metadata.allowed_passthrough_routes.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(c.xv,{children:(null===(E=ex.metadata)||void 0===E?void 0:E.disable_global_guardrails)===!0?(0,t.jsx)(c.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(c.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:ex.models&&ex.models.length>0?ex.models.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(c.xv,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(c.xv,{children:["TPM: ",null!==ex.tpm_limit?ex.tpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["RPM: ",null!==ex.rpm_limit?ex.rpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Max Parallel Requests:"," ",null!==ex.max_parallel_requests?ex.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Model TPM Limits:"," ",(null===(R=ex.metadata)||void 0===R?void 0:R.model_tpm_limit)?JSON.stringify(ex.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Model RPM Limits:"," ",(null===(F=ex.metadata)||void 0===F?void 0:F.model_rpm_limit)?JSON.stringify(ex.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:Z(S(ex.metadata))})]}),(0,t.jsx)(P.Z,{objectPermission:ex.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:J}),(0,t.jsx)(C.Z,{loggingConfigs:k(ex.metadata),disabledCallbacks:Array.isArray(null===(V=ex.metadata)||void 0===V?void 0:V.litellm_disabled_callbacks)?(0,j.PA)(ex.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,a){a.d(s,{C:function(){return t}});function t(e){return""===e?null:e}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[665],{84717:function(e,s,a){a.d(s,{Ct:function(){return t.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return m.Z},rj:function(){return i.Z},td:function(){return o.Z},v0:function(){return d.Z},x4:function(){return c.Z},xv:function(){return u.Z},zx:function(){return l.Z}});var t=a(41649),l=a(78489),r=a(12514),i=a(67101),n=a(12485),d=a(18135),o=a(35242),c=a(29706),m=a(77991),u=a(84264),x=a(96761)},40728:function(e,s,a){a.d(s,{C:function(){return t.Z},x:function(){return l.Z}});var t=a(41649),l=a(84264)},64504:function(e,s,a){a.d(s,{o:function(){return l.Z},z:function(){return t.Z}});var t=a(78489),l=a(49566)},49282:function(e,s,a){var t=a(2265),l=a(39760),r=a(39623);s.Z=()=>{let[e,s]=(0,t.useState)([]),{accessToken:a,userId:i,userRole:n}=(0,l.Z)();return(0,t.useEffect)(()=>{(async()=>{s(await (0,r.Z)(a,i,n,null))})()},[a,i,n]),{teams:e,setTeams:s}}},39623:function(e,s,a){a.d(s,{Z:function(){return l}});var t=a(19250);let l=async(e,s,a,l)=>"Admin"!=a&&"Admin Viewer"!=a?await (0,t.teamListCall)(e,(null==l?void 0:l.organization_id)||null,s):await (0,t.teamListCall)(e,(null==l?void 0:l.organization_id)||null)},21609:function(e,s,a){a.d(s,{Z:function(){return c}});var t=a(57437),l=a(57840),r=a(22116),i=a(51653),n=a(76188),d=a(4260),o=a(2265);function c(e){let{isOpen:s,title:a,alertMessage:c,message:m,resourceInformationTitle:u,resourceInformation:x,onCancel:g,onOk:h,confirmLoading:p,requiredConfirmation:v}=e,{Title:j,Text:y}=l.default,[b,_]=(0,o.useState)("");return(0,o.useEffect)(()=>{s&&_("")},[s]),(0,t.jsx)(r.Z,{title:a,open:s,onOk:h,onCancel:g,confirmLoading:p,okText:p?"Deleting...":"Delete",cancelText:"Cancel",okButtonProps:{danger:!0,disabled:!!v&&b!==v||p},cancelButtonProps:{disabled:p},children:(0,t.jsxs)("div",{className:"space-y-4",children:[c&&(0,t.jsx)(i.Z,{message:c,type:"warning"}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(j,{level:5,className:"mb-3 text-gray-900",children:u}),(0,t.jsx)(n.Z,{column:1,size:"small",children:x&&x.map(e=>{let{label:s,value:a,...l}=e;return(0,t.jsx)(n.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:s}),children:(0,t.jsx)(y,{...l,children:null!=a?a:"-"})},s)})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(y,{children:m})}),v&&(0,t.jsxs)("div",{className:"mb-6 mt-4 pt-4 border-t border-gray-200",children:[(0,t.jsxs)(y,{className:"block text-base font-medium text-gray-700 mb-2",children:[(0,t.jsx)(y,{children:"Type "}),(0,t.jsx)(y,{strong:!0,type:"danger",children:v}),(0,t.jsx)(y,{children:" to confirm deletion:"})]}),(0,t.jsx)(d.default,{value:b,onChange:e=>_(e.target.value),placeholder:v,className:"rounded-md text-base border-gray-200",autoFocus:!0})]})]})})}},67479:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getGuardrailsList)(d);console.log("Guardrails response:",e),e.guardrails&&(console.log("Guardrails data:",e.guardrails),m(e.guardrails))}catch(e){console.error("Error fetching guardrails:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting guardrails is a premium feature.":"Select guardrails",onChange:e=>{console.log("Selected guardrails:",e),s(e)},value:a,loading:u,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping guardrail:",e),{label:"".concat(e.guardrail_name),value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},27799:function(e,s,a){var t=a(57437);a(2265);var l=a(40728),r=a(82182),i=a(91777),n=a(97434);s.Z=function(e){let{loggingConfigs:s=[],disabledCallbacks:a=[],variant:d="card",className:o=""}=e,c=e=>{var s;return(null===(s=Object.entries(n.Lo).find(s=>{let[a,t]=s;return t===e}))||void 0===s?void 0:s[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,t.jsx)(l.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"space-y-3",children:s.map((e,s)=>{var a;let i=c(e.callback_name),d=null===(a=n.Dg[i])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}):(0,t.jsx)(r.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-blue-800",children:i}),(0,t.jsxs)(l.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,t.jsx)(l.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(r.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-red-600"}),(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,t.jsx)(l.C,{color:"red",size:"xs",children:a.length})]}),a.length>0?(0,t.jsx)("div",{className:"space-y-3",children:a.map((e,s)=>{var a;let r=n.RD[e]||e,d=null===(a=n.Dg[r])||void 0===a?void 0:a.logo;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d?(0,t.jsx)("img",{src:d,alt:r,className:"w-5 h-5 object-contain"}):(0,t.jsx)(i.Z,{className:"h-5 w-5 text-gray-400"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-medium text-red-800",children:r}),(0,t.jsx)(l.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,t.jsx)(l.C,{color:"red",size:"sm",children:"Disabled"})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(l.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===d?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,t.jsx)(l.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},60131:function(e,s,a){a.d(s,{Z:function(){return v}});var t=a(57437),l=a(2265),r=a(92280),i=a(40728),n=a(79814),d=a(19250),o=function(e){let{vectorStores:s,accessToken:a}=e,[r,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(a&&0!==s.length)try{let e=await (0,d.vectorStoreListCall)(a);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[a,s.length]);let c=e=>{let s=r.find(s=>s.vector_store_id===e);return s?"".concat(s.vector_store_name||s.vector_store_id," (").concat(s.vector_store_id,")"):e};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:s.length})]}),s.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map((e,s)=>(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:c(e)},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},c=a(25327),m=a(86462),u=a(47686),x=a(99981),g=function(e){let{mcpServers:s,mcpAccessGroups:r=[],mcpToolPermissions:n={},accessToken:o}=e,[g,h]=(0,l.useState)([]),[p,v]=(0,l.useState)([]),[j,y]=(0,l.useState)(new Set),b=e=>{y(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})};(0,l.useEffect)(()=>{(async()=>{if(o&&s.length>0)try{let e=await (0,d.fetchMCPServers)(o);e&&Array.isArray(e)?h(e):e.data&&Array.isArray(e.data)&&h(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,s.length]),(0,l.useEffect)(()=>{(async()=>{if(o&&r.length>0)try{let e=await Promise.resolve().then(a.bind(a,19250)).then(e=>e.fetchMCPAccessGroups(o));v(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,r.length]);let _=e=>{let s=g.find(s=>s.server_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.alias," (").concat(a,")")}return e},f=e=>e,N=[...s.map(e=>({type:"server",value:e})),...r.map(e=>({type:"accessGroup",value:e}))],w=N.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(i.C,{color:"blue",size:"xs",children:w})]}),w>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:N.map((e,s)=>{let a="server"===e.type?n[e.value]:void 0,l=a&&a.length>0,r=j.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>l&&b(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(l?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:f(e.value)}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),l&&(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:a.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===a.length?"tool":"tools"}),r?(0,t.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),l&&r&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map((e,s)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},s))})})]},s)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(c.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},h=a(3497),p=function(e){let{agents:s,agentAccessGroups:a=[],accessToken:r}=e,[n,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(r&&s.length>0)try{let e=await (0,d.getAgentsList)(r);e&&e.agents&&Array.isArray(e.agents)&&o(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[r,s.length]);let c=e=>{let s=n.find(s=>s.agent_id===e);if(s){let a=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(s.agent_name," (").concat(a,")")}return e},m=[...s.map(e=>({type:"agent",value:e})),...a.map(e=>({type:"accessGroup",value:e}))],u=m.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(i.x,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(i.C,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:m.map((e,s)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:c(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})})})},s))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h.Z,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(i.x,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})},v=function(e){let{objectPermission:s,variant:a="card",className:l="",accessToken:i}=e,n=(null==s?void 0:s.vector_stores)||[],d=(null==s?void 0:s.mcp_servers)||[],c=(null==s?void 0:s.mcp_access_groups)||[],m=(null==s?void 0:s.mcp_tool_permissions)||{},u=(null==s?void 0:s.agents)||[],x=(null==s?void 0:s.agent_access_groups)||[],h=(0,t.jsxs)("div",{className:"card"===a?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(o,{vectorStores:n,accessToken:i}),(0,t.jsx)(g,{mcpServers:d,mcpAccessGroups:c,mcpToolPermissions:m,accessToken:i}),(0,t.jsx)(p,{agents:u,agentAccessGroups:x,accessToken:i})]});return"card"===a?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(l),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),h]}):(0,t.jsxs)("div",{className:"".concat(l),children:[(0,t.jsx)(r.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),h]})}},87972:function(e,s,a){var t=a(57437),l=a(2265),r=a(37592),i=a(19250);s.Z=e=>{let{onChange:s,value:a,className:n,accessToken:d,disabled:o}=e,[c,m]=(0,l.useState)([]),[u,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(d){x(!0);try{let e=await (0,i.getPoliciesList)(d);console.log("Policies response:",e),e.policies&&(console.log("Policies data:",e.policies),m(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{x(!1)}}})()},[d]),(0,t.jsx)("div",{children:(0,t.jsx)(r.default,{mode:"multiple",disabled:o,placeholder:o?"Setting policies is a premium feature.":"Select policies",onChange:e=>{console.log("Selected policies:",e),s(e)},value:a,loading:u,className:n,allowClear:!0,options:c.map(e=>(console.log("Mapping policy:",e),{label:"".concat(e.policy_name).concat(e.description?" - ".concat(e.description):""),value:e.policy_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}},21425:function(e,s,a){var t=a(57437);a(2265);var l=a(54507);s.Z=e=>{let{value:s,onChange:a,disabledCallbacks:r=[],onDisabledCallbacksChange:i}=e;return(0,t.jsx)(l.Z,{value:s,onChange:a,disabledCallbacks:r,onDisabledCallbacksChange:i})}},50665:function(e,s,a){a.d(s,{Z:function(){return ec}});var t=a(57437),l=a(49282),r=a(59872),i=a(33304),n=a(10900),d=a(23628),o=a(74998),c=a(84717),m=a(10032),u=a(5545),x=a(99981),g=a(30401),h=a(78867),p=a(2265),v=a(20347),j=a(97434),y=a(40728),b=a(58710),_=e=>{let{autoRotate:s=!1,rotationInterval:a,lastRotationAt:l,keyRotationAt:r,nextRotationAt:i,variant:n="card",className:o=""}=e,c=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)},m=(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(y.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(y.C,{color:s?"green":"gray",size:"xs",children:s?"Enabled":"Disabled"}),s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.x,{className:"text-gray-400",children:"•"}),(0,t.jsxs)(y.x,{className:"text-sm text-gray-600",children:["Every ",a]})]})]})}),(s||l||r||i)&&(0,t.jsxs)("div",{className:"space-y-3",children:[l&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-700",children:"Last Rotation"}),(0,t.jsx)(y.x,{className:"text-sm text-gray-600",children:c(l)})]})]}),(r||i)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-200 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-700",children:"Next Scheduled Rotation"}),(0,t.jsx)(y.x,{className:"text-sm text-gray-600",children:c(i||r||"")})]})]}),s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(b.Z,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)(y.x,{className:"text-gray-600",children:"No rotation history available"})]})]}),!s&&!l&&!r&&!i&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-gray-50 border border-gray-100 rounded-md",children:[(0,t.jsx)(d.Z,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)(y.x,{className:"text-gray-600",children:"Auto-rotation is not enabled for this key"})]})]});return"card"===n?(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(y.x,{className:"font-semibold text-gray-900",children:"Auto-Rotation"}),(0,t.jsx)(y.x,{className:"text-xs text-gray-500",children:"Automatic key rotation settings and status for this key"})]})}),m]}):(0,t.jsxs)("div",{className:"".concat(o),children:[(0,t.jsx)(y.x,{className:"font-medium text-gray-900 mb-3",children:"Auto-Rotation"}),m]})},f=a(21609);let N=["logging"],w=e=>e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(e=>{let[s]=e;return!N.includes(s)})):{},k=e=>e&&"object"==typeof e&&Array.isArray(e.logging)?e.logging:[],Z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return JSON.stringify(w(e),null,s)},S=e=>{if(!e||"object"!=typeof e)return e;let{tags:s,...a}=e;return a};var C=a(27799),A=a(9114),I=a(19250),P=a(60131),L=a(39760),D=a(78489),M=a(49804),T=a(67101),E=a(84264),R=a(49566),F=a(96761),V=a(22116),O=a(19015),z=a(92668),K=a(29233);function G(e){let{selectedToken:s,visible:a,onClose:l,onKeyUpdate:r}=e,{accessToken:i}=(0,L.Z)(),[n]=m.Z.useForm(),[d,o]=(0,p.useState)(null),[c,u]=(0,p.useState)(null),[x,g]=(0,p.useState)(null),[h,v]=(0,p.useState)(!1),[j,y]=(0,p.useState)(!1),[b,_]=(0,p.useState)(null);(0,p.useEffect)(()=>{a&&s&&i&&(n.setFieldsValue({key_alias:s.key_alias,max_budget:s.max_budget,tpm_limit:s.tpm_limit,rpm_limit:s.rpm_limit,duration:s.duration||""}),_(i),y(s.key_name===i))},[a,s,n,i]),(0,p.useEffect)(()=>{a||(o(null),v(!1),y(!1),_(null),n.resetFields())},[a,n]);let f=e=>{if(!e)return null;try{let s;let a=new Date;if(e.endsWith("s"))s=(0,z.I)(a,{seconds:parseInt(e)});else if(e.endsWith("h"))s=(0,z.I)(a,{hours:parseInt(e)});else if(e.endsWith("d"))s=(0,z.I)(a,{days:parseInt(e)});else throw Error("Invalid duration format");return s.toLocaleString()}catch(e){return null}};(0,p.useEffect)(()=>{(null==c?void 0:c.duration)?g(f(c.duration)):g(null)},[null==c?void 0:c.duration]);let N=async()=>{if(s&&b){v(!0);try{let e=await n.validateFields(),a=await (0,I.regenerateKeyCall)(b,s.token||s.token_id,e);o(a.key),A.Z.success("Virtual Key regenerated successfully"),console.log("Full regenerate response:",a);let t={token:a.token||a.key_id||s.token,key_name:a.key,max_budget:e.max_budget,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,expires:e.duration?f(e.duration):s.expires,...a};console.log("Updated key data with new token:",t),r&&r(t),v(!1)}catch(e){console.error("Error regenerating key:",e),A.Z.fromBackend(e),v(!1)}}},w=()=>{o(null),v(!1),y(!1),_(null),n.resetFields(),l()};return(0,t.jsx)(V.Z,{title:"Regenerate Virtual Key",open:a,onCancel:w,footer:d?[(0,t.jsx)(D.Z,{onClick:w,children:"Close"},"close")]:[(0,t.jsx)(D.Z,{onClick:w,className:"mr-2",children:"Cancel"},"cancel"),(0,t.jsx)(D.Z,{onClick:N,disabled:h,children:h?"Regenerating...":"Regenerate"},"regenerate")],children:d?(0,t.jsxs)(T.Z,{numItems:1,className:"gap-2 w-full",children:[(0,t.jsx)(F.Z,{children:"Regenerated Key"}),(0,t.jsx)(M.Z,{numColSpan:1,children:(0,t.jsxs)("p",{children:["Please replace your old key with the new key generated. For security reasons,"," ",(0,t.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,t.jsxs)(M.Z,{numColSpan:1,children:[(0,t.jsx)(E.Z,{className:"mt-3",children:"Key Alias:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:(null==s?void 0:s.key_alias)||"No alias set"})}),(0,t.jsx)(E.Z,{className:"mt-3",children:"New Virtual Key:"}),(0,t.jsx)("div",{className:"bg-gray-100 p-2 rounded mb-2",children:(0,t.jsx)("pre",{className:"break-words whitespace-normal",children:d})}),(0,t.jsx)(K.CopyToClipboard,{text:d,onCopy:()=>A.Z.success("Virtual Key copied to clipboard"),children:(0,t.jsx)(D.Z,{className:"mt-3",children:"Copy Virtual Key"})})]})]}):(0,t.jsxs)(m.Z,{form:n,layout:"vertical",onValuesChange:e=>{"duration"in e&&u(s=>({...s,duration:e.duration}))},children:[(0,t.jsx)(m.Z.Item,{name:"key_alias",label:"Key Alias",children:(0,t.jsx)(R.Z,{disabled:!0})}),(0,t.jsx)(m.Z.Item,{name:"max_budget",label:"Max Budget (USD)",children:(0,t.jsx)(O.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"tpm_limit",label:"TPM Limit",children:(0,t.jsx)(O.Z,{style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"rpm_limit",label:"RPM Limit",children:(0,t.jsx)(O.Z,{style:{width:"100%"}})}),(0,t.jsx)(m.Z.Item,{name:"duration",label:"Expire Key (eg: 30s, 30h, 30d)",className:"mt-8",children:(0,t.jsx)(R.Z,{placeholder:""})}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-gray-500",children:["Current expiry: ",(null==s?void 0:s.expires)?new Date(s.expires).toLocaleString():"Never"]}),x&&(0,t.jsxs)("div",{className:"mt-2 text-sm text-green-600",children:["New expiry: ",x]})]})})}var U=a(85968),B=a(67479),q=a(87972),W=a(15424),J=a(64504),$=a(37592),Q=a(4260),Y=a(63709),H=a(82586),X=a(62099),ee=a(95096),es=a(65895),ea=a(97492),et=a(68473),el=a(71098),er=a(24199),ei=a(21425),en=a(97415);let ed=e=>e&&0!==e.length?e.includes("llm_api_routes")?"llm_api":e.includes("management_routes")?"management":e.includes("info_routes")?"read_only":"default":"default";function eo(e){var s,a,l,r,i,n,d,o,c,u,g,h,v,y;let{keyData:b,onCancel:_,onSubmit:f,teams:N,accessToken:w,userID:C,userRole:P,premiumUser:L=!1}=e,[D]=m.Z.useForm(),[M,T]=(0,p.useState)([]),[E,R]=(0,p.useState)({}),F=null==N?void 0:N.find(e=>e.team_id===b.team_id),[V,O]=(0,p.useState)([]),[z,K]=(0,p.useState)(Array.isArray(null===(s=b.metadata)||void 0===s?void 0:s.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[]),[G,U]=(0,p.useState)(b.auto_rotate||!1),[eo,ec]=(0,p.useState)(b.rotation_interval||""),[em,eu]=(0,p.useState)(!1);(0,p.useEffect)(()=>{let e=async()=>{if(C&&P&&w)try{if(null===b.team_id){let e=(await (0,I.modelAvailableCall)(w,C,P)).data.map(e=>e.id);O(e)}else if(null==F?void 0:F.team_id){let e=await (0,el.wk)(C,P,w,F.team_id);O(Array.from(new Set([...F.models,...e])))}}catch(e){console.error("Error fetching models:",e)}};(async()=>{if(w)try{let e=await (0,I.getPromptsList)(w);T(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}})(),e()},[C,P,w,F,b.team_id]),(0,p.useEffect)(()=>{D.setFieldValue("disabled_callbacks",z)},[D,z]);let ex=e=>e&&({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||null,eg={...b,token:b.token||b.token_id,budget_duration:ex(b.budget_duration),metadata:Z(S(b.metadata)),guardrails:null===(a=b.metadata)||void 0===a?void 0:a.guardrails,disable_global_guardrails:(null===(l=b.metadata)||void 0===l?void 0:l.disable_global_guardrails)||!1,prompts:null===(r=b.metadata)||void 0===r?void 0:r.prompts,tags:null===(i=b.metadata)||void 0===i?void 0:i.tags,vector_stores:(null===(n=b.object_permission)||void 0===n?void 0:n.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(d=b.object_permission)||void 0===d?void 0:d.mcp_servers)||[],accessGroups:(null===(o=b.object_permission)||void 0===o?void 0:o.mcp_access_groups)||[]},mcp_tool_permissions:(null===(c=b.object_permission)||void 0===c?void 0:c.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(u=b.object_permission)||void 0===u?void 0:u.agents)||[],accessGroups:(null===(g=b.object_permission)||void 0===g?void 0:g.agent_access_groups)||[]},logging_settings:k(b.metadata),disabled_callbacks:Array.isArray(null===(h=b.metadata)||void 0===h?void 0:h.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[],auto_rotate:b.auto_rotate||!1,...b.rotation_interval&&{rotation_interval:b.rotation_interval},allowed_routes:b.allowed_routes};(0,p.useEffect)(()=>{var e,s,a,t,l,r,i,n,d;D.setFieldsValue({...b,token:b.token||b.token_id,budget_duration:ex(b.budget_duration),metadata:Z(S(b.metadata)),guardrails:null===(e=b.metadata)||void 0===e?void 0:e.guardrails,disable_global_guardrails:(null===(s=b.metadata)||void 0===s?void 0:s.disable_global_guardrails)||!1,prompts:null===(a=b.metadata)||void 0===a?void 0:a.prompts,tags:null===(t=b.metadata)||void 0===t?void 0:t.tags,vector_stores:(null===(l=b.object_permission)||void 0===l?void 0:l.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(r=b.object_permission)||void 0===r?void 0:r.mcp_servers)||[],accessGroups:(null===(i=b.object_permission)||void 0===i?void 0:i.mcp_access_groups)||[]},mcp_tool_permissions:(null===(n=b.object_permission)||void 0===n?void 0:n.mcp_tool_permissions)||{},logging_settings:k(b.metadata),disabled_callbacks:Array.isArray(null===(d=b.metadata)||void 0===d?void 0:d.litellm_disabled_callbacks)?(0,j.PA)(b.metadata.litellm_disabled_callbacks):[],auto_rotate:b.auto_rotate||!1,...b.rotation_interval&&{rotation_interval:b.rotation_interval},allowed_routes:b.allowed_routes})},[b,D]),(0,p.useEffect)(()=>{D.setFieldValue("auto_rotate",G)},[G,D]),(0,p.useEffect)(()=>{eo&&D.setFieldValue("rotation_interval",eo)},[eo,D]),(0,p.useEffect)(()=>{(async()=>{if(w)try{let e=await (0,I.tagListCall)(w);R(e)}catch(e){A.Z.fromBackend("Error fetching tags: "+e)}})()},[w]),console.log("premiumUser:",L);let eh=async e=>{try{eu(!0),await f(e)}finally{eu(!1)}};return(0,t.jsxs)(m.Z,{form:D,onFinish:eh,initialValues:eg,layout:"vertical",children:[(0,t.jsx)(m.Z.Item,{label:"Key Alias",name:"key_alias",children:(0,t.jsx)(J.o,{})}),(0,t.jsx)(m.Z.Item,{label:"Models",name:"models",children:(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes||e.models!==s.models,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=s("allowed_routes")||[],r=l.includes("management_routes")||l.includes("info_routes"),i=s("models")||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)($.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:r,value:r?[]:i,onChange:e=>a("models",e),children:[V.length>0&&(0,t.jsx)($.default.Option,{value:"all-team-models",children:"All Team Models"}),V.map(e=>(0,t.jsx)($.default.Option,{value:e,children:e},e))]}),r&&(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Models field is disabled for this key type"})]})}})}),(0,t.jsx)(m.Z.Item,{label:"Key Type",children:(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_routes!==s.allowed_routes,children:e=>{let{getFieldValue:s,setFieldValue:a}=e,l=ed(s("allowed_routes"));return(0,t.jsxs)($.default,{placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",value:l,onChange:e=>{switch(e){case"default":a("allowed_routes",[]);break;case"llm_api":a("allowed_routes",["llm_api_routes"]);break;case"management":a("allowed_routes",["management_routes"]),a("models",[])}},children:[(0,t.jsx)($.default.Option,{value:"default",label:"Default",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,t.jsx)($.default.Option,{value:"llm_api",label:"LLM API",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,t.jsx)($.default.Option,{value:"management",label:"Management",children:(0,t.jsxs)("div",{style:{padding:"4px 0"},children:[(0,t.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,t.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})}})}),(0,t.jsx)(m.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(er.Z,{step:.01,style:{width:"100%"},placeholder:"Enter a numerical value"})}),(0,t.jsx)(m.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsxs)($.default,{placeholder:"n/a",children:[(0,t.jsx)($.default.Option,{value:"daily",children:"Daily"}),(0,t.jsx)($.default.Option,{value:"weekly",children:"Weekly"}),(0,t.jsx)($.default.Option,{value:"monthly",children:"Monthly"})]})}),(0,t.jsx)(m.Z.Item,{label:"TPM Limit",name:"tpm_limit",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(es.Z,{type:"tpm",name:"tpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(m.Z.Item,{label:"RPM Limit",name:"rpm_limit",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(es.Z,{type:"rpm",name:"rpm_limit_type",showDetailedDescriptions:!1}),(0,t.jsx)(m.Z.Item,{label:"Max Parallel Requests",name:"max_parallel_requests",children:(0,t.jsx)(er.Z,{min:0})}),(0,t.jsx)(m.Z.Item,{label:"Model TPM Limit",name:"model_tpm_limit",children:(0,t.jsx)(Q.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(m.Z.Item,{label:"Model RPM Limit",name:"model_rpm_limit",children:(0,t.jsx)(Q.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}'})}),(0,t.jsx)(m.Z.Item,{label:"Guardrails",name:"guardrails",children:w&&(0,t.jsx)(B.Z,{onChange:e=>{D.setFieldValue("guardrails",e)},accessToken:w,disabled:!L})}),(0,t.jsx)(m.Z.Item,{label:(0,t.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,t.jsx)(x.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,t.jsx)(W.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",children:(0,t.jsx)(Y.Z,{disabled:!L,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,t.jsx)(m.Z.Item,{label:(0,t.jsxs)("span",{children:["Policies"," ",(0,t.jsx)(x.Z,{title:"Apply policies to this key to control guardrails and other settings",children:(0,t.jsx)(W.Z,{style:{marginLeft:"4px"}})})]}),name:"policies",children:w&&(0,t.jsx)(q.Z,{onChange:e=>{D.setFieldValue("policies",e)},accessToken:w,disabled:!L})}),(0,t.jsx)(m.Z.Item,{label:"Tags",name:"tags",children:(0,t.jsx)($.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(E).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),(0,t.jsx)(m.Z.Item,{label:"Prompts",name:"prompts",children:(0,t.jsx)(x.Z,{title:L?"":"Setting prompts by key is a premium feature",placement:"top",children:(0,t.jsx)($.default,{mode:"tags",style:{width:"100%"},disabled:!L,placeholder:L?Array.isArray(null===(v=b.metadata)||void 0===v?void 0:v.prompts)&&b.metadata.prompts.length>0?"Current: ".concat(b.metadata.prompts.join(", ")):"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:M.map(e=>({value:e,label:e}))})})}),(0,t.jsx)(m.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,t.jsx)(x.Z,{title:L?"":"Setting allowed pass through routes by key is a premium feature",placement:"top",children:(0,t.jsx)(ee.Z,{onChange:e=>D.setFieldValue("allowed_passthrough_routes",e),value:D.getFieldValue("allowed_passthrough_routes"),accessToken:w||"",placeholder:L?Array.isArray(null===(y=b.metadata)||void 0===y?void 0:y.allowed_passthrough_routes)&&b.metadata.allowed_passthrough_routes.length>0?"Current: ".concat(b.metadata.allowed_passthrough_routes.join(", ")):"Select or enter allowed pass through routes":"Premium feature - Upgrade to set allowed pass through routes by key",disabled:!L})})}),(0,t.jsx)(m.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,t.jsx)(en.Z,{onChange:e=>D.setFieldValue("vector_stores",e),value:D.getFieldValue("vector_stores"),accessToken:w||"",placeholder:"Select vector stores"})}),(0,t.jsx)(m.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,t.jsx)(ea.Z,{onChange:e=>D.setFieldValue("mcp_servers_and_groups",e),value:D.getFieldValue("mcp_servers_and_groups"),accessToken:w||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,t.jsx)(m.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,t.jsx)(Q.default,{type:"hidden"})}),(0,t.jsx)(m.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.mcp_servers_and_groups!==s.mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(et.Z,{accessToken:w||"",selectedServers:(null===(e=D.getFieldValue("mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:D.getFieldValue("mcp_tool_permissions")||{},onChange:e=>D.setFieldsValue({mcp_tool_permissions:e})})})}}),(0,t.jsx)(m.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,t.jsx)(H.Z,{onChange:e=>D.setFieldValue("agents_and_groups",e),value:D.getFieldValue("agents_and_groups"),accessToken:w||"",placeholder:"Select agents or access groups (optional)"})}),(0,t.jsx)(m.Z.Item,{label:"Team ID",name:"team_id",children:(0,t.jsx)($.default,{placeholder:"Select team",showSearch:!0,style:{width:"100%"},filterOption:(e,s)=>{var a,t;let l=null==N?void 0:N.find(e=>e.team_id===(null==s?void 0:s.value));return!!l&&null!==(t=null===(a=l.team_alias)||void 0===a?void 0:a.toLowerCase().includes(e.toLowerCase()))&&void 0!==t&&t},children:null==N?void 0:N.map(e=>(0,t.jsx)($.default.Option,{value:e.team_id,children:"".concat(e.team_alias," (").concat(e.team_id,")")},e.team_id))})}),(0,t.jsx)(m.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,t.jsx)(ei.Z,{value:D.getFieldValue("logging_settings"),onChange:e=>D.setFieldValue("logging_settings",e),disabledCallbacks:z,onDisabledCallbacksChange:e=>{K((0,j.PA)(e)),D.setFieldValue("disabled_callbacks",e)}})}),(0,t.jsx)(m.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(Q.default.TextArea,{rows:10})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(X.Z,{form:D,autoRotationEnabled:G,onAutoRotationChange:U,rotationInterval:eo,onRotationIntervalChange:ec}),(0,t.jsx)(m.Z.Item,{name:"duration",hidden:!0,initialValue:"",children:(0,t.jsx)(Q.default,{})})]}),(0,t.jsx)(m.Z.Item,{name:"token",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"allowed_routes",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"disabled_callbacks",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"auto_rotate",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)(m.Z.Item,{name:"rotation_interval",hidden:!0,children:(0,t.jsx)(Q.default,{})}),(0,t.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,t.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,t.jsx)(J.z,{variant:"secondary",onClick:_,disabled:em,children:"Cancel"}),(0,t.jsx)(J.z,{type:"submit",loading:em,children:"Save Changes"})]})})]})}function ec(e){var s,a,y,b,N,w,D,M,T,E,R,F,V;let{onClose:O,keyData:z,teams:K,onKeyDataUpdate:B,onDelete:q,backButtonText:W="Back to Keys"}=e,{accessToken:J,userId:$,userRole:Q,premiumUser:Y}=(0,L.Z)(),{teams:H}=(0,l.Z)(),[X,ee]=(0,p.useState)(!1),[es]=m.Z.useForm(),[ea,et]=(0,p.useState)(!1),[el,er]=(0,p.useState)(!1),[ei,en]=(0,p.useState)(""),[ed,ec]=(0,p.useState)(!1),[em,eu]=(0,p.useState)({}),[ex,eg]=(0,p.useState)(z),[eh,ep]=(0,p.useState)(null),[ev,ej]=(0,p.useState)(!1),[ey,eb]=(0,p.useState)({}),[e_,ef]=(0,p.useState)(!1);if((0,p.useEffect)(()=>{z&&eg(z)},[z]),(0,p.useEffect)(()=>{(async()=>{var e;let s=null==ex?void 0:null===(e=ex.metadata)||void 0===e?void 0:e.policies;if(!J||!s||!Array.isArray(s)||0===s.length)return;ef(!0);let a={};try{await Promise.all(s.map(async e=>{try{let s=await (0,I.getPolicyInfoWithGuardrails)(J,e);a[e]=s.resolved_guardrails||[]}catch(s){console.error("Failed to fetch guardrails for policy ".concat(e,":"),s),a[e]=[]}})),eb(a)}catch(e){console.error("Failed to fetch policy guardrails:",e)}finally{ef(!1)}})()},[J,null==ex?void 0:null===(s=ex.metadata)||void 0===s?void 0:s.policies]),(0,p.useEffect)(()=>{if(ev){let e=setTimeout(()=>{ej(!1)},5e3);return()=>clearTimeout(e)}},[ev]),!ex)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(c.zx,{icon:n.Z,variant:"light",onClick:O,className:"mb-4",children:W}),(0,t.jsx)(c.xv,{children:"Key not found"})]});let eN=async e=>{try{var s,a,t,l;if(!J)return;let r=e.token;if(e.key=r,Y||(delete e.guardrails,delete e.prompts),e.max_budget=(0,i.C)(e.max_budget),void 0!==e.vector_stores&&(e.object_permission={...ex.object_permission,vector_stores:e.vector_stores||[]},delete e.vector_stores),void 0!==e.mcp_servers_and_groups){let{servers:s,accessGroups:a}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};e.object_permission={...ex.object_permission,mcp_servers:s||[],mcp_access_groups:a||[]},delete e.mcp_servers_and_groups}if(void 0!==e.mcp_tool_permissions){let s=e.mcp_tool_permissions||{};Object.keys(s).length>0&&(e.object_permission={...e.object_permission,mcp_tool_permissions:s}),delete e.mcp_tool_permissions}if(void 0!==e.agents_and_groups){let{agents:s,accessGroups:a}=e.agents_and_groups||{agents:[],accessGroups:[]};e.object_permission={...e.object_permission,agents:s||[],agent_access_groups:a||[]},delete e.agents_and_groups}if(e.max_budget=(0,i.C)(e.max_budget),e.tpm_limit=(0,i.C)(e.tpm_limit),e.rpm_limit=(0,i.C)(e.rpm_limit),e.max_parallel_requests=(0,i.C)(e.max_parallel_requests),e.metadata&&"string"==typeof e.metadata)try{let t=JSON.parse(e.metadata);"tags"in t&&delete t.tags,e.metadata={...t,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(s=e.guardrails)||void 0===s?void 0:s.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(a=e.disabled_callbacks)||void 0===a?void 0:a.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}catch(e){console.error("Error parsing metadata JSON:",e),A.Z.error("Invalid metadata JSON");return}else{let{tags:s,...a}=e.metadata||{};e.metadata={...a,...Array.isArray(e.tags)&&e.tags.length>0?{tags:e.tags}:{},...(null===(t=e.guardrails)||void 0===t?void 0:t.length)>0?{guardrails:e.guardrails}:{},...e.logging_settings?{logging:e.logging_settings}:{},...(null===(l=e.disabled_callbacks)||void 0===l?void 0:l.length)>0?{litellm_disabled_callbacks:(0,j.Z3)(e.disabled_callbacks)}:{}}}"tags"in e&&delete e.tags,delete e.logging_settings,e.budget_duration&&(e.budget_duration=({daily:"24h",weekly:"7d",monthly:"30d"})[e.budget_duration]);let n=await (0,I.keyUpdateCall)(J,e);eg(e=>e?{...e,...n}:void 0),B&&B(n),A.Z.success("Key updated successfully"),ee(!1)}catch(e){A.Z.fromBackend((0,U.O)(e)),console.error("Error updating key:",e)}},ew=async()=>{try{if(er(!0),!J)return;await (0,I.keyDeleteCall)(J,ex.token||ex.token_id),A.Z.success("Key deleted successfully"),q&&q(),O()}catch(e){console.error("Error deleting the key:",e),A.Z.fromBackend(e)}finally{er(!1),et(!1),en("")}},ek=async(e,s)=>{await (0,r.vQ)(e)&&(eu(e=>({...e,[s]:!0})),setTimeout(()=>{eu(e=>({...e,[s]:!1}))},2e3))},eZ=e=>{let s=new Date(e),a=s.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),t=s.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return"".concat(a," at ").concat(t)};console.log("userRole",Q);let eS=(0,v.P4)(Q||"")||H&&(0,v._p)(null==H?void 0:null===(a=H.filter(e=>e.team_id===ex.team_id)[0])||void 0===a?void 0:a.members_with_roles,$||"")||$===ex.user_id&&"Internal Viewer"!==Q;return(0,t.jsxs)("div",{className:"w-full h-screen p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.zx,{icon:n.Z,variant:"light",onClick:O,className:"mb-4",children:W}),(0,t.jsx)(c.Dx,{children:ex.key_alias||"Virtual Key"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer mb-2 space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"text-xs text-gray-400 uppercase tracking-wide mt-2",children:"Key ID"}),(0,t.jsx)(c.xv,{className:"text-gray-500 font-mono text-sm",children:ex.token_id||ex.token})]}),(0,t.jsx)(u.ZP,{type:"text",size:"small",icon:em["key-id"]?(0,t.jsx)(g.Z,{size:12}):(0,t.jsx)(h.Z,{size:12}),onClick:()=>ek(ex.token_id||ex.token,"key-id"),className:"ml-2 transition-all duration-200".concat(em["key-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,t.jsx)(c.xv,{className:"text-sm text-gray-500",children:ex.updated_at&&ex.updated_at!==ex.created_at?"Updated: ".concat(eZ(ex.updated_at)):"Created: ".concat(eZ(ex.created_at))}),ev&&(0,t.jsx)(c.Ct,{color:"green",size:"xs",className:"animate-pulse",children:"Recently Regenerated"}),eh&&(0,t.jsx)(c.Ct,{color:"blue",size:"xs",children:"Regenerated"})]})]}),eS&&(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(x.Z,{title:Y?"":"This is a LiteLLM Enterprise feature, and requires a valid key to use.",children:(0,t.jsx)("span",{className:"inline-block",children:(0,t.jsx)(c.zx,{icon:d.Z,variant:"secondary",onClick:()=>ec(!0),className:"flex items-center",disabled:!Y,children:"Regenerate Key"})})}),(0,t.jsx)(c.zx,{icon:o.Z,variant:"secondary",onClick:()=>et(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",children:"Delete Key"})]})]}),(0,t.jsx)(G,{selectedToken:ex,visible:ed,onClose:()=>ec(!1),onKeyUpdate:e=>{eg(s=>{if(s)return{...s,...e,created_at:new Date().toLocaleString()}}),ep(new Date),ej(!0),B&&B({...e,created_at:new Date().toLocaleString()})}}),(0,t.jsx)(f.Z,{isOpen:ea,title:"Delete Key",alertMessage:"This action is irreversible and will immediately revoke access for any applications using this key.",message:"Are you sure you want to delete this Virtual Key?",resourceInformationTitle:"Key Information",resourceInformation:[{label:"Key Alias",value:(null==ex?void 0:ex.key_alias)||"-"},{label:"Key ID",value:(null==ex?void 0:ex.token_id)||(null==ex?void 0:ex.token)||"-",code:!0},{label:"Team ID",value:(null==ex?void 0:ex.team_id)||"-",code:!0},{label:"Spend",value:(null==ex?void 0:ex.spend)?"$".concat((0,r.pw)(ex.spend,4)):"$0.0000"}],onCancel:()=>{et(!1),en("")},onOk:ew,confirmLoading:el,requiredConfirmation:null==ex?void 0:ex.key_alias}),(0,t.jsxs)(c.v0,{children:[(0,t.jsxs)(c.td,{className:"mb-4",children:[(0,t.jsx)(c.OK,{children:"Overview"}),(0,t.jsx)(c.OK,{children:"Settings"})]}),(0,t.jsxs)(c.nP,{children:[(0,t.jsx)(c.x4,{children:(0,t.jsxs)(c.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(c.Dx,{children:["$",(0,r.pw)(ex.spend,4)]}),(0,t.jsxs)(c.xv,{children:["of"," ",null!==ex.max_budget?"$".concat((0,r.pw)(ex.max_budget)):"Unlimited"]})]})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Rate Limits"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(c.xv,{children:["TPM: ",null!==ex.tpm_limit?ex.tpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["RPM: ",null!==ex.rpm_limit?ex.rpm_limit:"Unlimited"]})]})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{children:"Models"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:ex.models&&ex.models.length>0?ex.models.map((e,s)=>(0,t.jsx)(c.Ct,{color:"red",children:e},s)):(0,t.jsx)(c.xv,{children:"No models specified"})})]}),(0,t.jsx)(c.Zb,{children:(0,t.jsx)(P.Z,{objectPermission:ex.object_permission,variant:"inline",accessToken:J})}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{className:"font-medium mb-3",children:"Guardrails"}),Array.isArray(null===(y=ex.metadata)||void 0===y?void 0:y.guardrails)&&ex.metadata.guardrails.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:ex.metadata.guardrails.map((e,s)=>(0,t.jsx)(c.Ct,{color:"blue",children:e},s))}):(0,t.jsx)(c.xv,{className:"text-gray-500",children:"No guardrails configured"}),"boolean"==typeof(null===(b=ex.metadata)||void 0===b?void 0:b.disable_global_guardrails)&&!0===ex.metadata.disable_global_guardrails&&(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:(0,t.jsx)(c.Ct,{color:"yellow",children:"Global Guardrails Disabled"})})]}),(0,t.jsxs)(c.Zb,{children:[(0,t.jsx)(c.xv,{className:"font-medium mb-3",children:"Policies"}),Array.isArray(null===(N=ex.metadata)||void 0===N?void 0:N.policies)&&ex.metadata.policies.length>0?(0,t.jsx)("div",{className:"space-y-4",children:ex.metadata.policies.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.Ct,{color:"purple",children:e}),e_&&(0,t.jsx)(c.xv,{className:"text-xs text-gray-400",children:"Loading guardrails..."})]}),!e_&&ey[e]&&ey[e].length>0&&(0,t.jsxs)("div",{className:"ml-4 pl-3 border-l-2 border-gray-200",children:[(0,t.jsx)(c.xv,{className:"text-xs text-gray-500 mb-1",children:"Resolved Guardrails:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:ey[e].map((e,s)=>(0,t.jsx)(c.Ct,{color:"blue",size:"xs",children:e},s))})]})]},s))}):(0,t.jsx)(c.xv,{className:"text-gray-500",children:"No policies configured"})]}),(0,t.jsx)(C.Z,{loggingConfigs:k(ex.metadata),disabledCallbacks:Array.isArray(null===(w=ex.metadata)||void 0===w?void 0:w.litellm_disabled_callbacks)?(0,j.PA)(ex.metadata.litellm_disabled_callbacks):[],variant:"card"}),(0,t.jsx)(_,{autoRotate:ex.auto_rotate,rotationInterval:ex.rotation_interval,lastRotationAt:ex.last_rotation_at,keyRotationAt:ex.key_rotation_at,nextRotationAt:ex.next_rotation_at,variant:"card"})]})}),(0,t.jsx)(c.x4,{children:(0,t.jsxs)(c.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(c.Dx,{children:"Key Settings"}),!X&&Q&&v.LQ.includes(Q)&&(0,t.jsx)(c.zx,{onClick:()=>ee(!0),children:"Edit Settings"})]}),X?(0,t.jsx)(eo,{keyData:ex,onCancel:()=>ee(!1),onSubmit:eN,teams:K,accessToken:J,userID:$,userRole:Q,premiumUser:Y}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Key ID"}),(0,t.jsx)(c.xv,{className:"font-mono",children:ex.token_id||ex.token})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Key Alias"}),(0,t.jsx)(c.xv,{children:ex.key_alias||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Secret Key"}),(0,t.jsx)(c.xv,{className:"font-mono",children:ex.key_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Team ID"}),(0,t.jsx)(c.xv,{children:ex.team_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Organization"}),(0,t.jsx)(c.xv,{children:ex.organization_id||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(c.xv,{children:eZ(ex.created_at)})]}),eh&&(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Last Regenerated"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.xv,{children:eZ(eh)}),(0,t.jsx)(c.Ct,{color:"green",size:"xs",children:"Recent"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Expires"}),(0,t.jsx)(c.xv,{children:ex.expires?eZ(ex.expires):"Never"})]}),(0,t.jsx)(_,{autoRotate:ex.auto_rotate,rotationInterval:ex.rotation_interval,lastRotationAt:ex.last_rotation_at,keyRotationAt:ex.key_rotation_at,nextRotationAt:ex.next_rotation_at,variant:"inline",className:"pt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Spend"}),(0,t.jsxs)(c.xv,{children:["$",(0,r.pw)(ex.spend,4)," USD"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Budget"}),(0,t.jsx)(c.xv,{children:null!==ex.max_budget?"$".concat((0,r.pw)(ex.max_budget,2)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Tags"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:Array.isArray(null===(D=ex.metadata)||void 0===D?void 0:D.tags)&&ex.metadata.tags.length>0?ex.metadata.tags.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No tags specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Prompts"}),(0,t.jsx)(c.xv,{children:Array.isArray(null===(M=ex.metadata)||void 0===M?void 0:M.prompts)&&ex.metadata.prompts.length>0?ex.metadata.prompts.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No prompts specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Allowed Pass Through Routes"}),(0,t.jsx)(c.xv,{children:Array.isArray(null===(T=ex.metadata)||void 0===T?void 0:T.allowed_passthrough_routes)&&ex.metadata.allowed_passthrough_routes.length>0?ex.metadata.allowed_passthrough_routes.map((e,s)=>(0,t.jsx)("span",{className:"px-2 mr-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):"No pass through routes specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,t.jsx)(c.xv,{children:(null===(E=ex.metadata)||void 0===E?void 0:E.disable_global_guardrails)===!0?(0,t.jsx)(c.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,t.jsx)(c.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:ex.models&&ex.models.length>0?ex.models.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(c.xv,{children:"No models specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Rate Limits"}),(0,t.jsxs)(c.xv,{children:["TPM: ",null!==ex.tpm_limit?ex.tpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["RPM: ",null!==ex.rpm_limit?ex.rpm_limit:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Max Parallel Requests:"," ",null!==ex.max_parallel_requests?ex.max_parallel_requests:"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Model TPM Limits:"," ",(null===(R=ex.metadata)||void 0===R?void 0:R.model_tpm_limit)?JSON.stringify(ex.metadata.model_tpm_limit):"Unlimited"]}),(0,t.jsxs)(c.xv,{children:["Model RPM Limits:"," ",(null===(F=ex.metadata)||void 0===F?void 0:F.model_rpm_limit)?JSON.stringify(ex.metadata.model_rpm_limit):"Unlimited"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:Z(S(ex.metadata))})]}),(0,t.jsx)(P.Z,{objectPermission:ex.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:J}),(0,t.jsx)(C.Z,{loggingConfigs:k(ex.metadata),disabledCallbacks:Array.isArray(null===(V=ex.metadata)||void 0===V?void 0:V.litellm_disabled_callbacks)?(0,j.PA)(ex.metadata.litellm_disabled_callbacks):[],variant:"inline",className:"pt-4 border-t border-gray-200"})]})]})})]})]})]})}},33304:function(e,s,a){a.d(s,{C:function(){return t}});function t(e){return""===e?null:e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6653-60dcca96bc5a03fe.js b/litellm/proxy/_experimental/out/_next/static/chunks/6653-2569f29db6329b48.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/6653-60dcca96bc5a03fe.js rename to litellm/proxy/_experimental/out/_next/static/chunks/6653-2569f29db6329b48.js index 05a60e7972..1813e8e6a5 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6653-60dcca96bc5a03fe.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6653-2569f29db6329b48.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6653],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return i.Z},oi:function(){return n.Z},xv:function(){return r.Z},zx:function(){return t.Z}});var t=l(78489),a=l(12514),i=l(67982),r=l(84264),n=l(49566),d=l(96761)},86653:function(e,s,l){l.d(s,{Z:function(){return eI}});var t=l(57437),a=l(58643),i=l(2265),r=l(16312),n=l(57840),d=l(42264),o=l(22116),c=l(61994),u=l(56609),m=l(23496),x=l(5945),h=l(58760),g=l(37592),v=l(19015),j=l(19250),p=l(10032),f=l(99981),y=l(24199),_=l(43227),b=l(49566),N=l(16853),S=l(46468),Z=l(20347),w=l(15424),k=l(65925);function C(e){let{userData:s,onCancel:l,onSubmit:a,teams:n,accessToken:d,userID:o,userRole:c,userModels:u,possibleUIRoles:m,isBulkEdit:x=!1}=e,[h]=p.Z.useForm();return i.useEffect(()=>{var e,l,t,a,i,r,n;h.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_alias:null===(l=s.user_info)||void 0===l?void 0:l.user_alias,user_role:null===(t=s.user_info)||void 0===t?void 0:t.user_role,models:(null===(a=s.user_info)||void 0===a?void 0:a.models)||[],max_budget:null===(i=s.user_info)||void 0===i?void 0:i.max_budget,budget_duration:null===(r=s.user_info)||void 0===r?void 0:r.budget_duration,metadata:(null===(n=s.user_info)||void 0===n?void 0:n.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,h]),(0,t.jsxs)(p.Z,{form:h,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}a(e)},layout:"vertical",children:[!x&&(0,t.jsx)(p.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(b.Z,{disabled:!0})}),!x&&(0,t.jsx)(p.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(f.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(w.Z,{})})]}),name:"user_role",children:(0,t.jsx)(g.default,{children:m&&Object.entries(m).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(_.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(f.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(w.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(g.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!Z.ZL.includes(c||""),children:[(0,t.jsx)(g.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(g.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),u.map(e=>(0,t.jsx)(g.default.Option,{value:e,children:(0,S.W0)(e)},e))]})}),(0,t.jsx)(p.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(y.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(N.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(r.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(r.z,{type:"submit",children:"Save Changes"})]})]})}var U=l(9114);let{Text:I,Title:D}=n.default;var z=e=>{let{visible:s,onCancel:l,selectedUsers:a,possibleUIRoles:r,accessToken:n,onSuccess:p,teams:f,userRole:y,userModels:_,allowAllUsers:b=!1}=e,[N,S]=(0,i.useState)(!1),[Z,w]=(0,i.useState)([]),[k,z]=(0,i.useState)(null),[A,B]=(0,i.useState)(!1),[E,T]=(0,i.useState)(!1),O=()=>{w([]),z(null),B(!1),T(!1),l()},L=i.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:f||[]}),[f,s]),F=async e=>{if(console.log("formValues",e),!n){U.Z.fromBackend("Access token not found");return}S(!0);try{let s=a.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let i=Object.keys(t).length>0,r=A&&Z.length>0;if(!i&&!r){U.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let o=[];if(i){if(E){let e=await (0,j.userBulkUpdateUserCall)(n,t,void 0,!0);o.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,j.userBulkUpdateUserCall)(n,t,s),o.push("Updated ".concat(s.length," user(s)"))}if(r){let e=[];for(let s of Z)try{let l=null;E?l=null:a.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,j.teamBulkMemberAddCall)(n,s,l||null,k||void 0,E);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);o.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&d.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}o.length>0&&U.Z.success(o.join(". ")),w([]),z(null),B(!1),T(!1),p(),l()}catch(e){console.error("Bulk operation failed:",e),U.Z.fromBackend("Failed to perform bulk operations")}finally{S(!1)}};return(0,t.jsxs)(o.Z,{visible:s,onCancel:O,footer:null,title:E?"Bulk Edit All Users":"Bulk Edit ".concat(a.length," User(s)"),width:800,children:[b&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(c.Z,{checked:E,onChange:e=>T(e.target.checked),children:(0,t.jsx)(I,{strong:!0,children:"Update ALL users in the system"})}),E&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(I,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!E&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(D,{level:5,children:["Selected Users (",a.length,"):"]}),(0,t.jsx)(u.Z,{size:"small",bordered:!0,dataSource:a,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(I,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(I,{style:{fontSize:"12px"},children:(null==r?void 0:null===(s=r[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(I,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(m.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(I,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(x.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(h.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(c.Z,{checked:A,onChange:e=>B(e.target.checked),children:"Add selected users to teams"}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(g.default,{mode:"multiple",placeholder:"Select teams to add users to",value:Z,onChange:w,style:{width:"100%",marginTop:8},options:(null==f?void 0:f.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(v.Z,{placeholder:"Max budget per user in team",value:k,onChange:e=>z(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(C,{userData:L,onCancel:O,onSubmit:F,teams:f,accessToken:n,userID:"bulk_edit",userRole:y,userModels:_,possibleUIRoles:r,isBulkEdit:!0}),N&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(I,{children:["Updating ",E?"all users":a.length," user(s)..."]})})]})},A=l(7765),B=l(5545),E=e=>{let{visible:s,possibleUIRoles:l,onCancel:a,user:r,onSubmit:n}=e,[d,c]=(0,i.useState)(r),[u]=p.Z.useForm();(0,i.useEffect)(()=>{u.resetFields()},[r]);let m=async()=>{u.resetFields(),a()},x=async e=>{n(e),u.resetFields(),a()};return r?(0,t.jsx)(o.Z,{visible:s,onCancel:m,footer:null,title:"Edit User "+r.user_id,width:1e3,children:(0,t.jsx)(p.Z,{form:u,onFinish:x,initialValues:r,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(g.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(_.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(v.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(y.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},T=l(98187),O=l(59872),L=l(19616),F=l(29827),R=l(11713),P=l(21609),M=l(88913),K=l(63709),V=l(10353),q=l(26349),G=l(96473),J=e=>{var s;let{accessToken:l,possibleUIRoles:a,userID:r,userRole:d}=e,[o,c]=(0,i.useState)(!0),[u,m]=(0,i.useState)(null),[x,h]=(0,i.useState)(!1),[p,f]=(0,i.useState)({}),[y,_]=(0,i.useState)(!1),[b,N]=(0,i.useState)([]),{Paragraph:Z}=n.default,{Option:w}=g.default;(0,i.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,j.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,j.modelAvailableCall)(l,r,d);if(e&&e.data){let s=e.data.map(e=>e.id);N(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),U.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let C=async()=>{if(l){_(!0);try{let e=Object.entries(p).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,j.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),h(!1)}catch(e){console.error("Error updating SSO settings:",e),U.Z.fromBackend("Failed to update settings: "+e)}finally{_(!1)}}},I=(e,s)=>{f(l=>({...l,[e]:s}))},D=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],z=e=>{let s=D(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},I("teams",a)},a=e=>{I("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(M.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(M.zx,{size:"sm",variant:"secondary",icon:q.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(M.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(v.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(g.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(w,{value:"user",children:"User"}),(0,t.jsx)(w,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(M.zx,{variant:"secondary",icon:G.Z,onClick:()=>{I("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},A=(e,s,l)=>{var i;let r=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:z(p[e]||[])});if("user_role"===e&&a)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:Object.entries(a).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(w,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(k.Z,{value:p[e]||null,onChange:s=>I(e,s),className:"mt-2"});if("boolean"===r)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(K.Z,{checked:!!p[e],onChange:s=>I(e,s)})});if("array"===r&&(null===(i=s.items)||void 0===i?void 0:i.enum))return(0,t.jsx)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:[(0,t.jsx)(w,{value:"no-default-models",children:"No Default Models"},"no-default-models"),(0,t.jsx)(w,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),b.map(e=>(0,t.jsx)(w,{value:e,children:(0,S.W0)(e)},e))]});if("string"===r&&s.enum)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else return(0,t.jsx)(M.oi,{value:void 0!==p[e]?String(p[e]):"",onChange:s=>I(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},B=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=D(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,O.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&a&&a[s]){let{ui_label:e,description:l}=a[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,k.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,S.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(V.Z,{size:"large"})}):u?(0,t.jsxs)(M.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(M.Dx,{children:"Default User Settings"}),!o&&u&&(x?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(M.zx,{variant:"secondary",onClick:()=>{h(!1),f(u.values||{})},disabled:y,children:"Cancel"}),(0,t.jsx)(M.zx,{onClick:C,loading:y,children:"Save Changes"})]}):(0,t.jsx)(M.zx,{onClick:()=>h(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(Z,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(M.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,i=e[l],r=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(M.xv,{className:"font-medium text-lg",children:r}),(0,t.jsx)(Z,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),x?(0,t.jsx)("div",{className:"mt-2",children:A(l,a,i)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:B(l,i)})]},l)}):(0,t.jsx)(M.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(M.Zb,{children:(0,t.jsx)(M.xv,{children:"No settings available or you do not have permission to view them."})})},Q=l(41649),H=l(67101),$=l(47323),W=l(15731),Y=l(53410),X=l(74998),ee=l(23628);let es=(e,s,l,a,i,r)=>{let n=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)(f.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_alias||"-"})}},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,O.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(f.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(W.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)(H.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(Q.Z,{size:"xs",color:"indigo",children:[s.original.key_count," ",1===s.original.key_count?"Key":"Keys"]}):(0,t.jsx)(Q.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.Z,{title:"Edit user details",children:(0,t.jsx)($.Z,{icon:Y.Z,size:"sm",onClick:()=>i(s.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(f.Z,{title:"Delete user",children:(0,t.jsx)($.Z,{icon:X.Z,size:"sm",onClick:()=>l(s.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(f.Z,{title:"Reset Password",children:(0,t.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>a(s.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}}];if(r){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:i}=r;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(c.Z,{indeterminate:i,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(c.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var el=l(71594),et=l(24525),ea=l(27281),ei=l(21626),er=l(97214),en=l(28241),ed=l(58834),eo=l(69552),ec=l(71876),eu=l(44633),em=l(86462),ex=l(49084),eh=l(50337),eg=l(84717),ev=l(77331),ej=l(30401),ep=l(78867);function ef(e){var s,l,a,r,n,d,o,c,u,m,x,h,g,v,p,f,y,_,b,N,S,w,I,D,z,A,E,L,F,R,M,K,V,q,G,J,Q,H,$,W,Y,es,el,et,ea;let{userId:ei,onClose:er,accessToken:en,userRole:ed,onDelete:eo,possibleUIRoles:ec,initialTab:eu=0,startInEditMode:em=!1}=e,[ex,eh]=(0,i.useState)(null),[ef,ey]=(0,i.useState)(!1),[e_,eb]=(0,i.useState)(!1),[eN,eS]=(0,i.useState)(!0),[eZ,ew]=(0,i.useState)(em),[ek,eC]=(0,i.useState)([]),[eU,eI]=(0,i.useState)(!1),[eD,ez]=(0,i.useState)(null),[eA,eB]=(0,i.useState)(null),[eE,eT]=(0,i.useState)(eu),[eO,eL]=(0,i.useState)({}),[eF,eR]=(0,i.useState)(!1);i.useEffect(()=>{eB((0,j.getProxyBaseUrl)())},[]),i.useEffect(()=>{console.log("userId: ".concat(ei,", userRole: ").concat(ed,", accessToken: ").concat(en)),(async()=>{try{if(!en)return;let e=await (0,j.userInfoCall)(en,ei,ed||"",!1,null,null,!0);eh(e);let s=(await (0,j.modelAvailableCall)(en,ei,ed||"")).data.map(e=>e.id);eC(s)}catch(e){console.error("Error fetching user data:",e),U.Z.fromBackend("Failed to fetch user data")}finally{eS(!1)}})()},[en,ei,ed]);let eP=async()=>{if(!en){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let e=await (0,j.invitationCreateCall)(en,ei);ez(e),eI(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},eM=async()=>{try{if(!en)return;eb(!0),await (0,j.userDeleteCall)(en,[ei]),U.Z.success("User deleted successfully"),eo&&eo(),er()}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{ey(!1),eb(!1)}},eK=async e=>{try{if(!en||!ex)return;await (0,j.userUpdateUserCall)(en,e,null),eh({...ex,user_info:{...ex.user_info,user_email:e.user_email,user_alias:e.user_alias,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),U.Z.success("User updated successfully"),ew(!1)}catch(e){console.error("Error updating user:",e),U.Z.fromBackend("Failed to update user")}};if(eN)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"Loading user data..."})]});if(!ex)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"User not found"})]});let eV=async(e,s)=>{await (0,O.vQ)(e)&&(eL(e=>({...e,[s]:!0})),setTimeout(()=>{eL(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.Dx,{children:(null===(s=ex.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"text-gray-500 font-mono",children:ex.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eO["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eV(ex.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eO["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),ed&&Z.LQ.includes(ed)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(eg.zx,{icon:ee.Z,variant:"secondary",onClick:eP,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(eg.zx,{icon:X.Z,variant:"secondary",onClick:()=>ey(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-600 hover:border-red-600",children:"Delete User"})]})]}),(0,t.jsx)(P.Z,{isOpen:ef,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null===(l=ex.user_info)||void 0===l?void 0:l.user_email},{label:"User ID",value:ex.user_id,code:!0},{label:"Global Proxy Role",value:(null===(a=ex.user_info)||void 0===a?void 0:a.user_role)&&(null==ec?void 0:null===(r=ec[ex.user_info.user_role])||void 0===r?void 0:r.ui_label)||(null===(n=ex.user_info)||void 0===n?void 0:n.user_role)||"-"},{label:"Total Spend (USD)",value:(null===(d=ex.user_info)||void 0===d?void 0:d.spend)!==null&&(null===(o=ex.user_info)||void 0===o?void 0:o.spend)!==void 0?ex.user_info.spend.toFixed(2):void 0}],onCancel:()=>{ey(!1)},onOk:eM,confirmLoading:e_}),(0,t.jsxs)(eg.v0,{defaultIndex:eE,onIndexChange:eT,children:[(0,t.jsxs)(eg.td,{className:"mb-4",children:[(0,t.jsx)(eg.OK,{children:"Overview"}),(0,t.jsx)(eg.OK,{children:"Details"})]}),(0,t.jsxs)(eg.nP,{children:[(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(eg.Dx,{children:["$",(0,O.pw)((null===(c=ex.user_info)||void 0===c?void 0:c.spend)||0,4)]}),(0,t.jsxs)(eg.xv,{children:["of"," ",(null===(u=ex.user_info)||void 0===u?void 0:u.max_budget)!==null?"$".concat((0,O.pw)(ex.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(m=ex.teams)||void 0===m?void 0:m.length)&&(null===(x=ex.teams)||void 0===x?void 0:x.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(h=ex.teams)||void 0===h?void 0:h.slice(0,eF?ex.teams.length:20).map((e,s)=>(0,t.jsx)(eg.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eF&&(null===(g=ex.teams)||void 0===g?void 0:g.length)>20&&(0,t.jsxs)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!0),children:["+",ex.teams.length-20," more"]}),eF&&(null===(v=ex.teams)||void 0===v?void 0:v.length)>20&&(0,t.jsx)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Virtual Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eg.xv,{children:[(null===(p=ex.keys)||void 0===p?void 0:p.length)||0," ",(null===(f=ex.keys)||void 0===f?void 0:f.length)===1?"Key":"Keys"]})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(_=ex.user_info)||void 0===_?void 0:null===(y=_.models)||void 0===y?void 0:y.length)&&(null===(N=ex.user_info)||void 0===N?void 0:null===(b=N.models)||void 0===b?void 0:b.length)>0?null===(w=ex.user_info)||void 0===w?void 0:null===(S=w.models)||void 0===S?void 0:S.map((e,s)=>(0,t.jsx)(eg.xv,{children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eg.Dx,{children:"User Settings"}),!eZ&&ed&&Z.LQ.includes(ed)&&(0,t.jsx)(eg.zx,{onClick:()=>ew(!0),children:"Edit Settings"})]}),eZ&&ex?(0,t.jsx)(C,{userData:ex,onCancel:()=>ew(!1),onSubmit:eK,teams:ex.teams,accessToken:en,userID:ei,userRole:ed,userModels:ek,possibleUIRoles:ec}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"font-mono",children:ex.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eO["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eV(ex.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eO["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(eg.xv,{children:(null===(I=ex.user_info)||void 0===I?void 0:I.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(eg.xv,{children:(null===(D=ex.user_info)||void 0===D?void 0:D.user_alias)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(eg.xv,{children:(null===(z=ex.user_info)||void 0===z?void 0:z.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(eg.xv,{children:(null===(A=ex.user_info)||void 0===A?void 0:A.created_at)?new Date(ex.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(eg.xv,{children:(null===(E=ex.user_info)||void 0===E?void 0:E.updated_at)?new Date(ex.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(L=ex.teams)||void 0===L?void 0:L.length)&&(null===(F=ex.teams)||void 0===F?void 0:F.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(R=ex.teams)||void 0===R?void 0:R.slice(0,eF?ex.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eF&&(null===(M=ex.teams)||void 0===M?void 0:M.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!0),children:["+",ex.teams.length-20," more"]}),eF&&(null===(K=ex.teams)||void 0===K?void 0:K.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(q=ex.user_info)||void 0===q?void 0:null===(V=q.models)||void 0===V?void 0:V.length)&&(null===(J=ex.user_info)||void 0===J?void 0:null===(G=J.models)||void 0===G?void 0:G.length)>0?null===(H=ex.user_info)||void 0===H?void 0:null===(Q=H.models)||void 0===Q?void 0:Q.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Virtual Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===($=ex.keys)||void 0===$?void 0:$.length)&&(null===(W=ex.keys)||void 0===W?void 0:W.length)>0?ex.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(eg.xv,{children:"No Virtual Keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(eg.xv,{children:(null===(Y=ex.user_info)||void 0===Y?void 0:Y.max_budget)!==null&&(null===(es=ex.user_info)||void 0===es?void 0:es.max_budget)!==void 0?"$".concat((0,O.pw)(ex.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(eg.xv,{children:(0,k.m)(null!==(ea=null===(el=ex.user_info)||void 0===el?void 0:el.budget_duration)&&void 0!==ea?ea:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(et=ex.user_info)||void 0===et?void 0:et.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(T.Z,{isInvitationLinkModalVisible:eU,setIsInvitationLinkModalVisible:eI,baseUrl:eA||"",invitationLinkData:eD,modalType:"resetPassword"})]})}var ey=l(56083),e_=l(51205),eb=l(57716),eN=l(73247),eS=l(92369),eZ=l(66344);function ew(e){let{data:s=[],columns:l,isLoading:a=!1,onSortChange:r,currentSort:n,accessToken:d,userRole:o,possibleUIRoles:c,handleEdit:u,handleDelete:m,handleResetPassword:x,selectedUsers:h=[],onSelectionChange:g,enableSelection:v=!1,filters:j,updateFilters:p,initialFilters:f,teams:y,userListResponse:b,currentPage:N,handlePageChange:S}=e,[Z,w]=i.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[k,C]=i.useState(null),[U,I]=i.useState(!1),[D,z]=i.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},B=(e,s)=>{g&&(s?g([...h,e]):g(h.filter(s=>s.user_id!==e.user_id)))},E=e=>{g&&(e?g(s):g([]))},T=e=>h.some(s=>s.user_id===e.user_id),O=s.length>0&&h.length===s.length,L=h.length>0&&h.lengthc?es(c,u,m,x,A,v?{selectedUsers:h,onSelectUser:B,onSelectAll:E,isUserSelected:T,isAllSelected:O,isIndeterminate:L}:void 0):l,[c,u,m,x,A,l,v,h,O,L]),R=(0,el.b7)({data:s,columns:F,state:{sorting:Z},onSortingChange:e=>{let s="function"==typeof e?e(Z):e;if(w(s),s&&Array.isArray(s)&&s.length>0&&s[0]){let e=s[0];if(e.id){let s=e.id,l=e.desc?"desc":"asc";null==r||r(s,l)}}else null==r||r("created_at","desc")},getCoreRowModel:(0,et.sC)(),manualSorting:!0,enableSorting:!0});return(i.useEffect(()=>{n&&w([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),k)?(0,t.jsx)(ef,{userId:k,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:o,possibleUIRoles:c,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(ey.H,{placeholder:"Search by email...",value:j.email,onChange:e=>p({email:e}),icon:eN.Z}),(0,t.jsx)(e_.c,{onClick:()=>z(!D),active:D,hasActiveFilters:!!(j.user_id||j.user_role||j.team)}),(0,t.jsx)(eb.z,{onClick:()=>{p(f)}})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)(ey.H,{placeholder:"Filter by User ID",value:j.user_id,onChange:e=>p({user_id:e}),icon:eS.Z}),(0,t.jsx)(ey.H,{placeholder:"Filter by SSO ID",value:j.sso_user_id,onChange:e=>p({sso_user_id:e}),icon:eZ.Z}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:c&&Object.entries(c).map(e=>{let[s,l]=e;return(0,t.jsx)(_.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:null==y?void 0:y.map(e=>(0,t.jsx)(_.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[a?(0,t.jsx)(eh.Z.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",b&&b.users&&b.users.length>0?(b.page-1)*b.page_size+1:0," ","-"," ",b&&b.users?Math.min(b.page*b.page_size,b.total):0," ","of ",b?b.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>S(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(N+1),disabled:!b||N>=b.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!b||N>=b.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(ei.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ed.Z,{children:R.getHeaderGroups().map(e=>(0,t.jsx)(ec.Z,{children:e.headers.map(e=>(0,t.jsx)(eo.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""," ").concat(e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""),onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,el.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eu.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(em.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(er.Z,{children:a?(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?R.getRowModel().rows.map(e=>(0,t.jsx)(ec.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(en.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,el.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:ek,Title:eC}=n.default,eU={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var eI=e=>{var s,l,n;let{accessToken:d,token:o,userRole:c,userID:u,teams:m}=e,x=(0,F.NL)(),[h,g]=(0,i.useState)(1),[v,p]=(0,i.useState)(!1),[f,y]=(0,i.useState)(null),[_,b]=(0,i.useState)(!1),[N,S]=(0,i.useState)(!1),[w,k]=(0,i.useState)(null),[C,I]=(0,i.useState)("users"),[D,B]=(0,i.useState)(eU),[M,K,V]=(0,L.G)(D,{wait:300}),[q,G]=(0,i.useState)(!1),[Q,H]=(0,i.useState)(null),[$,W]=(0,i.useState)(null),[Y,X]=(0,i.useState)([]),[ee,el]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(!1),[ei,er]=(0,i.useState)([]),en=e=>{k(e),b(!0)};(0,i.useEffect)(()=>()=>{V.cancel()},[V]),(0,i.useEffect)(()=>{W((0,j.getProxyBaseUrl)())},[]),(0,i.useEffect)(()=>{(async()=>{try{if(!u||!c||!d)return;let e=(await (0,j.modelAvailableCall)(d,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),er(e)}catch(e){console.error("Error fetching user models:",e)}})()},[d,u,c]);let ed=e=>{B(s=>{let l={...s,...e};return K(l),l})},eo=async e=>{if(!d){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(d,e);H(s),G(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},ec=async()=>{if(w&&d)try{S(!0),await (0,j.userDeleteCall)(d,[w.user_id]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==w.user_id);return{...e,users:s}}),U.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{b(!1),k(null),S(!1)}},eu=async()=>{y(null),p(!1)},em=async e=>{if(console.log("inside handleEditSubmit:",e),d&&o&&c&&u){try{let s=await (0,j.userUpdateUserCall)(d,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,O.nl)(e,s.data):e);return{...e,users:l}}),U.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}y(null),p(!1)}},ex=async e=>{g(e)},eg=(0,R.a)({queryKey:["userList",{debouncedFilter:M,currentPage:h}],queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.userListCall)(d,M.user_id?[M.user_id]:null,h,25,M.email||null,M.user_role||null,M.team||null,M.sso_user_id||null,M.sort_by,M.sort_order)},enabled:!!(d&&o&&c&&u),placeholderData:e=>e}),ev=eg.data,ej=(0,R.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(d)},enabled:!!(d&&o&&c&&u)}).data,ep=es(ej,e=>{y(e),p(!0)},en,eo,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eg.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z,{userID:u,accessToken:d,teams:m,possibleUIRoles:ej}),(0,t.jsx)(r.z,{onClick:()=>{ea(!et),X([])},variant:et?"primary":"secondary",className:"flex items-center",children:et?"Cancel Selection":"Select Users"}),et&&(0,t.jsxs)(r.z,{onClick:()=>{if(0===Y.length){U.Z.fromBackend("Please select users to edit");return}el(!0)},disabled:0===Y.length,className:"flex items-center",children:["Bulk Edit (",Y.length," selected)"]})]}):null})}),(0,t.jsxs)(a.v0,{defaultIndex:0,onIndexChange:e=>I(0===e?"users":"settings"),children:[(0,t.jsxs)(a.td,{className:"mb-4",children:[(0,t.jsx)(a.OK,{children:"Users"}),(0,t.jsx)(a.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(a.nP,{children:[(0,t.jsx)(a.x4,{children:(0,t.jsx)(ew,{data:(null===(s=eg.data)||void 0===s?void 0:s.users)||[],columns:ep,isLoading:eg.isLoading,accessToken:d,userRole:c,onSortChange:(e,s)=>{ed({sort_by:e,sort_order:s})},currentSort:{sortBy:D.sort_by,sortOrder:D.sort_order},possibleUIRoles:ej,handleEdit:e=>{y(e),p(!0)},handleDelete:en,handleResetPassword:eo,enableSelection:et,selectedUsers:Y,onSelectionChange:e=>{X(e)},filters:D,updateFilters:ed,initialFilters:eU,teams:m,userListResponse:ev,currentPage:h,handlePageChange:ex})}),(0,t.jsx)(a.x4,{children:u&&c&&d?(0,t.jsx)(J,{accessToken:d,possibleUIRoles:ej,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(eh.Z,{active:!0,paragraph:{rows:4}})})})]})]}),(0,t.jsx)(E,{visible:v,possibleUIRoles:ej,onCancel:eu,user:f,onSubmit:em}),(0,t.jsx)(P.Z,{isOpen:_,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null==w?void 0:w.user_email},{label:"User ID",value:null==w?void 0:w.user_id,code:!0},{label:"Global Proxy Role",value:w&&(null==ej?void 0:null===(l=ej[w.user_role])||void 0===l?void 0:l.ui_label)||(null==w?void 0:w.user_role)||"-"},{label:"Total Spend (USD)",value:null==w?void 0:null===(n=w.spend)||void 0===n?void 0:n.toFixed(2)}],onCancel:()=>{b(!1),k(null)},onOk:ec,confirmLoading:N}),(0,t.jsx)(T.Z,{isInvitationLinkModalVisible:q,setIsInvitationLinkModalVisible:G,baseUrl:$||"",invitationLinkData:Q,modalType:"resetPassword"}),(0,t.jsx)(z,{visible:ee,onCancel:()=>el(!1),selectedUsers:Y,possibleUIRoles:ej,accessToken:d,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),X([]),ea(!1)},teams:m,userRole:c,userModels:ei,allowAllUsers:!!c&&(0,Z.tY)(c)})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6653],{88913:function(e,s,l){l.d(s,{Dx:function(){return d.Z},Zb:function(){return a.Z},iz:function(){return i.Z},oi:function(){return n.Z},xv:function(){return r.Z},zx:function(){return t.Z}});var t=l(78489),a=l(12514),i=l(67982),r=l(84264),n=l(49566),d=l(96761)},86653:function(e,s,l){l.d(s,{Z:function(){return eI}});var t=l(57437),a=l(58643),i=l(2265),r=l(16312),n=l(57840),d=l(42264),o=l(22116),c=l(61994),u=l(56609),m=l(23496),x=l(5945),h=l(58760),g=l(37592),v=l(19015),j=l(19250),p=l(10032),f=l(99981),y=l(24199),_=l(57365),b=l(49566),N=l(16853),S=l(46468),Z=l(20347),w=l(15424),k=l(65925);function C(e){let{userData:s,onCancel:l,onSubmit:a,teams:n,accessToken:d,userID:o,userRole:c,userModels:u,possibleUIRoles:m,isBulkEdit:x=!1}=e,[h]=p.Z.useForm();return i.useEffect(()=>{var e,l,t,a,i,r,n;h.setFieldsValue({user_id:s.user_id,user_email:null===(e=s.user_info)||void 0===e?void 0:e.user_email,user_alias:null===(l=s.user_info)||void 0===l?void 0:l.user_alias,user_role:null===(t=s.user_info)||void 0===t?void 0:t.user_role,models:(null===(a=s.user_info)||void 0===a?void 0:a.models)||[],max_budget:null===(i=s.user_info)||void 0===i?void 0:i.max_budget,budget_duration:null===(r=s.user_info)||void 0===r?void 0:r.budget_duration,metadata:(null===(n=s.user_info)||void 0===n?void 0:n.metadata)?JSON.stringify(s.user_info.metadata,null,2):void 0})},[s,h]),(0,t.jsxs)(p.Z,{form:h,onFinish:e=>{if(e.metadata&&"string"==typeof e.metadata)try{e.metadata=JSON.parse(e.metadata)}catch(e){console.error("Error parsing metadata JSON:",e);return}a(e)},layout:"vertical",children:[!x&&(0,t.jsx)(p.Z.Item,{label:"User ID",name:"user_id",children:(0,t.jsx)(b.Z,{disabled:!0})}),!x&&(0,t.jsx)(p.Z.Item,{label:"Email",name:"user_email",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Alias",name:"user_alias",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Global Proxy Role"," ",(0,t.jsx)(f.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,t.jsx)(w.Z,{})})]}),name:"user_role",children:(0,t.jsx)(g.default,{children:m&&Object.entries(m).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(_.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:(0,t.jsxs)("span",{children:["Personal Models"," ",(0,t.jsx)(f.Z,{title:"Select which models this user can access outside of team-scope. Choose 'All Proxy Models' to grant access to all models available on the proxy.",children:(0,t.jsx)(w.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,t.jsxs)(g.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:!Z.ZL.includes(c||""),children:[(0,t.jsx)(g.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,t.jsx)(g.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),u.map(e=>(0,t.jsx)(g.default.Option,{value:e,children:(0,S.W0)(e)},e))]})}),(0,t.jsx)(p.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,t.jsx)(y.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"Metadata",name:"metadata",children:(0,t.jsx)(N.Z,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,t.jsx)(r.z,{variant:"secondary",type:"button",onClick:l,children:"Cancel"}),(0,t.jsx)(r.z,{type:"submit",children:"Save Changes"})]})]})}var U=l(9114);let{Text:I,Title:D}=n.default;var z=e=>{let{visible:s,onCancel:l,selectedUsers:a,possibleUIRoles:r,accessToken:n,onSuccess:p,teams:f,userRole:y,userModels:_,allowAllUsers:b=!1}=e,[N,S]=(0,i.useState)(!1),[Z,w]=(0,i.useState)([]),[k,z]=(0,i.useState)(null),[A,B]=(0,i.useState)(!1),[E,T]=(0,i.useState)(!1),O=()=>{w([]),z(null),B(!1),T(!1),l()},L=i.useMemo(()=>({user_id:"bulk_edit",user_info:{user_email:"",user_role:"",teams:[],models:[],max_budget:null,spend:0,metadata:{},created_at:null,updated_at:null},keys:[],teams:f||[]}),[f,s]),F=async e=>{if(console.log("formValues",e),!n){U.Z.fromBackend("Access token not found");return}S(!0);try{let s=a.map(e=>e.user_id),t={};e.user_role&&""!==e.user_role&&(t.user_role=e.user_role),null!==e.max_budget&&void 0!==e.max_budget&&(t.max_budget=e.max_budget),e.models&&e.models.length>0&&(t.models=e.models),e.budget_duration&&""!==e.budget_duration&&(t.budget_duration=e.budget_duration),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata=e.metadata);let i=Object.keys(t).length>0,r=A&&Z.length>0;if(!i&&!r){U.Z.fromBackend("Please modify at least one field or select teams to add users to");return}let o=[];if(i){if(E){let e=await (0,j.userBulkUpdateUserCall)(n,t,void 0,!0);o.push("Updated all users (".concat(e.total_requested," total)"))}else await (0,j.userBulkUpdateUserCall)(n,t,s),o.push("Updated ".concat(s.length," user(s)"))}if(r){let e=[];for(let s of Z)try{let l=null;E?l=null:a.map(e=>({user_id:e.user_id,role:"user",user_email:e.user_email||null}));let t=await (0,j.teamBulkMemberAddCall)(n,s,l||null,k||void 0,E);console.log("result",t),e.push({teamId:s,success:!0,successfulAdditions:t.successful_additions,failedAdditions:t.failed_additions})}catch(l){console.error("Failed to add users to team ".concat(s,":"),l),e.push({teamId:s,success:!1,error:l})}let s=e.filter(e=>e.success),l=e.filter(e=>!e.success);if(s.length>0){let e=s.reduce((e,s)=>e+s.successfulAdditions,0);o.push("Added users to ".concat(s.length," team(s) (").concat(e," total additions)"))}l.length>0&&d.ZP.warning("Failed to add users to ".concat(l.length," team(s)"))}o.length>0&&U.Z.success(o.join(". ")),w([]),z(null),B(!1),T(!1),p(),l()}catch(e){console.error("Bulk operation failed:",e),U.Z.fromBackend("Failed to perform bulk operations")}finally{S(!1)}};return(0,t.jsxs)(o.Z,{visible:s,onCancel:O,footer:null,title:E?"Bulk Edit All Users":"Bulk Edit ".concat(a.length," User(s)"),width:800,children:[b&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(c.Z,{checked:E,onChange:e=>T(e.target.checked),children:(0,t.jsx)(I,{strong:!0,children:"Update ALL users in the system"})}),E&&(0,t.jsx)("div",{style:{marginTop:8},children:(0,t.jsx)(I,{type:"warning",style:{fontSize:"12px"},children:"⚠️ This will apply changes to ALL users in the system, not just the selected ones."})})]}),!E&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)(D,{level:5,children:["Selected Users (",a.length,"):"]}),(0,t.jsx)(u.Z,{size:"small",bordered:!0,dataSource:a,pagination:!1,scroll:{y:200},rowKey:"user_id",columns:[{title:"User ID",dataIndex:"user_id",key:"user_id",width:"30%",render:e=>(0,t.jsx)(I,{strong:!0,style:{fontSize:"12px"},children:e.length>20?"".concat(e.slice(0,20),"..."):e})},{title:"Email",dataIndex:"user_email",key:"user_email",width:"25%",render:e=>(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:e||"No email"})},{title:"Current Role",dataIndex:"user_role",key:"user_role",width:"25%",render:e=>{var s;return(0,t.jsx)(I,{style:{fontSize:"12px"},children:(null==r?void 0:null===(s=r[e])||void 0===s?void 0:s.ui_label)||e})}},{title:"Budget",dataIndex:"max_budget",key:"max_budget",width:"20%",render:e=>(0,t.jsx)(I,{style:{fontSize:"12px"},children:null!==e?"$".concat(e):"Unlimited"})}]})]}),(0,t.jsx)(m.Z,{}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(I,{children:[(0,t.jsx)("strong",{children:"Instructions:"})," Fill in the fields below with the values you want to apply to all selected users. You can bulk edit: role, budget, models, and metadata. You can also add users to teams."]})}),(0,t.jsx)(x.Z,{title:"Team Management",size:"small",className:"mb-4",style:{backgroundColor:"#fafafa"},children:(0,t.jsxs)(h.Z,{direction:"vertical",style:{width:"100%"},children:[(0,t.jsx)(c.Z,{checked:A,onChange:e=>B(e.target.checked),children:"Add selected users to teams"}),A&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Select Teams:"}),(0,t.jsx)(g.default,{mode:"multiple",placeholder:"Select teams to add users to",value:Z,onChange:w,style:{width:"100%",marginTop:8},options:(null==f?void 0:f.map(e=>({label:e.team_alias||e.team_id,value:e.team_id})))||[]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(I,{strong:!0,children:"Team Budget (Optional):"}),(0,t.jsx)(v.Z,{placeholder:"Max budget per user in team",value:k,onChange:e=>z(e),style:{width:"100%",marginTop:8},min:0,step:.01,precision:2}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:"Leave empty for unlimited budget within team limits"})]}),(0,t.jsx)(I,{type:"secondary",style:{fontSize:"12px"},children:'Users will be added with "user" role by default. All users will be added to each selected team.'})]})]})}),(0,t.jsx)(C,{userData:L,onCancel:O,onSubmit:F,teams:f,accessToken:n,userID:"bulk_edit",userRole:y,userModels:_,possibleUIRoles:r,isBulkEdit:!0}),N&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,t.jsxs)(I,{children:["Updating ",E?"all users":a.length," user(s)..."]})})]})},A=l(7765),B=l(5545),E=e=>{let{visible:s,possibleUIRoles:l,onCancel:a,user:r,onSubmit:n}=e,[d,c]=(0,i.useState)(r),[u]=p.Z.useForm();(0,i.useEffect)(()=>{u.resetFields()},[r]);let m=async()=>{u.resetFields(),a()},x=async e=>{n(e),u.resetFields(),a()};return r?(0,t.jsx)(o.Z,{visible:s,onCancel:m,footer:null,title:"Edit User "+r.user_id,width:1e3,children:(0,t.jsx)(p.Z,{form:u,onFinish:x,initialValues:r,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)(p.Z.Item,{label:"User Role",name:"user_role",children:(0,t.jsx)(g.default,{children:l&&Object.entries(l).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(_.Z,{value:s,title:l,children:(0,t.jsxs)("div",{className:"flex",children:[l," ",(0,t.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,t.jsx)(p.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",help:"Across all keys (including keys with team_id).",children:(0,t.jsx)(v.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",help:"Maximum budget of this user.",children:(0,t.jsx)(y.Z,{min:0,step:.01})}),(0,t.jsx)(p.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,t.jsx)(k.Z,{})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})}),(0,t.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,t.jsx)(B.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},T=l(98187),O=l(59872),L=l(19616),F=l(29827),R=l(11713),P=l(21609),M=l(88913),K=l(63709),V=l(10353),q=l(26349),G=l(96473),J=e=>{var s;let{accessToken:l,possibleUIRoles:a,userID:r,userRole:d}=e,[o,c]=(0,i.useState)(!0),[u,m]=(0,i.useState)(null),[x,h]=(0,i.useState)(!1),[p,f]=(0,i.useState)({}),[y,_]=(0,i.useState)(!1),[b,N]=(0,i.useState)([]),{Paragraph:Z}=n.default,{Option:w}=g.default;(0,i.useEffect)(()=>{(async()=>{if(!l){c(!1);return}try{let e=await (0,j.getInternalUserSettings)(l);if(m(e),f(e.values||{}),l)try{let e=await (0,j.modelAvailableCall)(l,r,d);if(e&&e.data){let s=e.data.map(e=>e.id);N(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching SSO settings:",e),U.Z.fromBackend("Failed to fetch SSO settings")}finally{c(!1)}})()},[l]);let C=async()=>{if(l){_(!0);try{let e=Object.entries(p).reduce((e,s)=>{let[l,t]=s;return e[l]=""===t?null:t,e},{}),s=await (0,j.updateInternalUserSettings)(l,e);m({...u,values:s.settings}),h(!1)}catch(e){console.error("Error updating SSO settings:",e),U.Z.fromBackend("Failed to update settings: "+e)}finally{_(!1)}}},I=(e,s)=>{f(l=>({...l,[e]:s}))},D=e=>e&&Array.isArray(e)?e.map(e=>"string"==typeof e?{team_id:e,user_role:"user"}:"object"==typeof e&&e.team_id?{team_id:e.team_id,max_budget_in_team:e.max_budget_in_team,user_role:e.user_role||"user"}:{team_id:"",user_role:"user"}):[],z=e=>{let s=D(e),l=(e,l,t)=>{let a=[...s];a[e]={...a[e],[l]:t},I("teams",a)},a=e=>{I("teams",s.filter((s,l)=>l!==e))};return(0,t.jsxs)("div",{className:"space-y-3",children:[s.map((e,s)=>(0,t.jsxs)("div",{className:"border rounded-lg p-4 bg-gray-50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)(M.xv,{className:"font-medium",children:["Team ",s+1]}),(0,t.jsx)(M.zx,{size:"sm",variant:"secondary",icon:q.Z,onClick:()=>a(s),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"Team ID"}),(0,t.jsx)(M.oi,{value:e.team_id,onChange:e=>l(s,"team_id",e.target.value),placeholder:"Enter team ID"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"Max Budget in Team"}),(0,t.jsx)(v.Z,{style:{width:"100%"},value:e.max_budget_in_team,onChange:e=>l(s,"max_budget_in_team",e),placeholder:"Optional",min:0,step:.01,precision:2})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(M.xv,{className:"text-sm font-medium mb-1",children:"User Role"}),(0,t.jsxs)(g.default,{style:{width:"100%"},value:e.user_role,onChange:e=>l(s,"user_role",e),children:[(0,t.jsx)(w,{value:"user",children:"User"}),(0,t.jsx)(w,{value:"admin",children:"Admin"})]})]})]})]},s)),(0,t.jsx)(M.zx,{variant:"secondary",icon:G.Z,onClick:()=>{I("teams",[...s,{team_id:"",user_role:"user"}])},className:"w-full",children:"Add Team"})]})},A=(e,s,l)=>{var i;let r=s.type;if("teams"===e)return(0,t.jsx)("div",{className:"mt-2",children:z(p[e]||[])});if("user_role"===e&&a)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:Object.entries(a).filter(e=>{let[s]=e;return s.includes("internal_user")}).map(e=>{let[s,{ui_label:l,description:a}]=e;return(0,t.jsx)(w,{value:s,children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:a})]})},s)})});if("budget_duration"===e)return(0,t.jsx)(k.Z,{value:p[e]||null,onChange:s=>I(e,s),className:"mt-2"});if("boolean"===r)return(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(K.Z,{checked:!!p[e],onChange:s=>I(e,s)})});if("array"===r&&(null===(i=s.items)||void 0===i?void 0:i.enum))return(0,t.jsx)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});if("models"===e)return(0,t.jsxs)(g.default,{mode:"multiple",style:{width:"100%"},value:p[e]||[],onChange:s=>I(e,s),className:"mt-2",children:[(0,t.jsx)(w,{value:"no-default-models",children:"No Default Models"},"no-default-models"),(0,t.jsx)(w,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),b.map(e=>(0,t.jsx)(w,{value:e,children:(0,S.W0)(e)},e))]});if("string"===r&&s.enum)return(0,t.jsx)(g.default,{style:{width:"100%"},value:p[e]||"",onChange:s=>I(e,s),className:"mt-2",children:s.enum.map(e=>(0,t.jsx)(w,{value:e,children:e},e))});else return(0,t.jsx)(M.oi,{value:void 0!==p[e]?String(p[e]):"",onChange:s=>I(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},B=(e,s)=>{if(null==s)return(0,t.jsx)("span",{className:"text-gray-400",children:"Not set"});if("teams"===e&&Array.isArray(s)){if(0===s.length)return(0,t.jsx)("span",{className:"text-gray-400",children:"No teams assigned"});let e=D(s);return(0,t.jsx)("div",{className:"space-y-2 mt-1",children:e.map((e,s)=>(0,t.jsx)("div",{className:"border rounded-lg p-3 bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Team ID:"}),(0,t.jsx)("p",{className:"text-gray-900",children:e.team_id||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Max Budget:"}),(0,t.jsx)("p",{className:"text-gray-900",children:void 0!==e.max_budget_in_team?"$".concat((0,O.pw)(e.max_budget_in_team,4)):"No limit"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium text-gray-600",children:"Role:"}),(0,t.jsx)("p",{className:"text-gray-900 capitalize",children:e.user_role})]})]})},s))})}if("user_role"===e&&a&&a[s]){let{ui_label:e,description:l}=a[s];return(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:e}),l&&(0,t.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:l})]})}return"budget_duration"===e?(0,t.jsx)("span",{children:(0,k.m)(s)}):"boolean"==typeof s?(0,t.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,S.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,t.jsx)("span",{className:"text-gray-400",children:"None"}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,t.jsx)("span",{children:String(s)})};return o?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(V.Z,{size:"large"})}):u?(0,t.jsxs)(M.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(M.Dx,{children:"Default User Settings"}),!o&&u&&(x?(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(M.zx,{variant:"secondary",onClick:()=>{h(!1),f(u.values||{})},disabled:y,children:"Cancel"}),(0,t.jsx)(M.zx,{onClick:C,loading:y,children:"Save Changes"})]}):(0,t.jsx)(M.zx,{onClick:()=>h(!0),children:"Edit Settings"}))]}),(null==u?void 0:null===(s=u.field_schema)||void 0===s?void 0:s.description)&&(0,t.jsx)(Z,{className:"mb-4",children:u.field_schema.description}),(0,t.jsx)(M.iz,{}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=u;return s&&s.properties?Object.entries(s.properties).map(s=>{let[l,a]=s,i=e[l],r=l.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,t.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,t.jsx)(M.xv,{className:"font-medium text-lg",children:r}),(0,t.jsx)(Z,{className:"text-sm text-gray-500 mt-1",children:a.description||"No description available"}),x?(0,t.jsx)("div",{className:"mt-2",children:A(l,a,i)}):(0,t.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:B(l,i)})]},l)}):(0,t.jsx)(M.xv,{children:"No schema information available"})})()})]}):(0,t.jsx)(M.Zb,{children:(0,t.jsx)(M.xv,{children:"No settings available or you do not have permission to view them."})})},Q=l(41649),H=l(67101),$=l(47323),W=l(15731),Y=l(53410),X=l(74998),ee=l(23628);let es=(e,s,l,a,i,r)=>{let n=[{header:"User ID",accessorKey:"user_id",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)(f.Z,{title:s.original.user_id,children:(0,t.jsx)("span",{className:"text-xs",children:s.original.user_id?"".concat(s.original.user_id.slice(0,7),"..."):"-"})})}},{header:"Email",accessorKey:"user_email",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_email||"-"})}},{header:"Global Proxy Role",accessorKey:"user_role",enableSorting:!0,cell:s=>{var l;let{row:a}=s;return(0,t.jsx)("span",{className:"text-xs",children:(null==e?void 0:null===(l=e[a.original.user_role])||void 0===l?void 0:l.ui_label)||"-"})}},{header:"User Alias",accessorKey:"user_alias",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.user_alias||"-"})}},{header:"Spend (USD)",accessorKey:"spend",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.spend?(0,O.pw)(s.original.spend,4):"-"})}},{header:"Budget (USD)",accessorKey:"max_budget",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.max_budget?s.original.max_budget:"Unlimited"})}},{header:()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"SSO ID"}),(0,t.jsx)(f.Z,{title:"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",children:(0,t.jsx)(W.Z,{className:"w-4 h-4"})})]}),accessorKey:"sso_user_id",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:null!==s.original.sso_user_id?s.original.sso_user_id:"-"})}},{header:"Virtual Keys",accessorKey:"key_count",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)(H.Z,{numItems:2,children:s.original.key_count>0?(0,t.jsxs)(Q.Z,{size:"xs",color:"indigo",children:[s.original.key_count," ",1===s.original.key_count?"Key":"Keys"]}):(0,t.jsx)(Q.Z,{size:"xs",color:"gray",children:"No Keys"})})}},{header:"Created At",accessorKey:"created_at",enableSorting:!0,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.created_at?new Date(s.original.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsx)("span",{className:"text-xs",children:s.original.updated_at?new Date(s.original.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",enableSorting:!1,cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.Z,{title:"Edit user details",children:(0,t.jsx)($.Z,{icon:Y.Z,size:"sm",onClick:()=>i(s.original.user_id,!0),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(f.Z,{title:"Delete user",children:(0,t.jsx)($.Z,{icon:X.Z,size:"sm",onClick:()=>l(s.original),className:"cursor-pointer hover:text-red-600"})}),(0,t.jsx)(f.Z,{title:"Reset Password",children:(0,t.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>a(s.original.user_id),className:"cursor-pointer hover:text-green-600"})})]})}}];if(r){let{onSelectUser:e,onSelectAll:s,isUserSelected:l,isAllSelected:a,isIndeterminate:i}=r;return[{id:"select",enableSorting:!1,header:()=>(0,t.jsx)(c.Z,{indeterminate:i,checked:a,onChange:e=>s(e.target.checked),onClick:e=>e.stopPropagation()}),cell:s=>{let{row:a}=s;return(0,t.jsx)(c.Z,{checked:l(a.original),onChange:s=>e(a.original,s.target.checked),onClick:e=>e.stopPropagation()})}},...n]}return n};var el=l(71594),et=l(24525),ea=l(27281),ei=l(21626),er=l(97214),en=l(28241),ed=l(58834),eo=l(69552),ec=l(71876),eu=l(44633),em=l(86462),ex=l(49084),eh=l(50337),eg=l(84717),ev=l(10900),ej=l(30401),ep=l(78867);function ef(e){var s,l,a,r,n,d,o,c,u,m,x,h,g,v,p,f,y,_,b,N,S,w,I,D,z,A,E,L,F,R,M,K,V,q,G,J,Q,H,$,W,Y,es,el,et,ea;let{userId:ei,onClose:er,accessToken:en,userRole:ed,onDelete:eo,possibleUIRoles:ec,initialTab:eu=0,startInEditMode:em=!1}=e,[ex,eh]=(0,i.useState)(null),[ef,ey]=(0,i.useState)(!1),[e_,eb]=(0,i.useState)(!1),[eN,eS]=(0,i.useState)(!0),[eZ,ew]=(0,i.useState)(em),[ek,eC]=(0,i.useState)([]),[eU,eI]=(0,i.useState)(!1),[eD,ez]=(0,i.useState)(null),[eA,eB]=(0,i.useState)(null),[eE,eT]=(0,i.useState)(eu),[eO,eL]=(0,i.useState)({}),[eF,eR]=(0,i.useState)(!1);i.useEffect(()=>{eB((0,j.getProxyBaseUrl)())},[]),i.useEffect(()=>{console.log("userId: ".concat(ei,", userRole: ").concat(ed,", accessToken: ").concat(en)),(async()=>{try{if(!en)return;let e=await (0,j.userInfoCall)(en,ei,ed||"",!1,null,null,!0);eh(e);let s=(await (0,j.modelAvailableCall)(en,ei,ed||"")).data.map(e=>e.id);eC(s)}catch(e){console.error("Error fetching user data:",e),U.Z.fromBackend("Failed to fetch user data")}finally{eS(!1)}})()},[en,ei,ed]);let eP=async()=>{if(!en){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let e=await (0,j.invitationCreateCall)(en,ei);ez(e),eI(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},eM=async()=>{try{if(!en)return;eb(!0),await (0,j.userDeleteCall)(en,[ei]),U.Z.success("User deleted successfully"),eo&&eo(),er()}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{ey(!1),eb(!1)}},eK=async e=>{try{if(!en||!ex)return;await (0,j.userUpdateUserCall)(en,e,null),eh({...ex,user_info:{...ex.user_info,user_email:e.user_email,user_alias:e.user_alias,models:e.models,max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:e.metadata}}),U.Z.success("User updated successfully"),ew(!1)}catch(e){console.error("Error updating user:",e),U.Z.fromBackend("Failed to update user")}};if(eN)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"Loading user data..."})]});if(!ex)return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.xv,{children:"User not found"})]});let eV=async(e,s)=>{await (0,O.vQ)(e)&&(eL(e=>({...e,[s]:!0})),setTimeout(()=>{eL(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.zx,{icon:ev.Z,variant:"light",onClick:er,className:"mb-4",children:"Back to Users"}),(0,t.jsx)(eg.Dx,{children:(null===(s=ex.user_info)||void 0===s?void 0:s.user_email)||"User"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"text-gray-500 font-mono",children:ex.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eO["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eV(ex.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eO["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),ed&&Z.LQ.includes(ed)&&(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(eg.zx,{icon:ee.Z,variant:"secondary",onClick:eP,className:"flex items-center",children:"Reset Password"}),(0,t.jsx)(eg.zx,{icon:X.Z,variant:"secondary",onClick:()=>ey(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-600 hover:border-red-600",children:"Delete User"})]})]}),(0,t.jsx)(P.Z,{isOpen:ef,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null===(l=ex.user_info)||void 0===l?void 0:l.user_email},{label:"User ID",value:ex.user_id,code:!0},{label:"Global Proxy Role",value:(null===(a=ex.user_info)||void 0===a?void 0:a.user_role)&&(null==ec?void 0:null===(r=ec[ex.user_info.user_role])||void 0===r?void 0:r.ui_label)||(null===(n=ex.user_info)||void 0===n?void 0:n.user_role)||"-"},{label:"Total Spend (USD)",value:(null===(d=ex.user_info)||void 0===d?void 0:d.spend)!==null&&(null===(o=ex.user_info)||void 0===o?void 0:o.spend)!==void 0?ex.user_info.spend.toFixed(2):void 0}],onCancel:()=>{ey(!1)},onOk:eM,confirmLoading:e_}),(0,t.jsxs)(eg.v0,{defaultIndex:eE,onIndexChange:eT,children:[(0,t.jsxs)(eg.td,{className:"mb-4",children:[(0,t.jsx)(eg.OK,{children:"Overview"}),(0,t.jsx)(eg.OK,{children:"Details"})]}),(0,t.jsxs)(eg.nP,{children:[(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Spend"}),(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)(eg.Dx,{children:["$",(0,O.pw)((null===(c=ex.user_info)||void 0===c?void 0:c.spend)||0,4)]}),(0,t.jsxs)(eg.xv,{children:["of"," ",(null===(u=ex.user_info)||void 0===u?void 0:u.max_budget)!==null?"$".concat((0,O.pw)(ex.user_info.max_budget,4)):"Unlimited"]})]})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Teams"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(m=ex.teams)||void 0===m?void 0:m.length)&&(null===(x=ex.teams)||void 0===x?void 0:x.length)>0?(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[null===(h=ex.teams)||void 0===h?void 0:h.slice(0,eF?ex.teams.length:20).map((e,s)=>(0,t.jsx)(eg.Ct,{color:"blue",title:e.team_alias,children:e.team_alias},s)),!eF&&(null===(g=ex.teams)||void 0===g?void 0:g.length)>20&&(0,t.jsxs)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!0),children:["+",ex.teams.length-20," more"]}),eF&&(null===(v=ex.teams)||void 0===v?void 0:v.length)>20&&(0,t.jsx)(eg.Ct,{color:"gray",className:"cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Virtual Keys"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)(eg.xv,{children:[(null===(p=ex.keys)||void 0===p?void 0:p.length)||0," ",(null===(f=ex.keys)||void 0===f?void 0:f.length)===1?"Key":"Keys"]})})]}),(0,t.jsxs)(eg.Zb,{children:[(0,t.jsx)(eg.xv,{children:"Personal Models"}),(0,t.jsx)("div",{className:"mt-2",children:(null===(_=ex.user_info)||void 0===_?void 0:null===(y=_.models)||void 0===y?void 0:y.length)&&(null===(N=ex.user_info)||void 0===N?void 0:null===(b=N.models)||void 0===b?void 0:b.length)>0?null===(w=ex.user_info)||void 0===w?void 0:null===(S=w.models)||void 0===S?void 0:S.map((e,s)=>(0,t.jsx)(eg.xv,{children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]})]})}),(0,t.jsx)(eg.x4,{children:(0,t.jsxs)(eg.Zb,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(eg.Dx,{children:"User Settings"}),!eZ&&ed&&Z.LQ.includes(ed)&&(0,t.jsx)(eg.zx,{onClick:()=>ew(!0),children:"Edit Settings"})]}),eZ&&ex?(0,t.jsx)(C,{userData:ex,onCancel:()=>ew(!1),onSubmit:eK,teams:ex.teams,accessToken:en,userID:ei,userRole:ed,userModels:ek,possibleUIRoles:ec}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User ID"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(eg.xv,{className:"font-mono",children:ex.user_id}),(0,t.jsx)(B.ZP,{type:"text",size:"small",icon:eO["user-id"]?(0,t.jsx)(ej.Z,{size:12}):(0,t.jsx)(ep.Z,{size:12}),onClick:()=>eV(ex.user_id,"user-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eO["user-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Email"}),(0,t.jsx)(eg.xv,{children:(null===(I=ex.user_info)||void 0===I?void 0:I.user_email)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"User Alias"}),(0,t.jsx)(eg.xv,{children:(null===(D=ex.user_info)||void 0===D?void 0:D.user_alias)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Global Proxy Role"}),(0,t.jsx)(eg.xv,{children:(null===(z=ex.user_info)||void 0===z?void 0:z.user_role)||"Not Set"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Created"}),(0,t.jsx)(eg.xv,{children:(null===(A=ex.user_info)||void 0===A?void 0:A.created_at)?new Date(ex.user_info.created_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Last Updated"}),(0,t.jsx)(eg.xv,{children:(null===(E=ex.user_info)||void 0===E?void 0:E.updated_at)?new Date(ex.user_info.updated_at).toLocaleString():"Unknown"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(L=ex.teams)||void 0===L?void 0:L.length)&&(null===(F=ex.teams)||void 0===F?void 0:F.length)>0?(0,t.jsxs)(t.Fragment,{children:[null===(R=ex.teams)||void 0===R?void 0:R.slice(0,eF?ex.teams.length:20).map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",title:e.team_alias||e.team_id,children:e.team_alias||e.team_id},s)),!eF&&(null===(M=ex.teams)||void 0===M?void 0:M.length)>20&&(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!0),children:["+",ex.teams.length-20," more"]}),eF&&(null===(K=ex.teams)||void 0===K?void 0:K.length)>20&&(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs cursor-pointer hover:bg-gray-200 transition-colors",onClick:()=>eR(!1),children:"Show Less"})]}):(0,t.jsx)(eg.xv,{children:"No teams"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Personal Models"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===(q=ex.user_info)||void 0===q?void 0:null===(V=q.models)||void 0===V?void 0:V.length)&&(null===(J=ex.user_info)||void 0===J?void 0:null===(G=J.models)||void 0===G?void 0:G.length)>0?null===(H=ex.user_info)||void 0===H?void 0:null===(Q=H.models)||void 0===Q?void 0:Q.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:e},s)):(0,t.jsx)(eg.xv,{children:"All proxy models"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Virtual Keys"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:(null===($=ex.keys)||void 0===$?void 0:$.length)&&(null===(W=ex.keys)||void 0===W?void 0:W.length)>0?ex.keys.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-green-100 rounded text-xs",children:e.key_alias||e.token},s)):(0,t.jsx)(eg.xv,{children:"No Virtual Keys"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Max Budget"}),(0,t.jsx)(eg.xv,{children:(null===(Y=ex.user_info)||void 0===Y?void 0:Y.max_budget)!==null&&(null===(es=ex.user_info)||void 0===es?void 0:es.max_budget)!==void 0?"$".concat((0,O.pw)(ex.user_info.max_budget,4)):"Unlimited"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Budget Reset"}),(0,t.jsx)(eg.xv,{children:(0,k.m)(null!==(ea=null===(el=ex.user_info)||void 0===el?void 0:el.budget_duration)&&void 0!==ea?ea:null)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eg.xv,{className:"font-medium",children:"Metadata"}),(0,t.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify((null===(et=ex.user_info)||void 0===et?void 0:et.metadata)||{},null,2)})]})]})]})})]})]}),(0,t.jsx)(T.Z,{isInvitationLinkModalVisible:eU,setIsInvitationLinkModalVisible:eI,baseUrl:eA||"",invitationLinkData:eD,modalType:"resetPassword"})]})}var ey=l(56083),e_=l(51205),eb=l(57716),eN=l(73247),eS=l(92369),eZ=l(66344);function ew(e){let{data:s=[],columns:l,isLoading:a=!1,onSortChange:r,currentSort:n,accessToken:d,userRole:o,possibleUIRoles:c,handleEdit:u,handleDelete:m,handleResetPassword:x,selectedUsers:h=[],onSelectionChange:g,enableSelection:v=!1,filters:j,updateFilters:p,initialFilters:f,teams:y,userListResponse:b,currentPage:N,handlePageChange:S}=e,[Z,w]=i.useState([{id:(null==n?void 0:n.sortBy)||"created_at",desc:(null==n?void 0:n.sortOrder)==="desc"}]),[k,C]=i.useState(null),[U,I]=i.useState(!1),[D,z]=i.useState(!1),A=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];C(e),I(s)},B=(e,s)=>{g&&(s?g([...h,e]):g(h.filter(s=>s.user_id!==e.user_id)))},E=e=>{g&&(e?g(s):g([]))},T=e=>h.some(s=>s.user_id===e.user_id),O=s.length>0&&h.length===s.length,L=h.length>0&&h.lengthc?es(c,u,m,x,A,v?{selectedUsers:h,onSelectUser:B,onSelectAll:E,isUserSelected:T,isAllSelected:O,isIndeterminate:L}:void 0):l,[c,u,m,x,A,l,v,h,O,L]),R=(0,el.b7)({data:s,columns:F,state:{sorting:Z},onSortingChange:e=>{let s="function"==typeof e?e(Z):e;if(w(s),s&&Array.isArray(s)&&s.length>0&&s[0]){let e=s[0];if(e.id){let s=e.id,l=e.desc?"desc":"asc";null==r||r(s,l)}}else null==r||r("created_at","desc")},getCoreRowModel:(0,et.sC)(),manualSorting:!0,enableSorting:!0});return(i.useEffect(()=>{n&&w([{id:n.sortBy,desc:"desc"===n.sortOrder}])},[n]),k)?(0,t.jsx)(ef,{userId:k,onClose:()=>{C(null),I(!1)},accessToken:d,userRole:o,possibleUIRoles:c,initialTab:U?1:0,startInEditMode:U}):(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)(ey.H,{placeholder:"Search by email...",value:j.email,onChange:e=>p({email:e}),icon:eN.Z}),(0,t.jsx)(e_.c,{onClick:()=>z(!D),active:D,hasActiveFilters:!!(j.user_id||j.user_role||j.team)}),(0,t.jsx)(eb.z,{onClick:()=>{p(f)}})]}),D&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,t.jsx)(ey.H,{placeholder:"Filter by User ID",value:j.user_id,onChange:e=>p({user_id:e}),icon:eS.Z}),(0,t.jsx)(ey.H,{placeholder:"Filter by SSO ID",value:j.sso_user_id,onChange:e=>p({sso_user_id:e}),icon:eZ.Z}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.user_role,onValueChange:e=>p({user_role:e}),placeholder:"Select Role",children:c&&Object.entries(c).map(e=>{let[s,l]=e;return(0,t.jsx)(_.Z,{value:s,children:l.ui_label},s)})})}),(0,t.jsx)("div",{className:"w-64",children:(0,t.jsx)(ea.Z,{value:j.team,onValueChange:e=>p({team:e}),placeholder:"Select Team",children:null==y?void 0:y.map(e=>(0,t.jsx)(_.Z,{value:e.team_id,children:e.team_alias||e.team_id},e.team_id))})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[a?(0,t.jsx)(eh.Z.Input,{active:!0,style:{width:192,height:20}}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing"," ",b&&b.users&&b.users.length>0?(b.page-1)*b.page_size+1:0," ","-"," ",b&&b.users?Math.min(b.page*b.page_size,b.total):0," ","of ",b?b.total:0," results"]}),(0,t.jsx)("div",{className:"flex space-x-2",children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:80,height:30}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"small",style:{width:60,height:30}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>S(N-1),disabled:1===N,className:"px-3 py-1 text-sm border rounded-md ".concat(1===N?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(N+1),disabled:!b||N>=b.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(!b||N>=b.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})})]})]})}),(0,t.jsx)("div",{className:"overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(ei.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(ed.Z,{children:R.getHeaderGroups().map(e=>(0,t.jsx)(ec.Z,{children:e.headers.map(e=>(0,t.jsx)(eo.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""," ").concat(e.column.getCanSort()?"cursor-pointer hover:bg-gray-50":""),onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,el.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eu.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(em.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(ex.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,t.jsx)(er.Z,{children:a?(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading users..."})})})}):s.length>0?R.getRowModel().rows.map(e=>(0,t.jsx)(ec.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(en.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:()=>{"user_id"===e.column.id&&A(e.getValue(),!1)},style:{cursor:"user_id"===e.column.id?"pointer":"default",color:"user_id"===e.column.id?"#3b82f6":"inherit"},children:(0,el.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(ec.Z,{children:(0,t.jsx)(en.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No users found"})})})})})]})})})})]})}let{Text:ek,Title:eC}=n.default,eU={email:"",user_id:"",user_role:"",sso_user_id:"",team:"",model:"",min_spend:null,max_spend:null,sort_by:"created_at",sort_order:"desc"};var eI=e=>{var s,l,n;let{accessToken:d,token:o,userRole:c,userID:u,teams:m}=e,x=(0,F.NL)(),[h,g]=(0,i.useState)(1),[v,p]=(0,i.useState)(!1),[f,y]=(0,i.useState)(null),[_,b]=(0,i.useState)(!1),[N,S]=(0,i.useState)(!1),[w,k]=(0,i.useState)(null),[C,I]=(0,i.useState)("users"),[D,B]=(0,i.useState)(eU),[M,K,V]=(0,L.G)(D,{wait:300}),[q,G]=(0,i.useState)(!1),[Q,H]=(0,i.useState)(null),[$,W]=(0,i.useState)(null),[Y,X]=(0,i.useState)([]),[ee,el]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(!1),[ei,er]=(0,i.useState)([]),en=e=>{k(e),b(!0)};(0,i.useEffect)(()=>()=>{V.cancel()},[V]),(0,i.useEffect)(()=>{W((0,j.getProxyBaseUrl)())},[]),(0,i.useEffect)(()=>{(async()=>{try{if(!u||!c||!d)return;let e=(await (0,j.modelAvailableCall)(d,u,c)).data.map(e=>e.id);console.log("available_model_names:",e),er(e)}catch(e){console.error("Error fetching user models:",e)}})()},[d,u,c]);let ed=e=>{B(s=>{let l={...s,...e};return K(l),l})},eo=async e=>{if(!d){U.Z.fromBackend("Access token not found");return}try{U.Z.success("Generating password reset link...");let s=await (0,j.invitationCreateCall)(d,e);H(s),G(!0)}catch(e){U.Z.fromBackend("Failed to generate password reset link")}},ec=async()=>{if(w&&d)try{S(!0),await (0,j.userDeleteCall)(d,[w.user_id]),x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let s=e.users.filter(e=>e.user_id!==w.user_id);return{...e,users:s}}),U.Z.success("User deleted successfully")}catch(e){console.error("Error deleting user:",e),U.Z.fromBackend("Failed to delete user")}finally{b(!1),k(null),S(!1)}},eu=async()=>{y(null),p(!1)},em=async e=>{if(console.log("inside handleEditSubmit:",e),d&&o&&c&&u){try{let s=await (0,j.userUpdateUserCall)(d,e,null);x.setQueriesData({queryKey:["userList"]},e=>{if(void 0===e)return e;let l=e.users.map(e=>e.user_id===s.data.user_id?(0,O.nl)(e,s.data):e);return{...e,users:l}}),U.Z.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}y(null),p(!1)}},ex=async e=>{g(e)},eg=(0,R.a)({queryKey:["userList",{debouncedFilter:M,currentPage:h}],queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.userListCall)(d,M.user_id?[M.user_id]:null,h,25,M.email||null,M.user_role||null,M.team||null,M.sso_user_id||null,M.sort_by,M.sort_order)},enabled:!!(d&&o&&c&&u),placeholderData:e=>e}),ev=eg.data,ej=(0,R.a)({queryKey:["userRoles"],initialData:()=>({}),queryFn:async()=>{if(!d)throw Error("Access token required");return await (0,j.getPossibleUserRoles)(d)},enabled:!!(d&&o&&c&&u)}).data,ep=es(ej,e=>{y(e),p(!0)},en,eo,()=>{});return(0,t.jsxs)("div",{className:"w-full p-8 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("div",{className:"flex space-x-3",children:eg.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:145,height:36}}),(0,t.jsx)(eh.Z.Button,{active:!0,size:"default",shape:"default",style:{width:110,height:36}})]}):u&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.Z,{userID:u,accessToken:d,teams:m,possibleUIRoles:ej}),(0,t.jsx)(r.z,{onClick:()=>{ea(!et),X([])},variant:et?"primary":"secondary",className:"flex items-center",children:et?"Cancel Selection":"Select Users"}),et&&(0,t.jsxs)(r.z,{onClick:()=>{if(0===Y.length){U.Z.fromBackend("Please select users to edit");return}el(!0)},disabled:0===Y.length,className:"flex items-center",children:["Bulk Edit (",Y.length," selected)"]})]}):null})}),(0,t.jsxs)(a.v0,{defaultIndex:0,onIndexChange:e=>I(0===e?"users":"settings"),children:[(0,t.jsxs)(a.td,{className:"mb-4",children:[(0,t.jsx)(a.OK,{children:"Users"}),(0,t.jsx)(a.OK,{children:"Default User Settings"})]}),(0,t.jsxs)(a.nP,{children:[(0,t.jsx)(a.x4,{children:(0,t.jsx)(ew,{data:(null===(s=eg.data)||void 0===s?void 0:s.users)||[],columns:ep,isLoading:eg.isLoading,accessToken:d,userRole:c,onSortChange:(e,s)=>{ed({sort_by:e,sort_order:s})},currentSort:{sortBy:D.sort_by,sortOrder:D.sort_order},possibleUIRoles:ej,handleEdit:e=>{y(e),p(!0)},handleDelete:en,handleResetPassword:eo,enableSelection:et,selectedUsers:Y,onSelectionChange:e=>{X(e)},filters:D,updateFilters:ed,initialFilters:eU,teams:m,userListResponse:ev,currentPage:h,handlePageChange:ex})}),(0,t.jsx)(a.x4,{children:u&&c&&d?(0,t.jsx)(J,{accessToken:d,possibleUIRoles:ej,userID:u,userRole:c}):(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(eh.Z,{active:!0,paragraph:{rows:4}})})})]})]}),(0,t.jsx)(E,{visible:v,possibleUIRoles:ej,onCancel:eu,user:f,onSubmit:em}),(0,t.jsx)(P.Z,{isOpen:_,title:"Delete User?",message:"Are you sure you want to delete this user? This action cannot be undone.",resourceInformationTitle:"User Information",resourceInformation:[{label:"Email",value:null==w?void 0:w.user_email},{label:"User ID",value:null==w?void 0:w.user_id,code:!0},{label:"Global Proxy Role",value:w&&(null==ej?void 0:null===(l=ej[w.user_role])||void 0===l?void 0:l.ui_label)||(null==w?void 0:w.user_role)||"-"},{label:"Total Spend (USD)",value:null==w?void 0:null===(n=w.spend)||void 0===n?void 0:n.toFixed(2)}],onCancel:()=>{b(!1),k(null)},onOk:ec,confirmLoading:N}),(0,t.jsx)(T.Z,{isInvitationLinkModalVisible:q,setIsInvitationLinkModalVisible:G,baseUrl:$||"",invitationLinkData:Q,modalType:"resetPassword"}),(0,t.jsx)(z,{visible:ee,onCancel:()=>el(!1),selectedUsers:Y,possibleUIRoles:ej,accessToken:d,onSuccess:()=>{x.invalidateQueries({queryKey:["userList"]}),X([]),ea(!1)},teams:m,userRole:c,userModels:ei,allowAllUsers:!!c&&(0,Z.tY)(c)})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6736-8194aa1324e5c1ef.js b/litellm/proxy/_experimental/out/_next/static/chunks/6736-12ae0ecfa19950dd.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/6736-8194aa1324e5c1ef.js rename to litellm/proxy/_experimental/out/_next/static/chunks/6736-12ae0ecfa19950dd.js index 9f4fffa507..5c7593971b 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6736-8194aa1324e5c1ef.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6736-12ae0ecfa19950dd.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6736],{43227:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(5853),o=n(2265),l=n(51975),i=n(13241);let u=(0,n(1153).fn)("SelectItem"),a=o.forwardRef((e,t)=>{let{value:n,icon:a,className:s,children:c}=e,d=(0,r._T)(e,["value","icon","className","children"]);return o.createElement(l.wt,Object.assign({className:(0,i.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",s),ref:t,key:n,value:n},d),a&&o.createElement(a,{className:(0,i.q)(u("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:n))});a.displayName="SelectItem"},67101:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),i=n(2265),u=n(9496);let a=(0,l.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",c=i.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:l,numItemsMd:c,numItemsLg:d,children:f,className:p}=e,m=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,u._m),v=s(l,u.LH),h=s(c,u.l5),b=s(d,u.N4),x=(0,o.q)(g,v,h,b);return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(a("root"),"grid",x,p)},m),f)});c.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return i},PT:function(){return u},SP:function(){return a},VS:function(){return s},_m:function(){return r},_w:function(){return c},l5:function(){return l}});let r={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},l={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},i={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},u={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},a={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},c={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},44140:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(2265);let o=(e,t)=>{let n=void 0!==t,[o,l]=(0,r.useState)(e);return[n?t:o,e=>{n||l(e)}]}},64803:function(e,t,n){n.d(t,{RR:function(){return m},YF:function(){return d},cv:function(){return f},dp:function(){return g},uY:function(){return p}});var r=n(51050),o=n(2265),l=n(54887),i="undefined"!=typeof document?o.useLayoutEffect:function(){};function u(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!u(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!u(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function a(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){let n=a(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return i(()=>{t.current=e}),t}function d(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:d=[],platform:f,elements:{reference:p,floating:m}={},transform:g=!0,whileElementsMounted:v,open:h}=e,[b,x]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[E,y]=o.useState(d);u(E,d)||y(d);let[S,O]=o.useState(null),[R,w]=o.useState(null),C=o.useCallback(e=>{e!==M.current&&(M.current=e,O(e))},[]),P=o.useCallback(e=>{e!==k.current&&(k.current=e,w(e))},[]),L=p||S,T=m||R,M=o.useRef(null),k=o.useRef(null),I=o.useRef(b),F=null!=v,A=c(v),N=c(f),D=c(h),z=o.useCallback(()=>{if(!M.current||!k.current)return;let e={placement:t,strategy:n,middleware:E};N.current&&(e.platform=N.current),(0,r.oo)(M.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==D.current};H.current&&!u(I.current,t)&&(I.current=t,l.flushSync(()=>{x(t)}))})},[E,t,n,N,D]);i(()=>{!1===h&&I.current.isPositioned&&(I.current.isPositioned=!1,x(e=>({...e,isPositioned:!1})))},[h]);let H=o.useRef(!1);i(()=>(H.current=!0,()=>{H.current=!1}),[]),i(()=>{if(L&&(M.current=L),T&&(k.current=T),L&&T){if(A.current)return A.current(L,T,z);z()}},[L,T,z,A,F]);let _=o.useMemo(()=>({reference:M,floating:k,setReference:C,setFloating:P}),[C,P]),V=o.useMemo(()=>({reference:L,floating:T}),[L,T]),B=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!V.floating)return e;let t=s(V.floating,b.x),r=s(V.floating,b.y);return g?{...e,transform:"translate("+t+"px, "+r+"px)",...a(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,g,V.floating,b.x,b.y]);return o.useMemo(()=>({...b,update:z,refs:_,elements:V,floatingStyles:B}),[b,z,_,V,B])}let f=(e,t)=>({...(0,r.cv)(e),options:[e,t]}),p=(e,t)=>({...(0,r.uY)(e),options:[e,t]}),m=(e,t)=>({...(0,r.RR)(e),options:[e,t]}),g=(e,t)=>({...(0,r.dp)(e),options:[e,t]})},52307:function(e,t,n){n.d(t,{dk:function(){return f},fw:function(){return d},zH:function(){return c}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(38929);let s=(0,r.createContext)(null);function c(){var e,t;return null!=(t=null==(e=(0,r.useContext)(s))?void 0:e.value)?t:void 0}function d(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)(()=>function(e){let n=(0,o.z)(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),l=(0,r.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return r.createElement(s.Provider,{value:l},e.children)},[t])]}s.displayName="DescriptionContext";let f=Object.assign((0,a.yV)(function(e,t){let n=(0,r.useId)(),o=(0,u.B)(),{id:c="headlessui-description-".concat(n),...d}=e,f=function e(){let t=(0,r.useContext)(s);if(null===t){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}(),p=(0,i.T)(t);(0,l.e)(()=>f.register(c),[c,f.register]);let m=o||!1,g=(0,r.useMemo)(()=>({...f.slot,disabled:m}),[f.slot,m]),v={ref:p,...f.props,id:c};return(0,a.L6)()({ourProps:v,theirProps:d,slot:g,defaultTag:"p",name:f.name||"Description"})}),{})},7935:function(e,t,n){n.d(t,{__:function(){return p},bE:function(){return f},wp:function(){return d}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(80281),s=n(38929);let c=(0,r.createContext)(null);function d(e){var t,n,o;let l=null!=(n=null==(t=(0,r.useContext)(c))?void 0:t.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[l,...e].filter(Boolean).join(" "):l}function f(){let{inherit:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d(),[n,l]=(0,r.useState)([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,(0,r.useMemo)(()=>function(e){let t=(0,o.z)(e=>(l(t=>[...t,e]),()=>l(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),n=(0,r.useMemo)(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return r.createElement(c.Provider,{value:n},e.children)},[l])]}c.displayName="LabelContext";let p=Object.assign((0,s.yV)(function(e,t){var n;let d=(0,r.useId)(),f=function e(){let t=(0,r.useContext)(c);if(null===t){let t=Error("You used a