diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html
index 6deb96549..41cc292f2 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 Dashboard404
This page could not be found.
\ No newline at end of file
+404: This page could not be found.LiteLLM Dashboard404
This page could not be found.
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/235-bab36c9b7a1c87ea.js b/litellm/proxy/_experimental/out/_next/static/chunks/235-bab36c9b7a1c87ea.js
deleted file mode 100644
index 23aac1a58..000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/235-bab36c9b7a1c87ea.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[235],{52273:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(69703),o=n(64090),a=n(99250),l=n(65492);let c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),o.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))},i=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),o.createElement("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"}))},s=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{fillRule:"evenodd",d:"M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z",clipRule:"evenodd"}),o.createElement("path",{d:"M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z"}))};var d=n(91753);let u=o.forwardRef((e,t)=>{let{value:n,defaultValue:u,type:m,placeholder:p="Type...",icon:f,error:g=!1,errorMessage:h,disabled:b=!1,stepper:v,makeInputClassName:y,className:x,onChange:w,onValueChange:E,autoFocus:k}=e,O=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus"]),[C,j]=(0,o.useState)(k||!1),[S,M]=(0,o.useState)(!1),I=(0,o.useCallback)(()=>M(!S),[S,M]),N=(0,o.useRef)(null),q=(0,d.Uh)(n||u);return o.useEffect(()=>{let e=()=>j(!0),t=()=>j(!1),n=N.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),k&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[k]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,a.q)(y("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,d.um)(q,b,g),C&&(0,a.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),x)},f?o.createElement(f,{className:(0,a.q)(y("icon"),"shrink-0 h-5 w-5 ml-2.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,l.lq)([N,t]),defaultValue:u,value:n,type:S?"text":m,className:(0,a.q)(y("input"),"w-full focus:outline-none focus:ring-0 border-none bg-transparent text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",f?"pl-2":"pl-3",g?"pr-3":"pr-4",b?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:b,"data-testid":"base-input",onChange:e=>{null==w||w(e),null==E||E(e.target.value)}},O)),"password"!==m||b?null:o.createElement("button",{className:(0,a.q)(y("toggleButton"),"mr-2"),type:"button",onClick:()=>I(),"aria-label":S?"Hide password":"Show Password"},S?o.createElement(s,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):o.createElement(i,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),g?o.createElement(c,{className:(0,a.q)(y("errorIcon"),"text-red-500 shrink-0 w-5 h-5 mr-2.5")}):null,null!=v?v:null),g&&h?o.createElement("p",{className:(0,a.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});u.displayName="BaseInput";let m=(0,l.fn)("TextInput"),p=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(u,Object.assign({ref:t,type:n,makeInputClassName:m},a))});p.displayName="TextInput"},91753:function(e,t,n){n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return l},um:function(){return i}});var r=n(99250),o=n(64090);let a=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(a).join(""):"object"==typeof e&&e?a(e.props.children):void 0;function l(e){let t=new Map;return o.Children.map(e,e=>{var n;t.set(e.props.value,null!==(n=a(e))&&void 0!==n?n:e.props.value)}),t}function c(e,t){return o.Children.map(t,t=>{var n;if((null!==(n=a(t))&&void 0!==n?n:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.q)(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500",n?"border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},10384:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:d,children:u,className:m}=e,p=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),(()=>{let e=f(n,c.PT),t=f(a,c.SP),r=f(s,c.VS),l=f(d,c._w);return(0,o.q)(e,t,r,l)})(),m)},p),u)});s.displayName="Col"},46453:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=l.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:a,numItemsMd:d,numItemsLg:u,children:m,className:p}=e,f=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,c._m),h=s(a,c.LH),b=s(d,c.l5),v=s(u,c.N4),y=(0,o.q)(g,h,b,v);return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",y,p)},f),m)});d.displayName="Grid"},50217:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return l},PT:function(){return c},SP:function(){return i},VS:function(){return s},_m:function(){return r},_w:function(){return d},l5:function(){return a}});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"},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"},l={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"},c={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"}},18190:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(64090),a=n(2898),l=n(99250),c=n(65492);let i=(0,c.fn)("Callout"),s=o.forwardRef((e,t)=>{let{title:n,icon:s,color:d,className:u,children:m}=e,p=(0,r._T)(e,["title","icon","color","className","children"]);return o.createElement("div",Object.assign({ref:t,className:(0,l.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,l.q)((0,c.bM)(d,a.K.background).bgColor,(0,c.bM)(d,a.K.darkBorder).borderColor,(0,c.bM)(d,a.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,l.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"),u)},p),o.createElement("div",{className:(0,l.q)(i("header"),"flex items-start")},s?o.createElement(s,{className:(0,l.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,o.createElement("h4",{className:(0,l.q)(i("title"),"font-semibold")},n)),o.createElement("p",{className:(0,l.q)(i("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout"},81583:function(e,t,n){n.d(t,{Z:function(){return eP}});var r=n(63787),o=n(16480),a=n.n(o),l=n(49367),c=n(64090),i=n(47387),s=n(47137);function d(e){let[t,n]=c.useState(e);return c.useEffect(()=>{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}var u=n(8985),m=n(11303),p=n(58854),f=n(46154),g=n(80316),h=n(76585),b=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut," !important"),["&".concat(r,"-appear, &").concat(r,"-enter")]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},["&".concat(r,"-leave-active")]:{transform:"translateY(-5px)"}}}}};let v=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:"".concat((0,u.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:"0 0 0 ".concat((0,u.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),y=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},x=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,m.Wf)(e)),v(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},y(e,e.controlHeightSM)),"&-large":Object.assign({},y(e,e.controlHeightLG))})}},w=e=>{let{formItemCls:t,iconCls:n,componentCls:r,rootPrefixCls:o,labelRequiredMarkColor:a,labelColor:l,labelFontSize:c,labelHeight:i,labelColonMarginInlineStart:s,labelColonMarginInlineEnd:d,itemMarginBottom:u}=e;return{[t]:Object.assign(Object.assign({},(0,m.Wf)(e)),{marginBottom:u,verticalAlign:"top","&-with-help":{transition:"none"},["&-hidden,\n &-hidden.".concat(o,"-row")]:{display:"none"},"&-has-warning":{["".concat(t,"-split")]:{color:e.colorError}},"&-has-error":{["".concat(t,"-split")]:{color:e.colorWarning}},["".concat(t,"-label")]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:i,color:l,fontSize:c,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required:not(").concat(t,"-required-mark-optional)::before")]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:a,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:s,marginInlineEnd:d},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(o,"-col-'\"]):not([class*=\"' ").concat(o,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:"color ".concat(e.motionDurationMid," ").concat(e.motionEaseOut)},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},["&-with-help ".concat(t,"-explain")]:{height:"auto",opacity:1},["".concat(t,"-feedback-icon")]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:p.kr,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},E=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-horizontal")]:{["".concat(n,"-label")]:{flexGrow:0},["".concat(n,"-control")]:{flex:"1 1 0",minWidth:0},["".concat(n,"-label[class$='-24'], ").concat(n,"-label[class*='-24 ']")]:{["& + ".concat(n,"-control")]:{minWidth:"unset"}}}}},k=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},["> ".concat(n,"-label,\n > ").concat(n,"-control")]:{display:"inline-block",verticalAlign:"top"},["> ".concat(n,"-label")]:{flex:"none"},["".concat(t,"-text")]:{display:"inline-block"},["".concat(n,"-has-feedback")]:{display:"inline-block"}}}}},O=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),C=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:O(e),["".concat(t,":not(").concat(t,"-inline)")]:{[n]:{flexWrap:"wrap",["".concat(n,"-label, ").concat(n,"-control")]:{['&:not([class*=" '.concat(r,'-col-xs"])')]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},j=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(t,"-vertical")]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},["".concat(t,"-item-control")]:{width:"100%"}}},["".concat(t,"-vertical ").concat(n,"-label,\n .").concat(r,"-col-24").concat(n,"-label,\n .").concat(r,"-col-xl-24").concat(n,"-label")]:O(e),["@media (max-width: ".concat((0,u.bf)(e.screenXSMax),")")]:[C(e),{[t]:{[".".concat(r,"-col-xs-24").concat(n,"-label")]:O(e)}}],["@media (max-width: ".concat((0,u.bf)(e.screenSMMax),")")]:{[t]:{[".".concat(r,"-col-sm-24").concat(n,"-label")]:O(e)}},["@media (max-width: ".concat((0,u.bf)(e.screenMDMax),")")]:{[t]:{[".".concat(r,"-col-md-24").concat(n,"-label")]:O(e)}},["@media (max-width: ".concat((0,u.bf)(e.screenLGMax),")")]:{[t]:{[".".concat(r,"-col-lg-24").concat(n,"-label")]:O(e)}}}},S=(e,t)=>(0,g.TS)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var M=(0,h.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=S(e,n);return[x(r),w(r),b(r),E(r),k(r),j(r),(0,f.Z)(r),p.kr]},e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:"0 0 ".concat(e.paddingXS,"px"),verticalLabelMargin:0}),{order:-1e3}),I=n(92935);let N=[];function q(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{key:"string"==typeof e?e:"".concat(t,"-").concat(r),error:e,errorStatus:n}}var Z=e=>{let{help:t,helpStatus:n,errors:o=N,warnings:u=N,className:m,fieldId:p,onVisibleChanged:f}=e,{prefixCls:g}=c.useContext(s.Rk),h="".concat(g,"-item-explain"),b=(0,I.Z)(g),[v,y,x]=M(g,b),w=(0,c.useMemo)(()=>(0,i.Z)(g),[g]),E=d(o),k=d(u),O=c.useMemo(()=>null!=t?[q(t,"help",n)]:[].concat((0,r.Z)(E.map((e,t)=>q(e,"error","error",t))),(0,r.Z)(k.map((e,t)=>q(e,"warning","warning",t)))),[t,n,E,k]),C={};return p&&(C.id="".concat(p,"_help")),v(c.createElement(l.ZP,{motionDeadline:w.motionDeadline,motionName:"".concat(g,"-show-help"),visible:!!O.length,onVisibleChanged:f},e=>{let{className:t,style:n}=e;return c.createElement("div",Object.assign({},C,{className:a()(h,t,x,b,m,y),style:n,role:"alert"}),c.createElement(l.V4,Object.assign({keys:O},(0,i.Z)(g),{motionName:"".concat(g,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:o,style:l}=e;return c.createElement("div",{key:t,className:a()(o,{["".concat(h,"-").concat(r)]:r}),style:l},n)}))}))},F=n(76570),R=n(57499),_=n(17094),P=n(10693),T=n(97303);let L=e=>"object"==typeof e&&null!=e&&1===e.nodeType,W=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,H=(e,t)=>{if(e.clientHeight{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeightat||a>e&&l=t&&c>=n?a-e-r:l>t&&cn?l-t+o:0,V=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},A=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:l,block:c,inline:i,boundary:s,skipOverflowHiddenElements:d}=t,u="function"==typeof s?s:e=>e!==s;if(!L(e))throw TypeError("Invalid target");let m=document.scrollingElement||document.documentElement,p=[],f=e;for(;L(f)&&u(f);){if((f=V(f))===m){p.push(f);break}null!=f&&f===document.body&&H(f)&&!H(document.documentElement)||null!=f&&H(f,d)&&p.push(f)}let g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,h=null!=(a=null==(o=window.visualViewport)?void 0:o.height)?a:innerHeight,{scrollX:b,scrollY:v}=window,{height:y,width:x,top:w,right:E,bottom:k,left:O}=e.getBoundingClientRect(),{top:C,right:j,bottom:S,left:M}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),I="start"===c||"nearest"===c?w-C:"end"===c?k+S:w+y/2-C+S,N="center"===i?O+x/2-M+j:"end"===i?E+j:O-M,q=[];for(let e=0;e=0&&O>=0&&k<=h&&E<=g&&w>=o&&k<=s&&O>=d&&E<=a)break;let u=getComputedStyle(t),f=parseInt(u.borderLeftWidth,10),C=parseInt(u.borderTopWidth,10),j=parseInt(u.borderRightWidth,10),S=parseInt(u.borderBottomWidth,10),M=0,Z=0,F="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-j:0,R="offsetHeight"in t?t.offsetHeight-t.clientHeight-C-S:0,_="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,P="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(m===t)M="start"===c?I:"end"===c?I-h:"nearest"===c?z(v,v+h,h,C,S,v+I,v+I+y,y):I-h/2,Z="start"===i?N:"center"===i?N-g/2:"end"===i?N-g:z(b,b+g,g,f,j,b+N,b+N+x,x),M=Math.max(0,M+v),Z=Math.max(0,Z+b);else{M="start"===c?I-o-C:"end"===c?I-s+S+R:"nearest"===c?z(o,s,n,C,S+R,I,I+y,y):I-(o+n/2)+R/2,Z="start"===i?N-d-f:"center"===i?N-(d+r/2)+F/2:"end"===i?N-a+j+F:z(d,a,r,f,j+F,N,N+x,x);let{scrollLeft:e,scrollTop:l}=t;M=0===P?0:Math.max(0,Math.min(l+M/P,t.scrollHeight-n/P+R)),Z=0===_?0:Math.max(0,Math.min(e+Z/_,t.scrollWidth-r/_+F)),I+=l-M,N+=e-Z}q.push({el:t,top:M,left:Z})}return q},D=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"},B=["parentNode"];function X(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function G(e,t){if(!e.length)return;let n=e.join("_");return t?"".concat(t,"_").concat(n):B.includes(n)?"".concat("form_item","_").concat(n):n}function U(e,t,n,r,o,a){let l=r;return void 0!==a?l=a:n.validating?l="validating":e.length?l="error":t.length?l="warning":(n.touched||o&&n.validated)&&(l="success"),l}function $(e){return X(e).join("_")}function K(e){let[t]=(0,F.cI)(),n=c.useRef({}),r=c.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=$(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=G(X(e),r.__INTERNAL__.name),o=n?document.getElementById(n):null;o&&function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(A(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:l}of A(e,D(t))){let e=a-n.top+n.bottom,t=l-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(o,Object.assign({scrollMode:"if-needed",block:"nearest"},t))},getFieldInstance:e=>{let t=$(e);return n.current[t]}}),[e,t]);return[r]}var Y=n(12519),J=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};let Q=c.forwardRef((e,t)=>{let n=c.useContext(_.Z),{getPrefixCls:r,direction:o,form:l}=c.useContext(R.E_),{prefixCls:i,className:d,rootClassName:u,size:m,disabled:p=n,form:f,colon:g,labelAlign:h,labelWrap:b,labelCol:v,wrapperCol:y,hideRequiredMark:x,layout:w="horizontal",scrollToFirstError:E,requiredMark:k,onFinishFailed:O,name:C,style:j,feedbackIcons:S,variant:N}=e,q=J(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),Z=(0,P.Z)(m),L=c.useContext(Y.Z),W=(0,c.useMemo)(()=>void 0!==k?k:!x&&(!l||void 0===l.requiredMark||l.requiredMark),[x,k,l]),H=null!=g?g:null==l?void 0:l.colon,z=r("form",i),V=(0,I.Z)(z),[A,D,B]=M(z,V),X=a()(z,"".concat(z,"-").concat(w),{["".concat(z,"-hide-required-mark")]:!1===W,["".concat(z,"-rtl")]:"rtl"===o,["".concat(z,"-").concat(Z)]:Z},B,V,D,null==l?void 0:l.className,d,u),[G]=K(f),{__INTERNAL__:U}=G;U.name=C;let $=(0,c.useMemo)(()=>({name:C,labelAlign:h,labelCol:v,labelWrap:b,wrapperCol:y,vertical:"vertical"===w,colon:H,requiredMark:W,itemRef:U.itemRef,form:G,feedbackIcons:S}),[C,h,v,y,w,H,W,G,S]);c.useImperativeHandle(t,()=>G);let Q=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=e),G.scrollToField(t,n)}};return A(c.createElement(s.pg.Provider,{value:N},c.createElement(_.n,{disabled:p},c.createElement(T.Z.Provider,{value:Z},c.createElement(s.RV,{validateMessages:L},c.createElement(s.q3.Provider,{value:$},c.createElement(F.ZP,Object.assign({id:C},q,{name:C,onFinishFailed:e=>{if(null==O||O(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==E){Q(E,t);return}l&&void 0!==l.scrollToFirstError&&Q(l.scrollToFirstError,t)}},form:G,style:Object.assign(Object.assign({},null==l?void 0:l.style),j),className:X}))))))))});var ee=n(89211),et=n(74084),en=n(65823),er=n(76564),eo=n(33054);let ea=()=>{let{status:e,errors:t=[],warnings:n=[]}=(0,c.useContext)(s.aM);return{status:e,errors:t,warnings:n}};ea.Context=s.aM;var el=n(19223),ec=n(73193),ei=n(24800),es=n(35704),ed=n(5056),eu=n(90791);let em=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var ep=(0,h.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return[em(S(e,n))]}),ef=e=>{let{prefixCls:t,status:n,wrapperCol:r,children:o,errors:l,warnings:i,_internalItemRender:d,extra:u,help:m,fieldId:p,marginBottom:f,onErrorVisibleChanged:g}=e,h="".concat(t,"-item"),b=c.useContext(s.q3),v=r||b.wrapperCol||{},y=a()("".concat(h,"-control"),v.className),x=c.useMemo(()=>Object.assign({},b),[b]);delete x.labelCol,delete x.wrapperCol;let w=c.createElement("div",{className:"".concat(h,"-control-input")},c.createElement("div",{className:"".concat(h,"-control-input-content")},o)),E=c.useMemo(()=>({prefixCls:t,status:n}),[t,n]),k=null!==f||l.length||i.length?c.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},c.createElement(s.Rk.Provider,{value:E},c.createElement(Z,{fieldId:p,errors:l,warnings:i,help:m,helpStatus:n,className:"".concat(h,"-explain-connected"),onVisibleChanged:g})),!!f&&c.createElement("div",{style:{width:0,height:f}})):null,O={};p&&(O.id="".concat(p,"_extra"));let C=u?c.createElement("div",Object.assign({},O,{className:"".concat(h,"-extra")}),u):null,j=d&&"pro_table_render"===d.mark&&d.render?d.render(e,{input:w,errorList:k,extra:C}):c.createElement(c.Fragment,null,w,k,C);return c.createElement(s.q3.Provider,{value:x},c.createElement(eu.Z,Object.assign({},v,{className:y}),j),c.createElement(ep,{prefixCls:t}))},eg=n(14749),eh={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:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},eb=n(60688),ev=c.forwardRef(function(e,t){return c.createElement(eb.Z,(0,eg.Z)({},e,{ref:t,icon:eh}))}),ey=n(79474),ex=n(70595),ew=n(6180),eE=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},ek=e=>{var t;let{prefixCls:n,label:r,htmlFor:o,labelCol:l,labelAlign:i,colon:d,required:u,requiredMark:m,tooltip:p}=e,[f]=(0,ex.Z)("Form"),{vertical:g,labelAlign:h,labelCol:b,labelWrap:v,colon:y}=c.useContext(s.q3);if(!r)return null;let x=l||b||{},w="".concat(n,"-item-label"),E=a()(w,"left"===(i||h)&&"".concat(w,"-left"),x.className,{["".concat(w,"-wrap")]:!!v}),k=r,O=!0===d||!1!==y&&!1!==d;O&&!g&&"string"==typeof r&&""!==r.trim()&&(k=r.replace(/[:|:]\s*$/,""));let C=p?"object"!=typeof p||c.isValidElement(p)?{title:p}:p:null;if(C){let{icon:e=c.createElement(ev,null)}=C,t=eE(C,["icon"]),r=c.createElement(ew.Z,Object.assign({},t),c.cloneElement(e,{className:"".concat(n,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));k=c.createElement(c.Fragment,null,k,r)}let j="optional"===m,S="function"==typeof m;S?k=m(k,{required:!!u}):j&&!u&&(k=c.createElement(c.Fragment,null,k,c.createElement("span",{className:"".concat(n,"-item-optional"),title:""},(null==f?void 0:f.optional)||(null===(t=ey.Z.Form)||void 0===t?void 0:t.optional))));let M=a()({["".concat(n,"-item-required")]:u,["".concat(n,"-item-required-mark-optional")]:j||S,["".concat(n,"-item-no-colon")]:!O});return c.createElement(eu.Z,Object.assign({},x,{className:E}),c.createElement("label",{htmlFor:o,className:M,title:"string"==typeof r?r:""},k))},eO=n(99537),eC=n(77136),ej=n(20653),eS=n(66155);let eM={success:eO.Z,warning:ej.Z,error:eC.Z,validating:eS.Z};function eI(e){let{children:t,errors:n,warnings:r,hasFeedback:o,validateStatus:l,prefixCls:i,meta:d,noStyle:u}=e,m="".concat(i,"-item"),{feedbackIcons:p}=c.useContext(s.q3),f=U(n,r,d,null,!!o,l),{isFormItemInput:g,status:h,hasFeedback:b,feedbackIcon:v}=c.useContext(s.aM),y=c.useMemo(()=>{var e;let t;if(o){let l=!0!==o&&o.icons||p,i=f&&(null===(e=null==l?void 0:l({status:f,errors:n,warnings:r}))||void 0===e?void 0:e[f]),s=f&&eM[f];t=!1!==i&&s?c.createElement("span",{className:a()("".concat(m,"-feedback-icon"),"".concat(m,"-feedback-icon-").concat(f))},i||c.createElement(s,null)):null}let l={status:f||"",errors:n,warnings:r,hasFeedback:!!o,feedbackIcon:t,isFormItemInput:!0};return u&&(l.status=(null!=f?f:h)||"",l.isFormItemInput=g,l.hasFeedback=!!(null!=o?o:b),l.feedbackIcon=void 0!==o?l.feedbackIcon:v),l},[f,o,u,g,h]);return c.createElement(s.aM.Provider,{value:y},t)}var eN=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};function eq(e){let{prefixCls:t,className:n,rootClassName:r,style:o,help:l,errors:i,warnings:u,validateStatus:m,meta:p,hasFeedback:f,hidden:g,children:h,fieldId:b,required:v,isRequired:y,onSubItemMetaChange:x}=e,w=eN(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),E="".concat(t,"-item"),{requiredMark:k}=c.useContext(s.q3),O=c.useRef(null),C=d(i),j=d(u),S=null!=l,M=!!(S||i.length||u.length),I=!!O.current&&(0,ec.Z)(O.current),[N,q]=c.useState(null);(0,ei.Z)(()=>{M&&O.current&&q(parseInt(getComputedStyle(O.current).marginBottom,10))},[M,I]);let Z=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return U(e?C:p.errors,e?j:p.warnings,p,"",!!f,m)}(),F=a()(E,n,r,{["".concat(E,"-with-help")]:S||C.length||j.length,["".concat(E,"-has-feedback")]:Z&&f,["".concat(E,"-has-success")]:"success"===Z,["".concat(E,"-has-warning")]:"warning"===Z,["".concat(E,"-has-error")]:"error"===Z,["".concat(E,"-is-validating")]:"validating"===Z,["".concat(E,"-hidden")]:g});return c.createElement("div",{className:F,style:o,ref:O},c.createElement(ed.Z,Object.assign({className:"".concat(E,"-row")},(0,es.Z)(w,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),c.createElement(ek,Object.assign({htmlFor:b},e,{requiredMark:k,required:null!=v?v:y,prefixCls:t})),c.createElement(ef,Object.assign({},e,p,{errors:C,warnings:j,prefixCls:t,status:Z,help:l,marginBottom:N,onErrorVisibleChanged:e=>{e||q(null)}}),c.createElement(s.qI.Provider,{value:x},c.createElement(eI,{prefixCls:t,meta:p,errors:p.errors,warnings:p.warnings,hasFeedback:f,validateStatus:Z},h)))),!!N&&c.createElement("div",{className:"".concat(E,"-margin-offset"),style:{marginBottom:-N}}))}let eZ=c.memo(e=>{let{children:t}=e;return t},(e,t)=>(function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],o=t[n];return r===o||"function"==typeof r||"function"==typeof o})})(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function eF(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let eR=function(e){let{name:t,noStyle:n,className:o,dependencies:l,prefixCls:i,shouldUpdate:d,rules:u,children:m,required:p,label:f,messageVariables:g,trigger:h="onChange",validateTrigger:b,hidden:v,help:y}=e,{getPrefixCls:x}=c.useContext(R.E_),{name:w}=c.useContext(s.q3),E=function(e){if("function"==typeof e)return e;let t=(0,eo.Z)(e);return t.length<=1?t[0]:t}(m),k="function"==typeof E,O=c.useContext(s.qI),{validateTrigger:C}=c.useContext(F.zb),j=void 0!==b?b:C,S=null!=t,N=x("form",i),q=(0,I.Z)(N),[Z,_,P]=M(N,q);(0,er.ln)("Form.Item");let T=c.useContext(F.ZM),L=c.useRef(),[W,H]=function(e){let[t,n]=c.useState(e),r=(0,c.useRef)(null),o=(0,c.useRef)([]),a=(0,c.useRef)(!1);return c.useEffect(()=>(a.current=!1,()=>{a.current=!0,el.Z.cancel(r.current),r.current=null}),[]),[t,function(e){a.current||(null===r.current&&(o.current=[],r.current=(0,el.Z)(()=>{r.current=null,n(e=>{let t=e;return o.current.forEach(e=>{t=e(t)}),t})})),o.current.push(e))}]}({}),[z,V]=(0,ee.Z)(()=>eF()),A=(e,t)=>{H(n=>{let o=Object.assign({},n),a=[].concat((0,r.Z)(e.name.slice(0,-1)),(0,r.Z)(t)).join("__SPLIT__");return e.destroy?delete o[a]:o[a]=e,o})},[D,B]=c.useMemo(()=>{let e=(0,r.Z)(z.errors),t=(0,r.Z)(z.warnings);return Object.values(W).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[W,z.errors,z.warnings]),U=function(){let{itemRef:e}=c.useContext(s.q3),t=c.useRef({});return function(n,r){let o=r&&"object"==typeof r&&r.ref,a=n.join("_");return(t.current.name!==a||t.current.originRef!==o)&&(t.current.name=a,t.current.originRef=o,t.current.ref=(0,et.sQ)(e(n),o)),t.current.ref}}();function $(t,r,l){return n&&!v?c.createElement(eI,{prefixCls:N,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:z,errors:D,warnings:B,noStyle:!0},t):c.createElement(eq,Object.assign({key:"row"},e,{className:a()(o,P,q,_),prefixCls:N,fieldId:r,isRequired:l,errors:D,warnings:B,meta:z,onSubItemMetaChange:A}),t)}if(!S&&!k&&!l)return Z($(E));let K={};return"string"==typeof f?K.label=f:t&&(K.label=String(t)),g&&(K=Object.assign(Object.assign({},K),g)),Z(c.createElement(F.gN,Object.assign({},e,{messageVariables:K,trigger:h,validateTrigger:j,onMetaChange:e=>{let t=null==T?void 0:T.getKey(e.name);if(V(e.destroy?eF():e,!0),n&&!1!==y&&O){let n=e.name;if(e.destroy)n=L.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),L.current=n}O(e,n)}}}),(n,o,a)=>{let i=X(t).length&&o?o.name:[],s=G(i,w),m=void 0!==p?p:!!(u&&u.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(a);return t&&t.required&&!t.warningOnly}return!1})),f=Object.assign({},n),g=null;if(Array.isArray(E)&&S)g=E;else if(k&&(!(d||l)||S));else if(!l||k||S){if((0,en.l$)(E)){let t=Object.assign(Object.assign({},E.props),f);if(t.id||(t.id=s),y||D.length>0||B.length>0||e.extra){let n=[];(y||D.length>0)&&n.push("".concat(s,"_help")),e.extra&&n.push("".concat(s,"_extra")),t["aria-describedby"]=n.join(" ")}D.length>0&&(t["aria-invalid"]="true"),m&&(t["aria-required"]="true"),(0,et.Yr)(E)&&(t.ref=U(i,E)),new Set([].concat((0,r.Z)(X(h)),(0,r.Z)(X(j)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),l=0;lt.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};Q.Item=eR,Q.List=e=>{var{prefixCls:t,children:n}=e,r=e_(e,["prefixCls","children"]);let{getPrefixCls:o}=c.useContext(R.E_),a=o("form",t),l=c.useMemo(()=>({prefixCls:a,status:"error"}),[a]);return c.createElement(F.aV,Object.assign({},r),(e,t,r)=>c.createElement(s.Rk.Provider,{value:l},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:r.errors,warnings:r.warnings})))},Q.ErrorList=Z,Q.useForm=K,Q.useFormInstance=function(){let{form:e}=(0,c.useContext)(s.q3);return e},Q.useWatch=F.qo,Q.Provider=s.RV,Q.create=()=>{};var eP=Q},24305:function(e,t,n){let r=(0,n(64090).createContext)({});t.Z=r},90791:function(e,t,n){var r=n(64090),o=n(16480),a=n.n(o),l=n(57499),c=n(24305),i=n(37148),s=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};let d=["xs","sm","md","lg","xl","xxl"],u=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(l.E_),{gutter:u,wrap:m}=r.useContext(c.Z),{prefixCls:p,span:f,order:g,offset:h,push:b,pull:v,className:y,children:x,flex:w,style:E}=e,k=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),O=n("col",p),[C,j,S]=(0,i.cG)(O),M={};d.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete k[t],M=Object.assign(Object.assign({},M),{["".concat(O,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(O,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(O,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(O,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(O,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(O,"-").concat(t,"-flex-").concat(n.flex)]:n.flex||"auto"===n.flex,["".concat(O,"-rtl")]:"rtl"===o})});let I=a()(O,{["".concat(O,"-").concat(f)]:void 0!==f,["".concat(O,"-order-").concat(g)]:g,["".concat(O,"-offset-").concat(h)]:h,["".concat(O,"-push-").concat(b)]:b,["".concat(O,"-pull-").concat(v)]:v},y,M,j,S),N={};if(u&&u[0]>0){let e=u[0]/2;N.paddingLeft=e,N.paddingRight=e}return w&&(N.flex="number"==typeof w?"".concat(w," ").concat(w," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(w)?"0 0 ".concat(w):w,!1!==m||N.minWidth||(N.minWidth=0)),C(r.createElement("div",Object.assign({},k,{style:Object.assign(Object.assign({},N),E),className:I,ref:t}),x))});t.Z=u},5056:function(e,t,n){n.d(t,{Z:function(){return g}});var r=n(64090),o=n(16480),a=n.n(o),l=n(24750);let c=["xxl","xl","lg","md","sm","xs"],i=e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}),s=e=>{let t=[].concat(c).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),l="screen".concat(o);if(!(e[a]<=e[l]))throw Error("".concat(a,"<=").concat(l," fails : !(").concat(e[a],"<=").concat(e[l],")"));if(rt.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};function f(e,t){let[n,o]=r.useState("string"==typeof e?e:""),a=()=>{if("string"==typeof e&&o(e),"object"==typeof e)for(let n=0;n{a()},[JSON.stringify(e),t]),n}var g=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:g,className:h,style:b,children:v,gutter:y=0,wrap:x}=e,w=p(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:E,direction:k}=r.useContext(d.E_),[O,C]=r.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[j,S]=r.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),M=f(g,j),I=f(o,j),N=r.useRef(y),q=function(){let[,e]=(0,l.ZP)(),t=i(s(e));return r.useMemo(()=>{let e=new Map,n=-1,r={};return{matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},unregister(){Object.keys(t).forEach(e=>{let n=t[e],r=this.matchHandlers[n];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),e.clear()},register(){Object.keys(t).forEach(e=>{let n=t[e],o=t=>{let{matches:n}=t;this.dispatch(Object.assign(Object.assign({},r),{[e]:n}))},a=window.matchMedia(n);a.addListener(o),this.matchHandlers[n]={mql:a,listener:o},o(a)})},responsiveMap:t}},[e])}();r.useEffect(()=>{let e=q.subscribe(e=>{S(e);let t=N.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&C(e)});return()=>q.unsubscribe(e)},[]);let Z=E("row",n),[F,R,_]=(0,m.VM)(Z),P=(()=>{let e=[void 0,void 0];return(Array.isArray(y)?y:[y,void 0]).forEach((t,n)=>{if("object"==typeof t)for(let r=0;r0?-(P[0]/2):void 0;W&&(L.marginLeft=W,L.marginRight=W),[,L.rowGap]=P;let[H,z]=P,V=r.useMemo(()=>({gutter:[H,z],wrap:x}),[H,z,x]);return F(r.createElement(u.Z.Provider,{value:V},r.createElement("div",Object.assign({},w,{className:T,style:Object.assign(Object.assign({},L),b),ref:t}),v)))})},37148:function(e,t,n){n.d(t,{VM:function(){return d},cG:function(){return u}});var r=n(8985),o=n(76585),a=n(80316);let l=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{componentCls:n,gridColumns:r}=e,o={};for(let e=r;e>=0;e--)0===e?(o["".concat(n).concat(t,"-").concat(e)]={display:"none"},o["".concat(n,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:0},o["".concat(n).concat(t,"-order-").concat(e)]={order:0}):(o["".concat(n).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/r*100,"%"),maxWidth:"".concat(e/r*100,"%")}],o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-order-").concat(e)]={order:e});return o},i=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},i(e,n))}),d=(0,o.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,o.I$)("Grid",e=>{let t=(0,a.TS)(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[l(t),i(t,""),i(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},46154:function(e,t){t.Z=e=>({[e.componentCls]:{["".concat(e.antCls,"-motion-collapse-legacy")]:{overflow:"hidden","&-active":{transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}},["".concat(e.antCls,"-motion-collapse")]:{overflow:"hidden",transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}}})},37963:function(e,t,n){n.d(t,{o:function(){return o}});class r extends Error{}function o(e,t){let n;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let o=!0===t.header?0:1,a=e.split(".")[o];if("string"!=typeof a)throw new r("Invalid token specified: missing part #".concat(o+1));try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var n;return n=t,decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return atob(t)}}(a)}catch(e){throw new r("Invalid token specified: invalid base64 for part #".concat(o+1," (").concat(e.message,")"))}try{return JSON.parse(n)}catch(e){throw new r("Invalid token specified: invalid json for part #".concat(o+1," (").concat(e.message,")"))}}r.prototype.name="InvalidTokenError"}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/684-bb2d2f93d92acb0b.js b/litellm/proxy/_experimental/out/_next/static/chunks/684-bb2d2f93d92acb0b.js
new file mode 100644
index 000000000..4ee989c2b
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/684-bb2d2f93d92acb0b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[684],{52273:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(69703),o=n(64090),a=n(99250),l=n(65492);let c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),o.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))},i=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),o.createElement("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"}))},s=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{fillRule:"evenodd",d:"M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z",clipRule:"evenodd"}),o.createElement("path",{d:"M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z"}))};var d=n(91753);let u=o.forwardRef((e,t)=>{let{value:n,defaultValue:u,type:m,placeholder:p="Type...",icon:f,error:g=!1,errorMessage:h,disabled:b=!1,stepper:v,makeInputClassName:y,className:x,onChange:w,onValueChange:E,autoFocus:k}=e,O=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus"]),[C,j]=(0,o.useState)(k||!1),[S,M]=(0,o.useState)(!1),I=(0,o.useCallback)(()=>M(!S),[S,M]),N=(0,o.useRef)(null),Z=(0,d.Uh)(n||u);return o.useEffect(()=>{let e=()=>j(!0),t=()=>j(!1),n=N.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),k&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[k]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,a.q)(y("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,d.um)(Z,b,g),C&&(0,a.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),x)},f?o.createElement(f,{className:(0,a.q)(y("icon"),"shrink-0 h-5 w-5 ml-2.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,l.lq)([N,t]),defaultValue:u,value:n,type:S?"text":m,className:(0,a.q)(y("input"),"w-full focus:outline-none focus:ring-0 border-none bg-transparent text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",f?"pl-2":"pl-3",g?"pr-3":"pr-4",b?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:b,"data-testid":"base-input",onChange:e=>{null==w||w(e),null==E||E(e.target.value)}},O)),"password"!==m||b?null:o.createElement("button",{className:(0,a.q)(y("toggleButton"),"mr-2"),type:"button",onClick:()=>I(),"aria-label":S?"Hide password":"Show Password"},S?o.createElement(s,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):o.createElement(i,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),g?o.createElement(c,{className:(0,a.q)(y("errorIcon"),"text-red-500 shrink-0 w-5 h-5 mr-2.5")}):null,null!=v?v:null),g&&h?o.createElement("p",{className:(0,a.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});u.displayName="BaseInput";let m=(0,l.fn)("TextInput"),p=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(u,Object.assign({ref:t,type:n,makeInputClassName:m},a))});p.displayName="TextInput"},91753:function(e,t,n){n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return l},um:function(){return i}});var r=n(99250),o=n(64090);let a=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(a).join(""):"object"==typeof e&&e?a(e.props.children):void 0;function l(e){let t=new Map;return o.Children.map(e,e=>{var n;t.set(e.props.value,null!==(n=a(e))&&void 0!==n?n:e.props.value)}),t}function c(e,t){return o.Children.map(t,t=>{var n;if((null!==(n=a(t))&&void 0!==n?n:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.q)(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500",n?"border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},10384:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:d,children:u,className:m}=e,p=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),(()=>{let e=f(n,c.PT),t=f(a,c.SP),r=f(s,c.VS),l=f(d,c._w);return(0,o.q)(e,t,r,l)})(),m)},p),u)});s.displayName="Col"},46453:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=l.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:a,numItemsMd:d,numItemsLg:u,children:m,className:p}=e,f=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,c._m),h=s(a,c.LH),b=s(d,c.l5),v=s(u,c.N4),y=(0,o.q)(g,h,b,v);return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",y,p)},f),m)});d.displayName="Grid"},50217:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return l},PT:function(){return c},SP:function(){return i},VS:function(){return s},_m:function(){return r},_w:function(){return d},l5:function(){return a}});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"},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"},l={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"},c={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"}},18190:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(64090),a=n(2898),l=n(99250),c=n(65492);let i=(0,c.fn)("Callout"),s=o.forwardRef((e,t)=>{let{title:n,icon:s,color:d,className:u,children:m}=e,p=(0,r._T)(e,["title","icon","color","className","children"]);return o.createElement("div",Object.assign({ref:t,className:(0,l.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,l.q)((0,c.bM)(d,a.K.background).bgColor,(0,c.bM)(d,a.K.darkBorder).borderColor,(0,c.bM)(d,a.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,l.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"),u)},p),o.createElement("div",{className:(0,l.q)(i("header"),"flex items-start")},s?o.createElement(s,{className:(0,l.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,o.createElement("h4",{className:(0,l.q)(i("title"),"font-semibold")},n)),o.createElement("p",{className:(0,l.q)(i("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout"},30367:function(e,t,n){var r=n(63787),o=n(16480),a=n.n(o),l=n(49367),c=n(64090),i=n(47387),s=n(47137),d=n(10677),u=n(77906),m=n(92935);let p=[];function f(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{key:"string"==typeof e?e:"".concat(t,"-").concat(r),error:e,errorStatus:n}}t.Z=e=>{let{help:t,helpStatus:n,errors:o=p,warnings:g=p,className:h,fieldId:b,onVisibleChanged:v}=e,{prefixCls:y}=c.useContext(s.Rk),x="".concat(y,"-item-explain"),w=(0,m.Z)(y),[E,k,O]=(0,u.ZP)(y,w),C=(0,c.useMemo)(()=>(0,i.Z)(y),[y]),j=(0,d.Z)(o),S=(0,d.Z)(g),M=c.useMemo(()=>null!=t?[f(t,"help",n)]:[].concat((0,r.Z)(j.map((e,t)=>f(e,"error","error",t))),(0,r.Z)(S.map((e,t)=>f(e,"warning","warning",t)))),[t,n,j,S]),I={};return b&&(I.id="".concat(b,"_help")),E(c.createElement(l.ZP,{motionDeadline:C.motionDeadline,motionName:"".concat(y,"-show-help"),visible:!!M.length,onVisibleChanged:v},e=>{let{className:t,style:n}=e;return c.createElement("div",Object.assign({},I,{className:a()(x,t,O,w,h,k),style:n,role:"alert"}),c.createElement(l.V4,Object.assign({keys:M},(0,i.Z)(y),{motionName:"".concat(y,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:o,style:l}=e;return c.createElement("div",{key:t,className:a()(o,{["".concat(x,"-").concat(r)]:r}),style:l},n)}))}))}},84406:function(e,t,n){n.d(t,{Z:function(){return Y}});var r=n(63787),o=n(64090),a=n(16480),l=n.n(a),c=n(76570),i=n(89211),s=n(74084),d=n(65823),u=n(76564),m=n(57499),p=n(92935),f=n(47137),g=n(33054);let h=()=>{let{status:e,errors:t=[],warnings:n=[]}=(0,o.useContext)(f.aM);return{status:e,errors:t,warnings:n}};h.Context=f.aM;var b=n(19223),v=n(77906),y=n(47276),x=n(73193),w=n(24800),E=n(35704),k=n(5056),O=n(90791),C=n(30367),j=n(76585);let S=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var M=(0,j.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return[S((0,v.B4)(e,n))]}),I=e=>{let{prefixCls:t,status:n,wrapperCol:r,children:a,errors:c,warnings:i,_internalItemRender:s,extra:d,help:u,fieldId:m,marginBottom:p,onErrorVisibleChanged:g}=e,h="".concat(t,"-item"),b=o.useContext(f.q3),v=r||b.wrapperCol||{},y=l()("".concat(h,"-control"),v.className),x=o.useMemo(()=>Object.assign({},b),[b]);delete x.labelCol,delete x.wrapperCol;let w=o.createElement("div",{className:"".concat(h,"-control-input")},o.createElement("div",{className:"".concat(h,"-control-input-content")},a)),E=o.useMemo(()=>({prefixCls:t,status:n}),[t,n]),k=null!==p||c.length||i.length?o.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},o.createElement(f.Rk.Provider,{value:E},o.createElement(C.Z,{fieldId:m,errors:c,warnings:i,help:u,helpStatus:n,className:"".concat(h,"-explain-connected"),onVisibleChanged:g})),!!p&&o.createElement("div",{style:{width:0,height:p}})):null,j={};m&&(j.id="".concat(m,"_extra"));let S=d?o.createElement("div",Object.assign({},j,{className:"".concat(h,"-extra")}),d):null,I=s&&"pro_table_render"===s.mark&&s.render?s.render(e,{input:w,errorList:k,extra:S}):o.createElement(o.Fragment,null,w,k,S);return o.createElement(f.q3.Provider,{value:x},o.createElement(O.Z,Object.assign({},v,{className:y}),I),o.createElement(M,{prefixCls:t}))},N=n(14749),Z={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:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},q=n(60688),R=o.forwardRef(function(e,t){return o.createElement(q.Z,(0,N.Z)({},e,{ref:t,icon:Z}))}),F=n(79474),P=n(70595),_=n(6180),T=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},L=e=>{var t;let{prefixCls:n,label:r,htmlFor:a,labelCol:c,labelAlign:i,colon:s,required:d,requiredMark:u,tooltip:m}=e,[p]=(0,P.Z)("Form"),{vertical:g,labelAlign:h,labelCol:b,labelWrap:v,colon:y}=o.useContext(f.q3);if(!r)return null;let x=c||b||{},w="".concat(n,"-item-label"),E=l()(w,"left"===(i||h)&&"".concat(w,"-left"),x.className,{["".concat(w,"-wrap")]:!!v}),k=r,C=!0===s||!1!==y&&!1!==s;C&&!g&&"string"==typeof r&&""!==r.trim()&&(k=r.replace(/[:|:]\s*$/,""));let j=m?"object"!=typeof m||o.isValidElement(m)?{title:m}:m:null;if(j){let{icon:e=o.createElement(R,null)}=j,t=T(j,["icon"]),r=o.createElement(_.Z,Object.assign({},t),o.cloneElement(e,{className:"".concat(n,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));k=o.createElement(o.Fragment,null,k,r)}let S="optional"===u,M="function"==typeof u;M?k=u(k,{required:!!d}):S&&!d&&(k=o.createElement(o.Fragment,null,k,o.createElement("span",{className:"".concat(n,"-item-optional"),title:""},(null==p?void 0:p.optional)||(null===(t=F.Z.Form)||void 0===t?void 0:t.optional))));let I=l()({["".concat(n,"-item-required")]:d,["".concat(n,"-item-required-mark-optional")]:S||M,["".concat(n,"-item-no-colon")]:!C});return o.createElement(O.Z,Object.assign({},x,{className:E}),o.createElement("label",{htmlFor:a,className:I,title:"string"==typeof r?r:""},k))},W=n(10677),H=n(99537),z=n(77136),D=n(20653),V=n(66155);let A={success:H.Z,warning:D.Z,error:z.Z,validating:V.Z};function B(e){let{children:t,errors:n,warnings:r,hasFeedback:a,validateStatus:c,prefixCls:i,meta:s,noStyle:d}=e,u="".concat(i,"-item"),{feedbackIcons:m}=o.useContext(f.q3),p=(0,y.lR)(n,r,s,null,!!a,c),{isFormItemInput:g,status:h,hasFeedback:b,feedbackIcon:v}=o.useContext(f.aM),x=o.useMemo(()=>{var e;let t;if(a){let c=!0!==a&&a.icons||m,i=p&&(null===(e=null==c?void 0:c({status:p,errors:n,warnings:r}))||void 0===e?void 0:e[p]),s=p&&A[p];t=!1!==i&&s?o.createElement("span",{className:l()("".concat(u,"-feedback-icon"),"".concat(u,"-feedback-icon-").concat(p))},i||o.createElement(s,null)):null}let c={status:p||"",errors:n,warnings:r,hasFeedback:!!a,feedbackIcon:t,isFormItemInput:!0};return d&&(c.status=(null!=p?p:h)||"",c.isFormItemInput=g,c.hasFeedback=!!(null!=a?a:b),c.feedbackIcon=void 0!==a?c.feedbackIcon:v),c},[p,a,d,g,h]);return o.createElement(f.aM.Provider,{value:x},t)}var X=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};function G(e){let{prefixCls:t,className:n,rootClassName:r,style:a,help:c,errors:i,warnings:s,validateStatus:d,meta:u,hasFeedback:m,hidden:p,children:g,fieldId:h,required:b,isRequired:v,onSubItemMetaChange:O}=e,C=X(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),j="".concat(t,"-item"),{requiredMark:S}=o.useContext(f.q3),M=o.useRef(null),N=(0,W.Z)(i),Z=(0,W.Z)(s),q=null!=c,R=!!(q||i.length||s.length),F=!!M.current&&(0,x.Z)(M.current),[P,_]=o.useState(null);(0,w.Z)(()=>{R&&M.current&&_(parseInt(getComputedStyle(M.current).marginBottom,10))},[R,F]);let T=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?N:u.errors,n=e?Z:u.warnings;return(0,y.lR)(t,n,u,"",!!m,d)}(),H=l()(j,n,r,{["".concat(j,"-with-help")]:q||N.length||Z.length,["".concat(j,"-has-feedback")]:T&&m,["".concat(j,"-has-success")]:"success"===T,["".concat(j,"-has-warning")]:"warning"===T,["".concat(j,"-has-error")]:"error"===T,["".concat(j,"-is-validating")]:"validating"===T,["".concat(j,"-hidden")]:p});return o.createElement("div",{className:H,style:a,ref:M},o.createElement(k.Z,Object.assign({className:"".concat(j,"-row")},(0,E.Z)(C,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),o.createElement(L,Object.assign({htmlFor:h},e,{requiredMark:S,required:null!=b?b:v,prefixCls:t})),o.createElement(I,Object.assign({},e,u,{errors:N,warnings:Z,prefixCls:t,status:T,help:c,marginBottom:P,onErrorVisibleChanged:e=>{e||_(null)}}),o.createElement(f.qI.Provider,{value:O},o.createElement(B,{prefixCls:t,meta:u,errors:u.errors,warnings:u.warnings,hasFeedback:m,validateStatus:T},g)))),!!P&&o.createElement("div",{className:"".concat(j,"-margin-offset"),style:{marginBottom:-P}}))}let U=o.memo(e=>{let{children:t}=e;return t},(e,t)=>(function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],o=t[n];return r===o||"function"==typeof r||"function"==typeof o})})(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function $(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let K=function(e){let{name:t,noStyle:n,className:a,dependencies:h,prefixCls:x,shouldUpdate:w,rules:E,children:k,required:O,label:C,messageVariables:j,trigger:S="onChange",validateTrigger:M,hidden:I,help:N}=e,{getPrefixCls:Z}=o.useContext(m.E_),{name:q}=o.useContext(f.q3),R=function(e){if("function"==typeof e)return e;let t=(0,g.Z)(e);return t.length<=1?t[0]:t}(k),F="function"==typeof R,P=o.useContext(f.qI),{validateTrigger:_}=o.useContext(c.zb),T=void 0!==M?M:_,L=null!=t,W=Z("form",x),H=(0,p.Z)(W),[z,D,V]=(0,v.ZP)(W,H);(0,u.ln)("Form.Item");let A=o.useContext(c.ZM),X=o.useRef(),[K,Y]=function(e){let[t,n]=o.useState(e),r=(0,o.useRef)(null),a=(0,o.useRef)([]),l=(0,o.useRef)(!1);return o.useEffect(()=>(l.current=!1,()=>{l.current=!0,b.Z.cancel(r.current),r.current=null}),[]),[t,function(e){l.current||(null===r.current&&(a.current=[],r.current=(0,b.Z)(()=>{r.current=null,n(e=>{let t=e;return a.current.forEach(e=>{t=e(t)}),t})})),a.current.push(e))}]}({}),[J,Q]=(0,i.Z)(()=>$()),ee=(e,t)=>{Y(n=>{let o=Object.assign({},n),a=[].concat((0,r.Z)(e.name.slice(0,-1)),(0,r.Z)(t)).join("__SPLIT__");return e.destroy?delete o[a]:o[a]=e,o})},[et,en]=o.useMemo(()=>{let e=(0,r.Z)(J.errors),t=(0,r.Z)(J.warnings);return Object.values(K).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[K,J.errors,J.warnings]),er=function(){let{itemRef:e}=o.useContext(f.q3),t=o.useRef({});return function(n,r){let o=r&&"object"==typeof r&&r.ref,a=n.join("_");return(t.current.name!==a||t.current.originRef!==o)&&(t.current.name=a,t.current.originRef=o,t.current.ref=(0,s.sQ)(e(n),o)),t.current.ref}}();function eo(t,r,c){return n&&!I?o.createElement(B,{prefixCls:W,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:J,errors:et,warnings:en,noStyle:!0},t):o.createElement(G,Object.assign({key:"row"},e,{className:l()(a,V,H,D),prefixCls:W,fieldId:r,isRequired:c,errors:et,warnings:en,meta:J,onSubItemMetaChange:ee}),t)}if(!L&&!F&&!h)return z(eo(R));let ea={};return"string"==typeof C?ea.label=C:t&&(ea.label=String(t)),j&&(ea=Object.assign(Object.assign({},ea),j)),z(o.createElement(c.gN,Object.assign({},e,{messageVariables:ea,trigger:S,validateTrigger:T,onMetaChange:e=>{let t=null==A?void 0:A.getKey(e.name);if(Q(e.destroy?$():e,!0),n&&!1!==N&&P){let n=e.name;if(e.destroy)n=X.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),X.current=n}P(e,n)}}}),(n,a,l)=>{let c=(0,y.qo)(t).length&&a?a.name:[],i=(0,y.dD)(c,q),u=void 0!==O?O:!!(E&&E.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(l);return t&&t.required&&!t.warningOnly}return!1})),m=Object.assign({},n),p=null;if(Array.isArray(R)&&L)p=R;else if(F&&(!(w||h)||L));else if(!h||F||L){if((0,d.l$)(R)){let t=Object.assign(Object.assign({},R.props),m);if(t.id||(t.id=i),N||et.length>0||en.length>0||e.extra){let n=[];(N||et.length>0)&&n.push("".concat(i,"_help")),e.extra&&n.push("".concat(i,"_extra")),t["aria-describedby"]=n.join(" ")}et.length>0&&(t["aria-invalid"]="true"),u&&(t["aria-required"]="true"),(0,s.Yr)(R)&&(t.ref=er(c,R)),new Set([].concat((0,r.Z)((0,y.qo)(S)),(0,r.Z)((0,y.qo)(T)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),l=0;l{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}},60620:function(e,t,n){n.d(t,{Z:function(){return N}});var r=n(30367),o=n(64090),a=n(16480),l=n.n(a),c=n(76570),i=n(57499),s=n(17094),d=n(92935),u=n(10693),m=n(97303),p=n(47137);let f=e=>"object"==typeof e&&null!=e&&1===e.nodeType,g=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,h=(e,t)=>{if(e.clientHeight{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeightat||a>e&&l=t&&c>=n?a-e-r:l>t&&cn?l-t+o:0,v=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},y=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:l,block:c,inline:i,boundary:s,skipOverflowHiddenElements:d}=t,u="function"==typeof s?s:e=>e!==s;if(!f(e))throw TypeError("Invalid target");let m=document.scrollingElement||document.documentElement,p=[],g=e;for(;f(g)&&u(g);){if((g=v(g))===m){p.push(g);break}null!=g&&g===document.body&&h(g)&&!h(document.documentElement)||null!=g&&h(g,d)&&p.push(g)}let y=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,x=null!=(a=null==(o=window.visualViewport)?void 0:o.height)?a:innerHeight,{scrollX:w,scrollY:E}=window,{height:k,width:O,top:C,right:j,bottom:S,left:M}=e.getBoundingClientRect(),{top:I,right:N,bottom:Z,left:q}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),R="start"===c||"nearest"===c?C-I:"end"===c?S+Z:C+k/2-I+Z,F="center"===i?M+O/2-q+N:"end"===i?j+N:M-q,P=[];for(let e=0;e=0&&M>=0&&S<=x&&j<=y&&C>=o&&S<=s&&M>=d&&j<=a)break;let u=getComputedStyle(t),f=parseInt(u.borderLeftWidth,10),g=parseInt(u.borderTopWidth,10),h=parseInt(u.borderRightWidth,10),v=parseInt(u.borderBottomWidth,10),I=0,N=0,Z="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-h:0,q="offsetHeight"in t?t.offsetHeight-t.clientHeight-g-v:0,_="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,T="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(m===t)I="start"===c?R:"end"===c?R-x:"nearest"===c?b(E,E+x,x,g,v,E+R,E+R+k,k):R-x/2,N="start"===i?F:"center"===i?F-y/2:"end"===i?F-y:b(w,w+y,y,f,h,w+F,w+F+O,O),I=Math.max(0,I+E),N=Math.max(0,N+w);else{I="start"===c?R-o-g:"end"===c?R-s+v+q:"nearest"===c?b(o,s,n,g,v+q,R,R+k,k):R-(o+n/2)+q/2,N="start"===i?F-d-f:"center"===i?F-(d+r/2)+Z/2:"end"===i?F-a+h+Z:b(d,a,r,f,h+Z,F,F+O,O);let{scrollLeft:e,scrollTop:l}=t;I=0===T?0:Math.max(0,Math.min(l+I/T,t.scrollHeight-n/T+q)),N=0===_?0:Math.max(0,Math.min(e+N/_,t.scrollWidth-r/_+Z)),R+=l-I,F+=e-N}P.push({el:t,top:I,left:N})}return P},x=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"};var w=n(47276);function E(e){return(0,w.qo)(e).join("_")}function k(e){let[t]=(0,c.cI)(),n=o.useRef({}),r=o.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=E(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,w.qo)(e),o=(0,w.dD)(n,r.__INTERNAL__.name),a=o?document.getElementById(o):null;a&&function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(y(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:l}of y(e,x(t))){let e=a-n.top+n.bottom,t=l-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(a,Object.assign({scrollMode:"if-needed",block:"nearest"},t))},getFieldInstance:e=>{let t=E(e);return n.current[t]}}),[e,t]);return[r]}var O=n(77906),C=n(12519),j=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};let S=o.forwardRef((e,t)=>{let n=o.useContext(s.Z),{getPrefixCls:r,direction:a,form:f}=o.useContext(i.E_),{prefixCls:g,className:h,rootClassName:b,size:v,disabled:y=n,form:x,colon:w,labelAlign:E,labelWrap:S,labelCol:M,wrapperCol:I,hideRequiredMark:N,layout:Z="horizontal",scrollToFirstError:q,requiredMark:R,onFinishFailed:F,name:P,style:_,feedbackIcons:T,variant:L}=e,W=j(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),H=(0,u.Z)(v),z=o.useContext(C.Z),D=(0,o.useMemo)(()=>void 0!==R?R:!N&&(!f||void 0===f.requiredMark||f.requiredMark),[N,R,f]),V=null!=w?w:null==f?void 0:f.colon,A=r("form",g),B=(0,d.Z)(A),[X,G,U]=(0,O.ZP)(A,B),$=l()(A,"".concat(A,"-").concat(Z),{["".concat(A,"-hide-required-mark")]:!1===D,["".concat(A,"-rtl")]:"rtl"===a,["".concat(A,"-").concat(H)]:H},U,B,G,null==f?void 0:f.className,h,b),[K]=k(x),{__INTERNAL__:Y}=K;Y.name=P;let J=(0,o.useMemo)(()=>({name:P,labelAlign:E,labelCol:M,labelWrap:S,wrapperCol:I,vertical:"vertical"===Z,colon:V,requiredMark:D,itemRef:Y.itemRef,form:K,feedbackIcons:T}),[P,E,M,I,Z,V,D,K,T]);o.useImperativeHandle(t,()=>K);let Q=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=e),K.scrollToField(t,n)}};return X(o.createElement(p.pg.Provider,{value:L},o.createElement(s.n,{disabled:y},o.createElement(m.Z.Provider,{value:H},o.createElement(p.RV,{validateMessages:z},o.createElement(p.q3.Provider,{value:J},o.createElement(c.ZP,Object.assign({id:P},W,{name:P,onFinishFailed:e=>{if(null==F||F(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==q){Q(q,t);return}f&&void 0!==f.scrollToFirstError&&Q(f.scrollToFirstError,t)}},form:K,style:Object.assign(Object.assign({},null==f?void 0:f.style),_),className:$}))))))))});var M=n(84406),I=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};S.Item=M.Z,S.List=e=>{var{prefixCls:t,children:n}=e,r=I(e,["prefixCls","children"]);let{getPrefixCls:a}=o.useContext(i.E_),l=a("form",t),s=o.useMemo(()=>({prefixCls:l,status:"error"}),[l]);return o.createElement(c.aV,Object.assign({},r),(e,t,r)=>o.createElement(p.Rk.Provider,{value:s},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:r.errors,warnings:r.warnings})))},S.ErrorList=r.Z,S.useForm=k,S.useFormInstance=function(){let{form:e}=(0,o.useContext)(p.q3);return e},S.useWatch=c.qo,S.Provider=p.RV,S.create=()=>{};var N=S},77906:function(e,t,n){n.d(t,{ZP:function(){return x},B4:function(){return y}});var r=n(8985),o=n(11303),a=n(58854),l=n(46154),c=n(80316),i=n(76585),s=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut," !important"),["&".concat(r,"-appear, &").concat(r,"-enter")]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},["&".concat(r,"-leave-active")]:{transform:"translateY(-5px)"}}}}};let d=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:"0 0 0 ".concat((0,r.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),u=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},m=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),d(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},u(e,e.controlHeightSM)),"&-large":Object.assign({},u(e,e.controlHeightLG))})}},p=e=>{let{formItemCls:t,iconCls:n,componentCls:r,rootPrefixCls:l,labelRequiredMarkColor:c,labelColor:i,labelFontSize:s,labelHeight:d,labelColonMarginInlineStart:u,labelColonMarginInlineEnd:m,itemMarginBottom:p}=e;return{[t]:Object.assign(Object.assign({},(0,o.Wf)(e)),{marginBottom:p,verticalAlign:"top","&-with-help":{transition:"none"},["&-hidden,\n &-hidden.".concat(l,"-row")]:{display:"none"},"&-has-warning":{["".concat(t,"-split")]:{color:e.colorError}},"&-has-error":{["".concat(t,"-split")]:{color:e.colorWarning}},["".concat(t,"-label")]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:d,color:i,fontSize:s,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required:not(").concat(t,"-required-mark-optional)::before")]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:c,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:u,marginInlineEnd:m},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(l,"-col-'\"]):not([class*=\"' ").concat(l,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:"color ".concat(e.motionDurationMid," ").concat(e.motionEaseOut)},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},["&-with-help ".concat(t,"-explain")]:{height:"auto",opacity:1},["".concat(t,"-feedback-icon")]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:a.kr,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},f=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-horizontal")]:{["".concat(n,"-label")]:{flexGrow:0},["".concat(n,"-control")]:{flex:"1 1 0",minWidth:0},["".concat(n,"-label[class$='-24'], ").concat(n,"-label[class*='-24 ']")]:{["& + ".concat(n,"-control")]:{minWidth:"unset"}}}}},g=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},["> ".concat(n,"-label,\n > ").concat(n,"-control")]:{display:"inline-block",verticalAlign:"top"},["> ".concat(n,"-label")]:{flex:"none"},["".concat(t,"-text")]:{display:"inline-block"},["".concat(n,"-has-feedback")]:{display:"inline-block"}}}}},h=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),b=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:h(e),["".concat(t,":not(").concat(t,"-inline)")]:{[n]:{flexWrap:"wrap",["".concat(n,"-label, ").concat(n,"-control")]:{['&:not([class*=" '.concat(r,'-col-xs"])')]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},v=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:o}=e;return{["".concat(t,"-vertical")]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},["".concat(t,"-item-control")]:{width:"100%"}}},["".concat(t,"-vertical ").concat(n,"-label,\n .").concat(o,"-col-24").concat(n,"-label,\n .").concat(o,"-col-xl-24").concat(n,"-label")]:h(e),["@media (max-width: ".concat((0,r.bf)(e.screenXSMax),")")]:[b(e),{[t]:{[".".concat(o,"-col-xs-24").concat(n,"-label")]:h(e)}}],["@media (max-width: ".concat((0,r.bf)(e.screenSMMax),")")]:{[t]:{[".".concat(o,"-col-sm-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenMDMax),")")]:{[t]:{[".".concat(o,"-col-md-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenLGMax),")")]:{[t]:{[".".concat(o,"-col-lg-24").concat(n,"-label")]:h(e)}}}},y=(e,t)=>(0,c.TS)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var x=(0,i.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=y(e,n);return[m(r),p(r),s(r),f(r),g(r),v(r),(0,l.Z)(r),a.kr]},e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:"0 0 ".concat(e.paddingXS,"px"),verticalLabelMargin:0}),{order:-1e3})},47276:function(e,t,n){n.d(t,{dD:function(){return a},lR:function(){return l},qo:function(){return o}});let r=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function a(e,t){if(!e.length)return;let n=e.join("_");return t?"".concat(t,"_").concat(n):r.includes(n)?"".concat("form_item","_").concat(n):n}function l(e,t,n,r,o,a){let l=r;return void 0!==a?l=a:n.validating?l="validating":e.length?l="error":t.length?l="warning":(n.touched||o&&n.validated)&&(l="success"),l}},24305:function(e,t,n){let r=(0,n(64090).createContext)({});t.Z=r},90791:function(e,t,n){var r=n(64090),o=n(16480),a=n.n(o),l=n(57499),c=n(24305),i=n(37148),s=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};let d=["xs","sm","md","lg","xl","xxl"],u=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(l.E_),{gutter:u,wrap:m}=r.useContext(c.Z),{prefixCls:p,span:f,order:g,offset:h,push:b,pull:v,className:y,children:x,flex:w,style:E}=e,k=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),O=n("col",p),[C,j,S]=(0,i.cG)(O),M={};d.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete k[t],M=Object.assign(Object.assign({},M),{["".concat(O,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(O,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(O,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(O,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(O,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(O,"-").concat(t,"-flex-").concat(n.flex)]:n.flex||"auto"===n.flex,["".concat(O,"-rtl")]:"rtl"===o})});let I=a()(O,{["".concat(O,"-").concat(f)]:void 0!==f,["".concat(O,"-order-").concat(g)]:g,["".concat(O,"-offset-").concat(h)]:h,["".concat(O,"-push-").concat(b)]:b,["".concat(O,"-pull-").concat(v)]:v},y,M,j,S),N={};if(u&&u[0]>0){let e=u[0]/2;N.paddingLeft=e,N.paddingRight=e}return w&&(N.flex="number"==typeof w?"".concat(w," ").concat(w," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(w)?"0 0 ".concat(w):w,!1!==m||N.minWidth||(N.minWidth=0)),C(r.createElement("div",Object.assign({},k,{style:Object.assign(Object.assign({},N),E),className:I,ref:t}),x))});t.Z=u},5056:function(e,t,n){n.d(t,{Z:function(){return g}});var r=n(64090),o=n(16480),a=n.n(o),l=n(24750);let c=["xxl","xl","lg","md","sm","xs"],i=e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}),s=e=>{let t=[].concat(c).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),l="screen".concat(o);if(!(e[a]<=e[l]))throw Error("".concat(a,"<=").concat(l," fails : !(").concat(e[a],"<=").concat(e[l],")"));if(rt.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};function f(e,t){let[n,o]=r.useState("string"==typeof e?e:""),a=()=>{if("string"==typeof e&&o(e),"object"==typeof e)for(let n=0;n{a()},[JSON.stringify(e),t]),n}var g=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:g,className:h,style:b,children:v,gutter:y=0,wrap:x}=e,w=p(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:E,direction:k}=r.useContext(d.E_),[O,C]=r.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[j,S]=r.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),M=f(g,j),I=f(o,j),N=r.useRef(y),Z=function(){let[,e]=(0,l.ZP)(),t=i(s(e));return r.useMemo(()=>{let e=new Map,n=-1,r={};return{matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},unregister(){Object.keys(t).forEach(e=>{let n=t[e],r=this.matchHandlers[n];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),e.clear()},register(){Object.keys(t).forEach(e=>{let n=t[e],o=t=>{let{matches:n}=t;this.dispatch(Object.assign(Object.assign({},r),{[e]:n}))},a=window.matchMedia(n);a.addListener(o),this.matchHandlers[n]={mql:a,listener:o},o(a)})},responsiveMap:t}},[e])}();r.useEffect(()=>{let e=Z.subscribe(e=>{S(e);let t=N.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&C(e)});return()=>Z.unsubscribe(e)},[]);let q=E("row",n),[R,F,P]=(0,m.VM)(q),_=(()=>{let e=[void 0,void 0];return(Array.isArray(y)?y:[y,void 0]).forEach((t,n)=>{if("object"==typeof t)for(let r=0;r0?-(_[0]/2):void 0;W&&(L.marginLeft=W,L.marginRight=W),[,L.rowGap]=_;let[H,z]=_,D=r.useMemo(()=>({gutter:[H,z],wrap:x}),[H,z,x]);return R(r.createElement(u.Z.Provider,{value:D},r.createElement("div",Object.assign({},w,{className:T,style:Object.assign(Object.assign({},L),b),ref:t}),v)))})},37148:function(e,t,n){n.d(t,{VM:function(){return d},cG:function(){return u}});var r=n(8985),o=n(76585),a=n(80316);let l=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{componentCls:n,gridColumns:r}=e,o={};for(let e=r;e>=0;e--)0===e?(o["".concat(n).concat(t,"-").concat(e)]={display:"none"},o["".concat(n,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:0},o["".concat(n).concat(t,"-order-").concat(e)]={order:0}):(o["".concat(n).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/r*100,"%"),maxWidth:"".concat(e/r*100,"%")}],o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-order-").concat(e)]={order:e});return o},i=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},i(e,n))}),d=(0,o.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,o.I$)("Grid",e=>{let t=(0,a.TS)(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[l(t),i(t,""),i(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},46154:function(e,t){t.Z=e=>({[e.componentCls]:{["".concat(e.antCls,"-motion-collapse-legacy")]:{overflow:"hidden","&-active":{transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}},["".concat(e.antCls,"-motion-collapse")]:{overflow:"hidden",transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}}})},37963:function(e,t,n){n.d(t,{o:function(){return o}});class r extends Error{}function o(e,t){let n;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let o=!0===t.header?0:1,a=e.split(".")[o];if("string"!=typeof a)throw new r("Invalid token specified: missing part #".concat(o+1));try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var n;return n=t,decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return atob(t)}}(a)}catch(e){throw new r("Invalid token specified: invalid base64 for part #".concat(o+1," (").concat(e.message,")"))}try{return JSON.parse(n)}catch(e){throw new r("Invalid token specified: invalid json for part #".concat(o+1," (").concat(e.message,")"))}}r.prototype.name="InvalidTokenError"}}]);
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
similarity index 95%
rename from ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js
rename to litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
index f2cde7c99..491420a5f 100644
--- a/ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
@@ -1 +1 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{61994:function(e,s,l){Promise.resolve().then(l.bind(l,667))},667:function(e,s,l){"use strict";l.r(s),l.d(s,{default:function(){return Z}});var t=l(3827),a=l(64090),r=l(47907),n=l(16450),i=l(18190),o=l(13810),u=l(10384),c=l(46453),d=l(71801),m=l(52273),h=l(42440),x=l(30953),f=l(777),j=l(37963),p=l(81583),g=l(1861);function Z(){let[e]=p.Z.useForm(),s=(0,r.useSearchParams)();s.get("token");let l=s.get("id"),[Z,_]=(0,a.useState)(null),[b,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(""),[S,y]=(0,a.useState)(""),[v,E]=(0,a.useState)("");return(0,a.useEffect)(()=>{l&&(0,f.W_)(l).then(e=>{let s=e.login_url;console.log("login_url:",s),y(s);let l=e.token,t=(0,j.o)(l);E(l),console.log("decoded:",t),_(t.key),console.log("decoded user email:",t.user_email),k(t.user_email)})},[l]),(0,t.jsx)("div",{className:"mx-auto max-w-md mt-10",children:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(h.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,t.jsx)(h.Z,{className:"text-xl",children:"Sign up"}),(0,t.jsx)(d.Z,{children:"Claim your user account to login to Admin UI."}),(0,t.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,t.jsxs)(c.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,t.jsx)(u.Z,{children:"SSO is under the Enterprise Tirer."}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,t.jsxs)(p.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",Z,"token:",v,"formValues:",e),Z&&v&&(e.user_email=N,(0,f.pf)(Z,e,null).then(e=>{var s;let l="/ui/";console.log("redirecting to:",l+="?userID="+((null===(s=e.data)||void 0===s?void 0:s.user_id)||e.user_id)+"&token="+v),window.location.href=l}))},children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(m.Z,{type:"email",disabled:!0,value:N,defaultValue:N,className:"max-w-md"})}),(0,t.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"Create a password for your account",children:(0,t.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Sign Up"})})]})]})})}}},function(e){e.O(0,[665,294,235,777,971,69,744],function(){return e(e.s=61994)}),_N_E=e.O()}]);
\ No newline at end of file
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{61994:function(e,s,l){Promise.resolve().then(l.bind(l,667))},667:function(e,s,l){"use strict";l.r(s),l.d(s,{default:function(){return Z}});var t=l(3827),a=l(64090),r=l(47907),n=l(16450),i=l(18190),o=l(13810),u=l(10384),c=l(46453),d=l(71801),m=l(52273),h=l(42440),x=l(30953),f=l(777),j=l(37963),p=l(60620),g=l(1861);function Z(){let[e]=p.Z.useForm(),s=(0,r.useSearchParams)();s.get("token");let l=s.get("id"),[Z,_]=(0,a.useState)(null),[b,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(""),[S,y]=(0,a.useState)(""),[v,E]=(0,a.useState)("");return(0,a.useEffect)(()=>{l&&(0,f.W_)(l).then(e=>{let s=e.login_url;console.log("login_url:",s),y(s);let l=e.token,t=(0,j.o)(l);E(l),console.log("decoded:",t),_(t.key),console.log("decoded user email:",t.user_email),k(t.user_email)})},[l]),(0,t.jsx)("div",{className:"mx-auto max-w-md mt-10",children:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(h.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,t.jsx)(h.Z,{className:"text-xl",children:"Sign up"}),(0,t.jsx)(d.Z,{children:"Claim your user account to login to Admin UI."}),(0,t.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,t.jsxs)(c.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,t.jsx)(u.Z,{children:"SSO is under the Enterprise Tirer."}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,t.jsxs)(p.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",Z,"token:",v,"formValues:",e),Z&&v&&(e.user_email=N,(0,f.pf)(Z,e,null).then(e=>{var s;let l="/ui/";console.log("redirecting to:",l+="?userID="+((null===(s=e.data)||void 0===s?void 0:s.user_id)||e.user_id)+"&token="+v),window.location.href=l}))},children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(m.Z,{type:"email",disabled:!0,value:N,defaultValue:N,className:"max-w-md"})}),(0,t.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"Create a password for your account",children:(0,t.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Sign Up"})})]})]})})}}},function(e){e.O(0,[665,294,684,777,971,69,744],function(){return e(e.s=61994)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-42570e92ea8bcf56.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-42570e92ea8bcf56.js
deleted file mode 100644
index 1341da953..000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-42570e92ea8bcf56.js
+++ /dev/null
@@ -1 +0,0 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{20661:function(e,l,s){Promise.resolve().then(s.bind(s,30217))},30217:function(e,l,s){"use strict";s.r(l),s.d(l,{default:function(){return le}});var t,n,a=s(3827),r=s(64090),i=s(47907),o=s(8792),d=s(40491),c=s(65270),m=e=>{let{userID:l,userRole:s,userEmail:t,showSSOBanner:n,premiumUser:r}=e;console.log("User ID:",l),console.log("userEmail:",t),console.log("showSSOBanner:",n),console.log("premiumUser:",r);let i=[{key:"1",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:["Role: ",s]}),(0,a.jsxs)("p",{children:["ID: ",l]}),(0,a.jsxs)("p",{children:["Premium User: ",String(r)]})]})},{key:"2",label:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("p",{children:"Logout"})})}];return(0,a.jsxs)("nav",{className:"left-0 right-0 top-0 flex justify-between items-center h-12 mb-4",children:[(0,a.jsx)("div",{className:"text-left my-2 absolute top-0 left-0",children:(0,a.jsx)("div",{className:"flex flex-col items-center",children:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("button",{className:"text-gray-800 rounded text-center",children:(0,a.jsx)("img",{src:"/get_image",width:160,height:160,alt:"LiteLLM Brand",className:"mr-2"})})})})}),(0,a.jsxs)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0 flex items-center justify-end space-x-2",children:[n?(0,a.jsx)("div",{style:{padding:"6px",borderRadius:"8px"},children:(0,a.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",style:{fontSize:"14px",textDecoration:"underline"},children:"Get enterpise license"})}):null,(0,a.jsx)("div",{style:{border:"1px solid #391085",padding:"6px",borderRadius:"8px"},children:(0,a.jsx)(d.Z,{menu:{items:i},children:(0,a.jsx)(c.Z,{children:t})})})]})]})},u=s(777),h=s(10384),x=s(46453),p=s(16450),j=s(52273),g=s(26780),Z=s(15595),_=s(6698),f=s(71801),y=s(42440),b=s(42308),v=s(50670),S=s(81583),k=s(80588),w=s(99129),N=s(44839),A=s(88707),I=s(1861);let{Option:C}=v.default;var E=e=>{let{userID:l,team:s,userRole:t,accessToken:n,data:i,setData:o}=e,[d]=S.Z.useForm(),[c,m]=(0,r.useState)(!1),[E,P]=(0,r.useState)(null),[T,O]=(0,r.useState)(null),[F,R]=(0,r.useState)([]),[M,L]=(0,r.useState)([]),U=()=>{m(!1),d.resetFields()},D=()=>{m(!1),P(null),d.resetFields()};(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===t)return;if(null!==n){let e=(await (0,u.So)(n,l,t)).data.map(e=>e.id);console.log("available_model_names:",e),R(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,t]);let K=async e=>{try{var s,t,a;let r=null!==(s=null==e?void 0:e.key_alias)&&void 0!==s?s:"",c=null!==(t=null==e?void 0:e.team_id)&&void 0!==t?t:null;if((null!==(a=null==i?void 0:i.filter(e=>e.team_id===c).map(e=>e.key_alias))&&void 0!==a?a:[]).includes(r))throw Error("Key alias ".concat(r," already exists for team with ID ").concat(c,", please provide another key alias"));k.ZP.info("Making API Call"),m(!0);let h=await (0,u.wX)(n,l,e);console.log("key create Response:",h),o(e=>e?[...e,h]:[h]),P(h.key),O(h.soft_budget),k.ZP.success("API Key Created"),d.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,r.useEffect)(()=>{L(s&&s.models.length>0?s.models.includes("all-proxy-models")?F:s.models:F)},[s,F]),(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>m(!0),children:"+ Create New Key"}),(0,a.jsx)(w.Z,{title:"Create Key",visible:c,width:800,footer:null,onOk:U,onCancel:D,children:(0,a.jsxs)(S.Z,{form:d,onFinish:K,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",hidden:!0,initialValue:s?s.team_id:null,valuePropName:"team_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s?s.team_alias:"",disabled:!0})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},onChange:e=>{e.includes("all-team-models")&&d.setFieldsValue({models:["all-team-models"]})},children:[(0,a.jsx)(C,{value:"all-team-models",children:"All Team Models"},"all-team-models"),M.map(e=>(0,a.jsx)(C,{value:e,children:e},e))]})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(_.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==s?void 0:s.max_budget)!==null&&(null==s?void 0:s.max_budget)!==void 0?null==s?void 0:s.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.max_budget&&l>s.max_budget)throw Error("Budget cannot exceed team max budget: $".concat(s.max_budget))}}],children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",help:"Team Reset Budget: ".concat((null==s?void 0:s.budget_duration)!==null&&(null==s?void 0:s.budget_duration)!==void 0?null==s?void 0:s.budget_duration:"None"),children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Tokens per minute Limit (TPM)",name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==s?void 0:s.tpm_limit)!==null&&(null==s?void 0:s.tpm_limit)!==void 0?null==s?void 0:s.tpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.tpm_limit&&l>s.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(s.tpm_limit))}}],children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Requests per minute Limit (RPM)",name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==s?void 0:s.rpm_limit)!==null&&(null==s?void 0:s.rpm_limit)!==void 0?null==s?void 0:s.rpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.rpm_limit&&l>s.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(s.rpm_limit))}}],children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Expire Key (eg: 30s, 30h, 30d)",name:"duration",className:"mt-8",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",className:"mt-8",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Key"})})]})}),E&&(0,a.jsx)(w.Z,{visible:c,onOk:U,onCancel:D,footer:null,children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Save your Key"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons, ",(0,a.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,a.jsx)(h.Z,{numColSpan:1,children:null!=E?(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mt-3",children:"API Key:"}),(0,a.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,a.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:E})}),(0,a.jsx)(b.CopyToClipboard,{text:E,onCopy:()=>{k.ZP.success("API Key copied to clipboard")},children:(0,a.jsx)(p.Z,{className:"mt-3",children:"Copy API Key"})})]}):(0,a.jsx)(f.Z,{children:"Key being created, this might take 30s"})})]})})]})},P=s(9454),T=s(98941),O=s(33393),F=s(5),R=s(13810),M=s(61244),L=s(10827),U=s(3851),D=s(2044),K=s(64167),q=s(74480),B=s(7178),V=s(95093),z=s(27166);let{Option:W}=v.default;var G=e=>{let{userID:l,userRole:s,accessToken:t,selectedTeam:n,data:i,setData:o,teams:d}=e,[c,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(!1),[j,g]=(0,r.useState)(null),[Z,_]=(0,r.useState)(null),[b,C]=(0,r.useState)(null),[E,G]=(0,r.useState)(""),[H,Y]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),[$,Q]=(0,r.useState)(null),[ee,el]=(0,r.useState)([]),es=new Set,[et,en]=(0,r.useState)(es);(0,r.useEffect)(()=>{(async()=>{try{if(null===l)return;if(null!==t&&null!==s){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),el(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[t,l,s]),(0,r.useEffect)(()=>{if(d){let e=new Set;d.forEach((l,s)=>{let t=l.team_id;e.add(t)}),en(e)}},[d]);let ea=e=>{console.log("handleEditClick:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),Q(e),Y(!0)},er=async e=>{if(null==t)return;let l=e.token;e.key=l,console.log("handleEditSubmit:",e);let s=await (0,u.Nc)(t,e);console.log("handleEditSubmit: newKeyValues",s),i&&o(i.map(e=>e.token===l?s:e)),k.ZP.success("Key updated successfully"),Y(!1),Q(null)},ei=async e=>{console.log("handleDelete:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),null!=i&&(g(e.token),localStorage.removeItem("userData"+l),x(!0))},eo=async()=>{if(null!=j&&null!=i){try{await (0,u.I1)(t,j);let e=i.filter(e=>e.token!==j);o(e)}catch(e){console.error("Error deleting the key:",e)}x(!1),g(null)}};if(null!=i)return console.log("RERENDER TRIGGERED"),(0,a.jsxs)("div",{children:[(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4 mt-2",children:[(0,a.jsxs)(L.Z,{className:"mt-5 max-h-[300px] min-h-[300px]",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Key Alias"}),(0,a.jsx)(q.Z,{children:"Secret Key"}),(0,a.jsx)(q.Z,{children:"Spend (USD)"}),(0,a.jsx)(q.Z,{children:"Budget (USD)"}),(0,a.jsx)(q.Z,{children:"Models"}),(0,a.jsx)(q.Z,{children:"TPM / RPM Limits"})]})}),(0,a.jsx)(U.Z,{children:i.map(e=>{if(console.log(e),"litellm-dashboard"===e.team_id)return null;if(n){if(console.log("item team id: ".concat(e.team_id,", knownTeamIDs.has(item.team_id): ").concat(et.has(e.team_id),", selectedTeam id: ").concat(n.team_id)),(null!=n.team_id||null===e.team_id||et.has(e.team_id))&&e.team_id!=n.team_id)return null;console.log("item team id: ".concat(e.team_id,", is returned"))}return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{style:{maxWidth:"2px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!=e.key_alias?(0,a.jsx)(f.Z,{children:e.key_alias}):(0,a.jsx)(f.Z,{children:"Not Set"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:e.key_name})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:(()=>{try{return parseFloat(e.spend).toFixed(4)}catch(l){return e.spend}})()})}),(0,a.jsx)(D.Z,{children:null!=e.max_budget?(0,a.jsx)(f.Z,{children:e.max_budget}):(0,a.jsx)(f.Z,{children:"Unlimited"})}),(0,a.jsx)(D.Z,{children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(a.Fragment,{children:n&&n.models&&n.models.length>0?n.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l)):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:"all-proxy-models"})})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(D.Z,{children:(0,a.jsxs)(f.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{})," RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{onClick:()=>{Q(e),X(!0)},icon:P.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:J,onCancel:()=>{X(!1),Q(null)},footer:null,width:800,children:$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-8",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Spend"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:(()=>{try{return parseFloat($.spend).toFixed(4)}catch(e){return $.spend}})()})})]}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Budget"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.max_budget?(0,a.jsx)(a.Fragment,{children:$.max_budget}):(0,a.jsx)(a.Fragment,{children:"Unlimited"})})})]},e.name),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Expires"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor-default font-small text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.expires?(0,a.jsx)(a.Fragment,{children:new Date($.expires).toLocaleString(void 0,{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}):(0,a.jsx)(a.Fragment,{children:"Never"})})})]},e.name)]}),(0,a.jsxs)(R.Z,{className:"my-4",children:[(0,a.jsx)(y.Z,{children:"Token Name"}),(0,a.jsx)(f.Z,{className:"my-1",children:$.key_alias?$.key_alias:$.key_name}),(0,a.jsx)(y.Z,{children:"Token ID"}),(0,a.jsx)(f.Z,{className:"my-1 text-[12px]",children:$.token}),(0,a.jsx)(y.Z,{children:"Metadata"}),(0,a.jsx)(f.Z,{className:"my-1",children:(0,a.jsxs)("pre",{children:[JSON.stringify($.metadata)," "]})})]}),(0,a.jsx)(p.Z,{className:"mx-auto flex items-center",onClick:()=>{X(!1),Q(null)},children:"Close"})]})}),(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>ea(e)}),(0,a.jsx)(M.Z,{onClick:()=>ei(e),icon:O.Z,size:"sm"})]})]},e.token)})})]}),h&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Key"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this key ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:eo,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{x(!1),g(null)},children:"Cancel"})]})]})]})})]}),$&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,token:t,onSubmit:i}=e,[o]=S.Z.useForm(),[c,m]=(0,r.useState)(n),[u,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1);return(0,a.jsx)(w.Z,{title:"Edit Key",visible:l,width:800,footer:null,onOk:()=>{o.validateFields().then(e=>{o.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:o,onFinish:er,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{validator:(e,l)=>{let s=l.filter(e=>!c.models.includes(e)&&"all-team-models"!==e&&"all-proxy-models"!==e&&!c.models.includes("all-proxy-models"));return(console.log("errorModels: ".concat(s)),s.length>0)?Promise.reject("Some models are not part of the new team's models - ".concat(s,"Team models: ").concat(c.models)):Promise.resolve()}}],children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(W,{value:"all-team-models",children:"All Team Models"},"all-team-models"),c&&c.models?c.models.includes("all-proxy-models")?ee.filter(e=>"all-proxy-models"!==e).map(e=>(0,a.jsx)(W,{value:e,children:e},e)):c.models.map(e=>(0,a.jsx)(W,{value:e,children:e},e)):ee.map(e=>(0,a.jsx)(W,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: ".concat((null==c?void 0:c.max_budget)!==null&&(null==c?void 0:c.max_budget)!==void 0?null==c?void 0:c.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&c&&null!==c.max_budget&&l>c.max_budget)throw console.log("keyTeam.max_budget: ".concat(c.max_budget)),Error("Budget cannot exceed team max budget: $".concat(c.max_budget))}}],children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"token",name:"token",hidden:!0}),(0,a.jsx)(S.Z.Item,{label:"Team",name:"team_id",help:"the team this key belongs to",children:(0,a.jsx)(V.Z,{value:t.team_alias,children:null==d?void 0:d.map((e,l)=>(0,a.jsx)(z.Z,{value:e.team_id,onClick:()=>m(e),children:e.team_alias},l))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Edit Key"})})]})})},{visible:H,onCancel:()=>{Y(!1),Q(null)},token:$,onSubmit:er})]})},H=e=>{let{userID:l,userRole:s,accessToken:t,userSpend:n,selectedTeam:i}=e;console.log("userSpend: ".concat(n));let[o,d]=(0,r.useState)(null!==n?n:0),[c,m]=(0,r.useState)(0),[h,x]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(t&&l&&s&&"Admin"===s&&null==n)try{let e=await (0,u.Qy)(t);e&&(e.spend?d(e.spend):d(0),e.max_budget?m(e.max_budget):m(0))}catch(e){console.error("Error fetching global spend data:",e)}};(async()=>{try{if(null===l||null===s)return;if(null!==t){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),x(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[s,t,l]),(0,r.useEffect)(()=>{null!==n&&d(n)},[n]);let p=[];i&&i.models&&(p=i.models),p&&p.includes("all-proxy-models")?(console.log("user models:",h),p=h):p&&p.includes("all-team-models")?p=i.models:p&&0===p.length&&(p=h);let j=void 0!==o?o.toFixed(4):null;return console.log("spend in view user spend: ".concat(o)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("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:["$",j]})]})})},Y=e=>{let{userID:l,userRole:s,selectedTeam:t,accessToken:n}=e,[i,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===s)return;if(null!==n){let e=(await (0,u.So)(n,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),o(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,s]);let d=[];return t&&t.models&&(d=t.models),d&&d.includes("all-proxy-models")&&(console.log("user models:",i),d=i),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"mb-5",children:(0,a.jsx)("p",{className:"text-3xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:null==t?void 0:t.team_alias})})})},J=e=>{let l,{teams:s,setSelectedTeam:t,userRole:n}=e,i={models:[],team_id:null,team_alias:"Default Team"},[o,d]=(0,r.useState)(i);return(l="App User"===n?s:s?[...s,i]:[i],"App User"===n)?null:(0,a.jsxs)("div",{className:"mt-5 mb-5",children:[(0,a.jsx)(y.Z,{children:"Select Team"}),(0,a.jsx)(f.Z,{children:"If you belong to multiple teams, this setting controls which team is used by default when creating new API Keys."}),(0,a.jsxs)(f.Z,{className:"mt-3 mb-3",children:[(0,a.jsx)("b",{children:"Default Team:"})," If no team_id is set for a key, it will be grouped under here."]}),l&&l.length>0?(0,a.jsx)(V.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(z.Z,{value:String(l),onClick:()=>t(e),children:e.team_alias},l))}):(0,a.jsxs)(f.Z,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]})},X=s(37963),$=s(97482);console.log("isLocal:",!1);var Q=e=>{let{userID:l,userRole:s,teams:t,keys:n,setUserRole:o,userEmail:d,setUserEmail:c,setTeams:m,setKeys:p}=e,[j,g]=(0,r.useState)(null),Z=(0,i.useSearchParams)();Z.get("viewSpend"),(0,i.useRouter)();let _=Z.get("token"),[f,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[S,k]=(0,r.useState)([]),w={models:[],team_alias:"Default Team",team_id:null},[N,A]=(0,r.useState)(t?t[0]:w);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,r.useEffect)(()=>{if(_){let e=(0,X.o)(_);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),y(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),o(l)}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e))}}if(l&&f&&s&&!n&&!j){let e=sessionStorage.getItem("userModels"+l);e?k(JSON.parse(e)):(async()=>{try{let e=await (0,u.Br)(f,l,s,!1,null,null);if(console.log("received teams in user dashboard: ".concat(Object.keys(e),"; team values: ").concat(Object.entries(e.teams))),"Admin"==s){let e=await (0,u.Qy)(f);g(e),console.log("globalSpend:",e)}else g(e.user_info);p(e.keys),m(e.teams);let t=[...e.teams];t.length>0?(console.log("response['teams']: ".concat(t)),A(t[0])):A(w),sessionStorage.setItem("userData"+l,JSON.stringify(e.keys)),sessionStorage.setItem("userSpendData"+l,JSON.stringify(e.user_info));let n=(await (0,u.So)(f,l,s)).data.map(e=>e.id);console.log("available_model_names:",n),k(n),console.log("userModels:",S),sessionStorage.setItem("userModels"+l,JSON.stringify(n))}catch(e){console.error("There was an error fetching the data",e)}})()}},[l,_,f,n,s]),(0,r.useEffect)(()=>{if(null!==n&&null!=N&&null!==N.team_id){let e=0;for(let l of n)N.hasOwnProperty("team_id")&&null!==l.team_id&&l.team_id===N.team_id&&(e+=l.spend);v(e)}else if(null!==n){let e=0;for(let l of n)e+=l.spend;v(e)}},[N]),null==l||null==_){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}if(null==f)return null;if(null==s&&o("App Owner"),s&&"Admin Viewer"==s){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",N),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(Y,{userID:l,userRole:s,selectedTeam:N||null,accessToken:f}),(0,a.jsx)(H,{userID:l,userRole:s,accessToken:f,userSpend:b,selectedTeam:N||null}),(0,a.jsx)(G,{userID:l,userRole:s,accessToken:f,selectedTeam:N||null,data:n,setData:p,teams:t}),(0,a.jsx)(E,{userID:l,team:N||null,userRole:s,accessToken:f,data:n,setData:p},N?N.team_id:null),(0,a.jsx)(J,{teams:t,setSelectedTeam:A,userRole:s})]})})})},ee=s(49167),el=s(35087),es=s(92836),et=s(26734),en=s(41608),ea=s(32126),er=s(23682),ei=s(47047),eo=s(76628),ed=s(25707),ec=s(44041),em=s(6180),eu=s(28683),eh=s(38302),ex=s(66242),ep=s(78578),ej=s(63954),eg=s(34658),eZ=e=>{let{modelID:l,accessToken:s}=e,[t,n]=(0,r.useState)(!1),i=async()=>{try{k.ZP.info("Making API Call"),n(!0);let e=await (0,u.Og)(s,l);console.log("model delete Response:",e),k.ZP.success("Model ".concat(l," deleted successfully")),n(!1)}catch(e){console.error("Error deleting the model:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(M.Z,{onClick:()=>n(!0),icon:O.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:t,onOk:i,okType:"danger",onCancel:()=>n(!1),children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Delete Model"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)("p",{children:"Are you sure you want to delete this model? This action is irreversible."})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Model ID: ",(0,a.jsx)("b",{children:l})]})})]})})]})},e_=s(97766),ef=s(46495),ey=s(18190),eb=s(91118),ev=e=>{let{modelMetrics:l,modelMetricsCategories:s,customTooltip:t,premiumUser:n}=e;return n?(0,a.jsx)(eb.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:s,colors:["indigo","rose"],connectNulls:!0,customTooltip:t}):(0,a.jsxs)("div",{children:[(0,a.jsx)(ey.Z,{title:"✨ Enterprise Feature",color:"teal",className:"mt-2 mb-4",children:"Enterprise features are available for users with a specific license, please contact LiteLLM to unlock this limitation."}),(0,a.jsx)(p.Z,{variant:"primary",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get in touch"})})]})},eS=e=>{let{fields:l,selectedProvider:s}=e;return 0===l.length?null:(0,a.jsx)(a.Fragment,{children:l.map(e=>(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:e.field_name.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),name:e.field_name,tooltip:e.field_description,className:"mb-2",children:(0,a.jsx)(j.Z,{placeholder:e.field_value,type:"password"})},e.field_name))})},ek=s(67951);let{Title:ew,Link:eN}=$.default;(t=n||(n={})).OpenAI="OpenAI",t.Azure="Azure",t.Anthropic="Anthropic",t.Google_AI_Studio="Google AI Studio",t.Bedrock="Amazon Bedrock",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.Databricks="Databricks";let eA={OpenAI:"openai",Azure:"azure",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",OpenAI_Compatible:"openai",Vertex_AI:"vertex_ai",Databricks:"databricks"},eI={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"},eC=async(e,l,s)=>{try{let t=Array.isArray(e.model)?e.model:[e.model];console.log("received deployments: ".concat(t)),console.log("received type of deployments: ".concat(typeof t)),t.forEach(async s=>{console.log("litellm_model: ".concat(s));let t={},n={};t.model=s;let a="";for(let[l,s]of(console.log("formValues add deployment:",e),Object.entries(e)))if(""!==s){if("model_name"==l)a+=s;else if("custom_llm_provider"==l)continue;else if("model"==l)continue;else if("base_model"===l)n[l]=s;else if("litellm_extra_params"==l){console.log("litellm_extra_params:",s);let e={};if(s&&void 0!=s){try{e=JSON.parse(s)}catch(e){throw k.ZP.error("Failed to parse LiteLLM Extra Params: "+e,10),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,s]of Object.entries(e))t[l]=s}}else t[l]=s}let r={model_name:a,litellm_params:t,model_info:n},i=await (0,u.kK)(l,r);console.log("response for model create call: ".concat(i.data))}),s.resetFields()}catch(e){k.ZP.error("Failed to create model: "+e,10)}};var eE=e=>{var l,s,t;let i,{accessToken:o,token:d,userRole:c,userID:m,modelData:h={data:[]},keys:g,setModelData:Z,premiumUser:_}=e,[b,v]=(0,r.useState)([]),[N]=S.Z.useForm(),[C,E]=(0,r.useState)(null),[O,W]=(0,r.useState)(""),[G,H]=(0,r.useState)([]),Y=Object.values(n).filter(e=>isNaN(Number(e))),[J,X]=(0,r.useState)([]),[Q,ey]=(0,r.useState)("OpenAI"),[eb,eE]=(0,r.useState)(""),[eP,eT]=(0,r.useState)(!1),[eO,eF]=(0,r.useState)(!1),[eR,eM]=(0,r.useState)(null),[eL,eU]=(0,r.useState)([]),[eD,eK]=(0,r.useState)(null),[eq,eB]=(0,r.useState)([]),[eV,ez]=(0,r.useState)([]),[eW,eG]=(0,r.useState)([]),[eH,eY]=(0,r.useState)([]),[eJ,eX]=(0,r.useState)([]),[e$,eQ]=(0,r.useState)([]),[e0,e1]=(0,r.useState)([]),[e2,e4]=(0,r.useState)([]),[e5,e8]=(0,r.useState)([]),[e3,e6]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[e9,e7]=(0,r.useState)(null),[le,ll]=(0,r.useState)(0),[ls,lt]=(0,r.useState)({}),[ln,la]=(0,r.useState)([]),[lr,li]=(0,r.useState)(!1),[lo,ld]=(0,r.useState)(null),[lc,lm]=(0,r.useState)(null),[lu,lh]=(0,r.useState)([]);(0,r.useEffect)(()=>{lb(eD,e3.from,e3.to)},[lo,lc]);let lx=e=>{eM(e),eT(!0)},lp=e=>{eM(e),eF(!0)},lj=async e=>{if(console.log("handleEditSubmit:",e),null==o)return;let l={},s=null;for(let[t,n]of Object.entries(e))"model_id"!==t?l[t]=n:s=n;let t={litellm_params:l,model_info:{id:s}};console.log("handleEditSubmit payload:",t);try{await (0,u.um)(o,t),k.ZP.success("Model updated successfully, restart server to see updates"),eT(!1),eM(null)}catch(e){console.log("Error occurred")}},lg=()=>{W(new Date().toLocaleString())},lZ=async()=>{if(!o){console.error("Access token is missing");return}console.log("new modelGroupRetryPolicy:",e9);try{await (0,u.K_)(o,{router_settings:{model_group_retry_policy:e9}}),k.ZP.success("Retry settings saved successfully")}catch(e){console.error("Failed to save retry settings:",e),k.ZP.error("Failed to save retry settings")}};if((0,r.useEffect)(()=>{if(!o||!d||!c||!m)return;let e=async()=>{try{var e,l,s,t,n,a,r,i,d,h,x,p;let j=await (0,u.hy)(o);X(j);let g=await (0,u.AZ)(o,m,c);console.log("Model data response:",g.data),Z(g);let _=new Set;for(let e=0;e0&&(y=f[f.length-1],console.log("_initial_model_group:",y),eK(y)),console.log("selectedModelGroup:",eD);let b=await (0,u.o6)(o,m,c,y,null===(e=e3.from)||void 0===e?void 0:e.toISOString(),null===(l=e3.to)||void 0===l?void 0:l.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model metrics response:",b),ez(b.data),eG(b.all_api_bases);let v=await (0,u.Rg)(o,y,null===(s=e3.from)||void 0===s?void 0:s.toISOString(),null===(t=e3.to)||void 0===t?void 0:t.toISOString());eY(v.data),eX(v.all_api_bases);let S=await (0,u.N8)(o,m,c,y,null===(n=e3.from)||void 0===n?void 0:n.toISOString(),null===(a=e3.to)||void 0===a?void 0:a.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model exceptions response:",S),eQ(S.data),e1(S.exception_types);let k=await (0,u.fP)(o,m,c,y,null===(r=e3.from)||void 0===r?void 0:r.toISOString(),null===(i=e3.to)||void 0===i?void 0:i.toISOString(),null==lo?void 0:lo.token,lc),w=await (0,u.n$)(o,null===(d=e3.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(h=e3.to)||void 0===h?void 0:h.toISOString().split("T")[0],y);lt(w);let N=await (0,u.v9)(o,null===(x=e3.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=e3.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);la(N),console.log("dailyExceptions:",w),console.log("dailyExceptionsPerDeplyment:",N),console.log("slowResponses:",k),e8(k);let A=await (0,u.j2)(o);lh(null==A?void 0:A.end_users);let I=(await (0,u.BL)(o,m,c)).router_settings;console.log("routerSettingsInfo:",I);let C=I.model_group_retry_policy,E=I.num_retries;console.log("model_group_retry_policy:",C),console.log("default_retries:",E),e7(C),ll(E)}catch(e){console.error("There was an error fetching the model data",e)}};o&&d&&c&&m&&e();let l=async()=>{let e=await (0,u.qm)();console.log("received model cost map data: ".concat(Object.keys(e))),E(e)};null==C&&l(),lg()},[o,d,c,m,C,O]),!h||!o||!d||!c||!m)return(0,a.jsx)("div",{children:"Loading..."});let l_=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(C)),null!=C&&"object"==typeof C&&e in C)?C[e].litellm_provider:"openai";if(n){let e=n.split("/"),l=e[0];r=1===e.length?u(n):l}else r="openai";a&&(i=null==a?void 0:a.input_cost_per_token,o=null==a?void 0:a.output_cost_per_token,d=null==a?void 0:a.max_tokens,c=null==a?void 0:a.max_input_tokens),(null==t?void 0:t.litellm_params)&&(m=Object.fromEntries(Object.entries(null==t?void 0:t.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),h.data[e].provider=r,h.data[e].input_cost=i,h.data[e].output_cost=o,h.data[e].input_cost&&(h.data[e].input_cost=(1e6*Number(h.data[e].input_cost)).toFixed(2)),h.data[e].output_cost&&(h.data[e].output_cost=(1e6*Number(h.data[e].output_cost)).toFixed(2)),h.data[e].max_tokens=d,h.data[e].max_input_tokens=c,h.data[e].api_base=null==t?void 0:null===(s=t.litellm_params)||void 0===s?void 0:s.api_base,h.data[e].cleanedLitellmParams=m,l_.push(t.model_name),console.log(h.data[e])}if(c&&"Admin Viewer"==c){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let lf=e=>{console.log("received provider string: ".concat(e));let l=Object.keys(n).find(l=>n[l]===e);if(l){let e=eA[l];console.log("mappingResult: ".concat(e));let s=[];"object"==typeof C&&Object.entries(C).forEach(l=>{let[t,n]=l;null!==n&&"object"==typeof n&&"litellm_provider"in n&&(n.litellm_provider===e||n.litellm_provider.includes(e))&&s.push(t)}),H(s),console.log("providerModels: ".concat(G))}},ly=async()=>{try{k.ZP.info("Running health check..."),eE("");let e=await (0,u.EY)(o);eE(e)}catch(e){console.error("Error running health check:",e),eE("Error running health check")}},lb=async(e,l,s)=>{if(console.log("Updating model metrics for group:",e),!o||!m||!c||!l||!s)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",s),eK(e);let t=null==lo?void 0:lo.token;void 0===t&&(t=null);let n=lc;void 0===n&&(n=null),l.setHours(0),l.setMinutes(0),l.setSeconds(0),s.setHours(23),s.setMinutes(59),s.setSeconds(59);try{let a=await (0,u.o6)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model metrics response:",a),ez(a.data),eG(a.all_api_bases);let r=await (0,u.Rg)(o,e,l.toISOString(),s.toISOString());eY(r.data),eX(r.all_api_bases);let i=await (0,u.N8)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model exceptions response:",i),eQ(i.data),e1(i.exception_types);let d=await (0,u.fP)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);if(console.log("slowResponses:",d),e8(d),e){let t=await (0,u.n$)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);lt(t);let n=await (0,u.v9)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);la(n)}}catch(e){console.error("Failed to fetch model metrics",e)}},lv=(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mb-1",children:"Select API Key Name"}),_?(0,a.jsxs)("div",{children:[(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{ld(e)},children:e.key_alias},l):null)]}),(0,a.jsx)(f.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(V.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(z.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>{lm(e)},children:e},l))]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsxs)(z.Z,{value:String(l),disabled:!0,onClick:()=>{ld(e)},children:["✨ ",e.key_alias," (Enterpise only Feature)"]},l):null)]}),(0,a.jsx)(f.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(V.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(z.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsxs)(z.Z,{value:e,disabled:!0,onClick:()=>{lm(e)},children:["✨ ",e," (Enterpise only Feature)"]},l))]})]})]}),lS=e=>{var l,s;let{payload:t,active:n}=e;if(!n||!t)return null;let r=null===(s=t[0])||void 0===s?void 0:null===(l=s.payload)||void 0===l?void 0:l.date,i=t.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:t.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,a.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[r&&(0,a.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",r]}),i.map((e,l)=>{let s=parseFloat(e.value.toFixed(5)),t=0===s&&e.value>0?"<0.00001":s.toFixed(5);return(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,a.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:t})]},l)})]})};console.log("selectedProvider: ".concat(Q)),console.log("providerModels.length: ".concat(G.length));let lk=Object.keys(n).find(e=>n[e]===Q);return lk&&(i=J.find(e=>e.name===eA[lk])),(0,a.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(es.Z,{children:"All Models"}),(0,a.jsx)(es.Z,{children:"Add Model"}),(0,a.jsx)(es.Z,{children:(0,a.jsx)("pre",{children:"/health Models"})}),(0,a.jsx)(es.Z,{children:"Model Analytics"}),(0,a.jsx)(es.Z,{children:"Model Retry Settings"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[O&&(0,a.jsxs)(f.Z,{children:["Last Refreshed: ",O]}),(0,a.jsx)(M.Z,{icon:ej.Z,variant:"shadow",size:"xs",className:"self-center",onClick:lg})]})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(f.Z,{children:"Filter by Public Model Name"}),(0,a.jsxs)(V.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eD||eL[0],onValueChange:e=>eK("all"===e?"all":e),value:eD||eL[0],children:[(0,a.jsx)(z.Z,{value:"all",children:"All Models"}),eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>eK(e),children:e},l))]})]}),(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{style:{maxWidth:"1500px",width:"100%"},children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Public Model Name"}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Provider"}),"Admin"===c&&(0,a.jsx)(q.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"API Base"}),(0,a.jsxs)(q.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Input Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsxs)(q.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Output Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:_?"Created At":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created At"]})}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:_?"Created By":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created By"]})}),(0,a.jsx)(q.Z,{style:{maxWidth:"50px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Status"}),(0,a.jsx)(q.Z,{})]})}),(0,a.jsx)(U.Z,{children:h.data.filter(e=>"all"===eD||e.model_name===eD||null==eD||""===eD).map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{style:{maxHeight:"1px",minHeight:"1px"},children:[(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.model_name||"-"})}),(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.provider||"-"})}),"Admin"===c&&(0,a.jsx)(D.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)(em.Z,{title:e&&e.api_base,children:(0,a.jsx)("pre",{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},className:"text-xs",title:e&&e.api_base?e.api_base:"",children:e&&e.api_base?e.api_base.slice(0,20):"-"})})}),(0,a.jsx)(D.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.input_cost?e.input_cost:e.litellm_params.input_cost_per_token?(1e6*Number(e.litellm_params.input_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(D.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.output_cost?e.output_cost:e.litellm_params.output_cost_per_token?(1e6*Number(e.litellm_params.output_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:_&&((s=e.model_info.created_at)?new Date(s).toLocaleDateString("en-US"):null)||"-"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:_&&e.model_info.created_by||"-"})}),(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:e.model_info.db_model?(0,a.jsx)(F.Z,{size:"xs",className:"text-white",children:(0,a.jsx)("p",{className:"text-xs",children:"DB Model"})}):(0,a.jsx)(F.Z,{size:"xs",className:"text-black",children:(0,a.jsx)("p",{className:"text-xs",children:"Config Model"})})}),(0,a.jsx)(D.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsxs)(x.Z,{numItems:3,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{icon:P.Z,size:"sm",onClick:()=>lp(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>lx(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(eZ,{modelID:e.model_info.id,accessToken:o})})]})})]},l)})})]})})]}),(0,a.jsx)(e=>{let{visible:l,onCancel:s,model:t,onSubmit:n}=e,[r]=S.Z.useForm(),i={},o="",d="";if(t){i=t.litellm_params,o=t.model_name;let e=t.model_info;e&&(d=e.id,console.log("model_id: ".concat(d)),i.model_id=d)}return(0,a.jsx)(w.Z,{title:"Edit Model "+o,visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n(e),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:lj,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"api_base",name:"api_base",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"tpm",name:"tpm",tooltip:"int (optional) - Tokens limit for this deployment: in tokens per minute (tpm). Find this information on your model/providers website",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"rpm",name:"rpm",tooltip:"int (optional) - Rate limit for this deployment: in requests per minute (rpm). Find this information on your model/providers website",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"max_retries",name:"max_retries",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"timeout",name:"timeout",tooltip:"int (optional) - Timeout in seconds for LLM requests (Defaults to 600 seconds)",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"stream_timeout",name:"stream_timeout",tooltip:"int (optional) - Timeout for stream requests (seconds)",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"input_cost_per_token",name:"input_cost_per_token",tooltip:"float (optional) - Input cost per token",children:(0,a.jsx)(A.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"output_cost_per_token",name:"output_cost_per_token",tooltip:"float (optional) - Output cost per token",children:(0,a.jsx)(A.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"model_id",name:"model_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})},{visible:eP,onCancel:()=>{eT(!1),eM(null)},model:eR,onSubmit:lj}),(0,a.jsxs)(w.Z,{title:eR&&eR.model_name,visible:eO,width:800,footer:null,onCancel:()=>{eF(!1),eM(null)},children:[(0,a.jsx)(y.Z,{children:"Model Info"}),(0,a.jsx)(ek.Z,{language:"json",children:eR&&JSON.stringify(eR,null,2)})]})]}),(0,a.jsxs)(ea.Z,{className:"h-full",children:[(0,a.jsx)(ew,{level:2,children:"Add new model"}),(0,a.jsx)(R.Z,{children:(0,a.jsxs)(S.Z,{form:N,onFinish:()=>{N.validateFields().then(e=>{eC(e,o,N)}).catch(e=>{console.error("Validation failed:",e)})},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(V.Z,{value:Q.toString(),children:Y.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>{lf(e),ey(e)},children:e},l))})}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Public Model Name",name:"model_name",tooltip:"Model name your users will pass in. Also used for load-balancing, LiteLLM will load balance between all models with this public name.",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"Vertex AI (Anthropic, Gemini, etc.)"===(t=Q.toString())?"gemini-pro":"Anthropic"==t?"claude-3-opus":"Amazon Bedrock"==t?"claude-3-opus":"Google AI Studio"==t?"gemini-pro":"gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(f.Z,{className:"mb-3 mt-1",children:"Model name your users will pass in."})})]}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"LiteLLM Model Name(s)",name:"model",tooltip:"Actual model name used for making litellm.completion() call.",className:"mb-0",children:"Azure"===Q?(0,a.jsx)(j.Z,{placeholder:"Enter model name"}):G.length>0?(0,a.jsx)(ei.Z,{value:G,children:G.map((e,l)=>(0,a.jsx)(eo.Z,{value:e,children:e},l))}):(0,a.jsx)(j.Z,{placeholder:"gpt-3.5-turbo-0125"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-3 mt-1",children:["Actual model name used for making"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/providers",target:"_blank",children:"litellm.completion() call"}),". We'll"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/proxy/reliability#step-1---set-deployments-on-config",target:"_blank",children:"loadbalance"})," ","models with the same 'public name'"]})})]}),void 0!==i&&i.fields.length>0&&(0,a.jsx)(eS,{fields:i.fields,selectedProvider:i.name}),"Amazon Bedrock"!=Q&&"Vertex AI (Anthropic, Gemini, etc.)"!=Q&&(void 0===i||0==i.fields.length)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Key",name:"api_key",children:(0,a.jsx)(j.Z,{placeholder:"sk-",type:"password"})}),"OpenAI"==Q&&(0,a.jsx)(S.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,a.jsx)(j.Z,{placeholder:"[OPTIONAL] my-unique-org"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Project",name:"vertex_project",children:(0,a.jsx)(j.Z,{placeholder:"adroit-cadet-1234.."})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Location",name:"vertex_location",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Credentials",name:"vertex_credentials",className:"mb-0",children:(0,a.jsx)(ef.Z,{name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;N.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?k.ZP.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&k.ZP.error("".concat(e.file.name," file upload failed."))},children:(0,a.jsx)(I.ZP,{icon:(0,a.jsx)(e_.Z,{}),children:"Click to Upload"})})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(f.Z,{className:"mb-3 mt-1",children:"Give litellm a gcp service account(.json file), so it can make the relevant calls"})})]}),("Azure"==Q||"OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)"==Q)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Base",name:"api_base",children:(0,a.jsx)(j.Z,{placeholder:"https://..."})}),"Azure"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Version",name:"api_version",children:(0,a.jsx)(j.Z,{placeholder:"2023-07-01-preview"})}),"Azure"==Q&&(0,a.jsxs)("div",{children:[(0,a.jsx)(S.Z.Item,{label:"Base Model",name:"base_model",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"azure/gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,a.jsx)(eN,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Access Key ID",name:"aws_access_key_id",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Secret Access Key",name:"aws_secret_access_key",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Region Name",name:"aws_region_name",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),(0,a.jsx)(S.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-0",children:(0,a.jsx)(ep.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-3 mt-1",children:["Pass JSON of litellm supported params"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]})]}),(0,a.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add Model"})}),(0,a.jsx)(em.Z,{title:"Get help on our github",children:(0,a.jsx)($.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})})]})})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(f.Z,{children:"`/health` will run a very small request through your models configured on litellm"}),(0,a.jsx)(p.Z,{onClick:ly,children:"Run `/health`"}),eb&&(0,a.jsx)("pre",{children:JSON.stringify(eb,null,2)})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:e3,className:"mr-2",onValueChange:e=>{e6(e),lb(eD,e.from,e.to)}})]}),(0,a.jsxs)(eu.Z,{className:"ml-2",children:[(0,a.jsx)(f.Z,{children:"Select Model Group"}),(0,a.jsx)(V.Z,{defaultValue:eD||eL[0],value:eD||eL[0],children:eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>lb(e,e3.from,e3.to),children:e},l))})]}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(ex.Z,{trigger:"click",content:lv,overlayStyle:{width:"20vw"},children:(0,a.jsx)(p.Z,{icon:eg.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>li(!0)})})})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Avg. Latency per Token"}),(0,a.jsx)(es.Z,{value:"2",children:"✨ Time to first token"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,a.jsx)(f.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),eV&&eW&&(0,a.jsx)(ed.Z,{title:"Model Latency",className:"h-72",data:eV,showLegend:!1,index:"date",categories:eW,connectNulls:!0,customTooltip:lS})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ev,{modelMetrics:eH,modelMetricsCategories:eJ,customTooltip:lS,premiumUser:_})})]})]})})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Deployment"}),(0,a.jsx)(q.Z,{children:"Success Responses"}),(0,a.jsxs)(q.Z,{children:["Slow Responses ",(0,a.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,a.jsx)(U.Z,{children:e5.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.api_base}),(0,a.jsx)(D.Z,{children:e.total_count}),(0,a.jsx)(D.Z,{children:e.slow_count})]},l))})]})})})]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(y.Z,{children:["All Up Rate Limit Errors (429) for ",eD]}),(0,a.jsxs)(x.Z,{numItems:1,children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",ls.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:ls.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,a.jsx)(eu.Z,{})]})]}),_?(0,a.jsx)(a.Fragment,{children:ln.map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,a.jsx)(a.Fragment,{children:ln&&ln.length>0&&ln.slice(0,1).map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(f.Z,{children:"Filter by Public Model Name"}),(0,a.jsx)(V.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eD||eL[0],value:eD||eL[0],onValueChange:e=>eK(e),children:eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>eK(e),children:e},l))})]}),(0,a.jsxs)(y.Z,{children:["Retry Policy for ",eD]}),(0,a.jsx)(f.Z,{className:"mb-6",children:"How many retries should be attempted based on the Exception"}),eI&&(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Object.entries(eI).map((e,l)=>{var s;let[t,n]=e,r=null==e9?void 0:null===(s=e9[eD])||void 0===s?void 0:s[n];return null==r&&(r=le),(0,a.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("td",{children:(0,a.jsx)(f.Z,{children:t})}),(0,a.jsx)("td",{children:(0,a.jsx)(A.Z,{className:"ml-5",value:r,min:0,step:1,onChange:e=>{e7(l=>{var s;let t=null!==(s=null==l?void 0:l[eD])&&void 0!==s?s:{};return{...null!=l?l:{},[eD]:{...t,[n]:e}}})}})})]},l)})})}),(0,a.jsx)(p.Z,{className:"mt-6 mr-8",onClick:lZ,children:"Save"})]})]})]})})};let{Option:eP}=v.default;var eT=e=>{let{userID:l,accessToken:s,teams:t}=e,[n]=S.Z.useForm(),[i,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[m,h]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{let e=await (0,u.So)(s,l,"any"),t=[];for(let l=0;l{o(!1),n.resetFields()},g=()=>{o(!1),c(null),n.resetFields()},Z=async e=>{try{k.ZP.info("Making API Call"),o(!0),console.log("formValues in create user:",e);let t=await (0,u.Ov)(s,null,e);console.log("user create Response:",t),c(t.key),k.ZP.success("API user Created"),n.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the user:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-0",onClick:()=>o(!0),children:"+ Invite User"}),(0,a.jsxs)(w.Z,{title:"Invite User",visible:i,width:800,footer:null,onOk:x,onCancel:g,children:[(0,a.jsx)(f.Z,{className:"mb-1",children:"Invite a user to login to the Admin UI and create Keys"}),(0,a.jsx)(f.Z,{className:"mb-6",children:(0,a.jsx)("b",{children:"Note: SSO Setup Required for this"})}),(0,a.jsxs)(S.Z,{form:n,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(S.Z.Item,{label:"User Email",name:"user_email",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(v.default,{placeholder:"Select Team ID",style:{width:"100%"},children:t?t.map(e=>(0,a.jsx)(eP,{value:e.team_id,children:e.team_alias},e.team_id)):(0,a.jsx)(eP,{value:null,children:"Default Team"},"default")})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create User"})})]})]}),d&&(0,a.jsxs)(w.Z,{title:"User Created Successfully",visible:i,onOk:x,onCancel:g,footer:null,children:[(0,a.jsx)("p",{children:"User has been created to access your proxy. Please Ask them to Log In."}),(0,a.jsx)("br",{}),(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:"Note: This Feature is only supported through SSO on the Admin UI"})})]})]})},eO=e=>{let{visible:l,possibleUIRoles:s,onCancel:t,user:n,onSubmit:i}=e,[o,d]=(0,r.useState)(n),[c]=S.Z.useForm();(0,r.useEffect)(()=>{c.resetFields()},[n]);let m=async()=>{c.resetFields(),t()},u=async e=>{i(e),c.resetFields(),t()};return n?(0,a.jsx)(w.Z,{visible:l,onCancel:m,footer:null,title:"Edit User "+n.user_id,width:1e3,children:(0,a.jsx)(S.Z,{form:c,onFinish:u,initialValues:n,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"User Role",name:"user_role",children:(0,a.jsx)(v.default,{children:s&&Object.entries(s).map(e=>{let[l,{ui_label:s,description:t}]=e;return(0,a.jsx)(z.Z,{value:l,title:s,children:(0,a.jsxs)("div",{className:"flex",children:[s," ",(0,a.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:t})]})},l)})})}),(0,a.jsx)(S.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},eF=e=>{let{accessToken:l,token:s,keys:t,userRole:n,userID:i,teams:o,setKeys:d}=e,[c,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(0),[Z,_]=r.useState(null),[f,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),[N,A]=(0,r.useState)({}),I=async()=>{w(null),v(!1)},C=async e=>{if(console.log("inside handleEditSubmit:",e),l&&s&&n&&i){try{await (0,u.pf)(l,e,null),k.ZP.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}c&&m(c.map(l=>l.user_id===e.user_id?e:l)),w(null),v(!1)}};return((0,r.useEffect)(()=>{if(!l||!s||!n||!i)return;let e=async()=>{try{let e=await (0,u.Br)(l,null,n,!0,j,25);console.log("user data response:",e),m(e);let s=await (0,u.lg)(l);A(s)}catch(e){console.error("There was an error fetching the model data",e)}};l&&s&&n&&i&&e()},[l,s,n,i,j]),c&&l&&s&&n&&i)?(0,a.jsx)("div",{style:{width:"100%"},children:(0,a.jsxs)(x.Z,{className:"gap-2 p-2 h-[90vh] w-full mt-8",children:[(0,a.jsx)(eT,{userID:i,accessToken:l,teams:o}),(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[90vh] mb-4",children:[(0,a.jsx)("div",{className:"mb-4 mt-1"}),(0,a.jsx)(et.Z,{children:(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(L.Z,{className:"mt-5",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"User ID"}),(0,a.jsx)(q.Z,{children:"User Email"}),(0,a.jsx)(q.Z,{children:"Role"}),(0,a.jsx)(q.Z,{children:"User Spend ($ USD)"}),(0,a.jsx)(q.Z,{children:"User Max Budget ($ USD)"}),(0,a.jsx)(q.Z,{children:"API Keys"}),(0,a.jsx)(q.Z,{})]})}),(0,a.jsx)(U.Z,{children:c.map(e=>{var l,s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_id||"-"}),(0,a.jsx)(D.Z,{children:e.user_email||"-"}),(0,a.jsx)(D.Z,{children:(null==N?void 0:null===(l=N[null==e?void 0:e.user_role])||void 0===l?void 0:l.ui_label)||"-"}),(0,a.jsx)(D.Z,{children:e.spend?null===(s=e.spend)||void 0===s?void 0:s.toFixed(2):"-"}),(0,a.jsx)(D.Z,{children:e.max_budget?e.max_budget:"Unlimited"}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(x.Z,{numItems:2,children:e&&e.key_aliases&&e.key_aliases.filter(e=>null!==e).length>0?(0,a.jsxs)(F.Z,{size:"xs",color:"indigo",children:[e.key_aliases.filter(e=>null!==e).length,"\xa0Keys"]}):(0,a.jsx)(F.Z,{size:"xs",color:"gray",children:"No Keys"})})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:T.Z,onClick:()=>{w(e),v(!0)},children:"View Keys"})})]},e.user_id)})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("div",{className:"flex-1 flex justify-between items-center"})]})})]})}),(0,a.jsx)(eO,{visible:b,possibleUIRoles:N,onCancel:I,user:S,onSubmit:C})]}),function(){if(!c)return null;let e=Math.ceil(c.length/25);return(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)("div",{children:["Showing Page ",j+1," of ",e]}),(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none",disabled:0===j,onClick:()=>g(j-1),children:"← Prev"}),(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r focus:outline-none",onClick:()=>{g(j+1)},children:"Next →"})]})]})}()]})}):(0,a.jsx)("div",{children:"Loading..."})},eR=e=>{let{teams:l,searchParams:s,accessToken:t,setTeams:n,userID:i,userRole:o}=e,[d]=S.Z.useForm(),[c]=S.Z.useForm(),{Title:m,Paragraph:g}=$.default,[Z,_]=(0,r.useState)(""),[y,b]=(0,r.useState)(!1),[C,E]=(0,r.useState)(l?l[0]:null),[P,W]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[Y,J]=(0,r.useState)([]),[X,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)({}),en=e=>{E(e),b(!0)},ea=async e=>{let s=e.team_id;if(console.log("handleEditSubmit:",e),null==t)return;let a=await (0,u.Gh)(t,e);l&&n(l.map(e=>e.team_id===s?a.data:e)),k.ZP.success("Team updated successfully"),b(!1),E(null)},er=async e=>{el(e),Q(!0)},ei=async()=>{if(null!=ee&&null!=l&&null!=t){try{await (0,u.rs)(t,ee);let e=l.filter(e=>e.team_id!==ee);n(e)}catch(e){console.error("Error deleting the team:",e)}Q(!1),el(null)}};(0,r.useEffect)(()=>{let e=async()=>{try{if(null===i||null===o||null===t||null===l)return;console.log("fetching team info:");let e={};for(let s=0;s<(null==l?void 0:l.length);s++){let n=l[s].team_id,a=await (0,u.Xm)(t,n);console.log("teamInfo response:",a),null!==a&&(e={...e,[n]:a})}et(e)}catch(e){console.error("Error fetching team info:",e)}};(async()=>{try{if(null===i||null===o)return;if(null!==t){let e=(await (0,u.So)(t,i,o)).data.map(e=>e.id);console.log("available_model_names:",e),J(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[t,i,o,l]);let eo=async e=>{try{if(null!=t){var s;let a=null==e?void 0:e.team_alias;if((null!==(s=null==l?void 0:l.map(e=>e.team_alias))&&void 0!==s?s:[]).includes(a))throw Error("Team alias ".concat(a," already exists, please pick another alias"));k.ZP.info("Creating Team");let r=await (0,u.hT)(t,e);null!==l?n([...l,r]):n([r]),console.log("response for team create call: ".concat(r)),k.ZP.success("Team created"),W(!1)}}catch(e){console.error("Error creating the team:",e),k.ZP.error("Error creating the team: "+e,20)}},ed=async e=>{try{if(null!=t&&null!=l){k.ZP.info("Adding Member");let s={role:"user",user_email:e.user_email,user_id:e.user_id},a=await (0,u.cu)(t,C.team_id,s);console.log("response for team create call: ".concat(a.data));let r=l.findIndex(e=>(console.log("team.team_id=".concat(e.team_id,"; response.data.team_id=").concat(a.data.team_id)),e.team_id===a.data.team_id));if(console.log("foundIndex: ".concat(r)),-1!==r){let e=[...l];e[r]=a.data,n(e),E(a.data)}H(!1)}}catch(e){console.error("Error creating the team:",e)}};return console.log("received teams ".concat(JSON.stringify(l))),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"All Teams"}),(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Team Name"}),(0,a.jsx)(q.Z,{children:"Spend (USD)"}),(0,a.jsx)(q.Z,{children:"Budget (USD)"}),(0,a.jsx)(q.Z,{children:"Models"}),(0,a.jsx)(q.Z,{children:"TPM / RPM Limits"}),(0,a.jsx)(q.Z,{children:"Info"})]})}),(0,a.jsx)(U.Z,{children:l&&l.length>0?l.map(e=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.spend}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.max_budget?e.max_budget:"No limit"}),(0,a.jsx)(D.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,a.jsxs)(f.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{}),"RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsxs)(f.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].keys&&es[e.team_id].keys.length," ","Keys"]}),(0,a.jsxs)(f.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].team_info&&es[e.team_id].team_info.members_with_roles&&es[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>en(e)}),(0,a.jsx)(M.Z,{onClick:()=>er(e.team_id),icon:O.Z,size:"sm"})]})]},e.team_id)):null})]}),X&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Team"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this team ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:ei,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{Q(!1),el(null)},children:"Cancel"})]})]})]})})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>W(!0),children:"+ Create New Team"}),(0,a.jsx)(w.Z,{title:"Create Team",visible:P,width:800,footer:null,onOk:()=>{W(!1),d.resetFields()},onCancel:()=>{W(!1),d.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:eo,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),Y.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"Team Members"}),(0,a.jsx)(g,{children:"If you belong to multiple teams, this setting controls which teams members you see."}),l&&l.length>0?(0,a.jsx)(V.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{E(e)},children:e.team_alias},l))}):(0,a.jsxs)(g,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Member Name"}),(0,a.jsx)(q.Z,{children:"Role"})]})}),(0,a.jsx)(U.Z,{children:C?C.members_with_roles.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsx)(D.Z,{children:e.role})]},l)):null})]})}),C&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,team:t,onSubmit:n}=e,[r]=S.Z.useForm();return(0,a.jsx)(w.Z,{title:"Edit Team",visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n({...e,team_id:t.team_id}),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:ea,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),Y&&Y.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"team_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Edit Team"})})]})})},{visible:y,onCancel:()=>{b(!1),E(null)},team:C,onSubmit:ea})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-5",onClick:()=>H(!0),children:"+ Add member"}),(0,a.jsx)(w.Z,{title:"Add member",visible:G,width:800,footer:null,onOk:()=>{H(!1),c.resetFields()},onCancel:()=>{H(!1),c.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:ed,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,a.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,a.jsx)(S.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eM=e=>{let l,{searchParams:s,accessToken:t,showSSOBanner:n}=e,[o]=S.Z.useForm(),[d]=S.Z.useForm(),{Title:c,Paragraph:m}=$.default,[j,g]=(0,r.useState)(""),[Z,_]=(0,r.useState)(null),[y,v]=(0,r.useState)(null),[A,C]=(0,r.useState)(!1),[E,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[W,G]=(0,r.useState)(!1),[H,Y]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),Q=(0,i.useRouter)(),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)("");try{l=window.location.origin}catch(e){l=""}l+="/fallback/login";let en=()=>{X(!1)},ea=["proxy_admin","proxy_admin_viewer"];(0,r.useEffect)(()=>{if(Q){let{protocol:e,host:l}=window.location;et("".concat(e,"//").concat(l))}},[Q]),(0,r.useEffect)(()=>{(async()=>{if(null!=t){let e=[],l=await (0,u.Xd)(t,"proxy_admin_viewer");l.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy viewers: ".concat(l));let s=await (0,u.Xd)(t,"proxy_admin");s.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy admins: ".concat(s)),console.log("combinedList: ".concat(e)),_(e),el(await (0,u.lg)(t))}})()},[t]);let er=()=>{G(!1),d.resetFields(),o.resetFields()},ei=()=>{F(!1),d.resetFields(),o.resetFields()},eo=()=>{F(!1),C(!1),d.resetFields(),o.resetFields()},ed=()=>{G(!1),d.resetFields(),o.resetFields()},ec=e=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-8 mt-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},className:"mt-4",children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add member"})})]}),em=(e,l,s)=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"User Role",name:"user_role",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(V.Z,{value:l,children:ea.map((e,l)=>(0,a.jsx)(z.Z,{value:e,children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"user_id",hidden:!0,initialValue:s,valuePropName:"user_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s,disabled:!0})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Update role"})})]}),eu=async e=>{try{if(null!=t&&null!=Z){k.ZP.info("Making API Call");let l=await (0,u.pf)(t,e,null);console.log("response for team create call: ".concat(l));let s=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(l.user_id)),e.user_id===l.user_id));console.log("foundIndex: ".concat(s)),-1==s&&(console.log("updates admin with new user"),Z.push(l),_(Z)),k.ZP.success("Refresh tab to see updated user role"),G(!1)}}catch(e){console.error("Error creating the key:",e)}},eh=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call");let s=await (0,u.pf)(t,e,"proxy_admin_viewer");console.log("response for team create call: ".concat(s));let n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)});let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(s.user_id)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),_(Z)),o.resetFields(),P(!1)}}catch(e){console.error("Error creating the key:",e)}},ex=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call"),e.user_email,e.user_id;let s=await (0,u.pf)(t,e,"proxy_admin"),n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)}),console.log("response for team create call: ".concat(s));let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(n)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),_(Z)),o.resetFields(),F(!1)}}catch(e){console.error("Error creating the key:",e)}},ep=async e=>{if(null==t)return;let l={environment_variables:{PROXY_BASE_URL:e.proxy_base_url,GOOGLE_CLIENT_ID:e.google_client_id,GOOGLE_CLIENT_SECRET:e.google_client_secret}};(0,u.K_)(t,l)};return console.log("admins: ".concat(null==Z?void 0:Z.length)),(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsx)(c,{level:4,children:"Admin Access "}),(0,a.jsxs)(m,{children:[n&&(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#restrict-ui-access",children:"Requires SSO Setup"}),(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin: "})," Can create keys, teams, users, add models, etc."," ",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin Viewer: "}),"Can just view spend. They cannot create keys, teams or grant users access to new models."," "]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-2 w-full",children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Member Name"}),(0,a.jsx)(q.Z,{children:"Role"})]})}),(0,a.jsx)(U.Z,{children:Z?Z.map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsxs)(D.Z,{children:[" ",(null==ee?void 0:null===(s=ee[null==e?void 0:e.user_role])||void 0===s?void 0:s.ui_label)||"-"]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>G(!0)}),(0,a.jsx)(w.Z,{title:"Update role",visible:W,width:800,footer:null,onOk:er,onCancel:ed,children:em(eu,e.user_role,e.user_id)})]})]},l)}):null})]})})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("div",{className:"flex justify-start",children:[(0,a.jsx)(p.Z,{className:"mr-4 mb-5",onClick:()=>F(!0),children:"+ Add admin"}),(0,a.jsx)(w.Z,{title:"Add admin",visible:O,width:800,footer:null,onOk:ei,onCancel:eo,children:ec(ex)}),(0,a.jsxs)(w.Z,{title:"Invitation Link",visible:A,width:800,footer:null,onOk:ei,onCancel:eo,children:[(0,a.jsx)(m,{children:"Copy and send the generated link to onboard this user to the proxy."}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(f.Z,{className:"text-base",children:"User ID"}),(0,a.jsx)(f.Z,{children:null==y?void 0:y.user_id})]}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(f.Z,{children:"Invitation Link"}),(0,a.jsxs)(f.Z,{children:[es,"/ui/onboarding?id=",null==y?void 0:y.id]})]}),(0,a.jsxs)("div",{className:"flex justify-end mt-5",children:[(0,a.jsx)("div",{}),(0,a.jsx)(b.CopyToClipboard,{text:"".concat(es,"/ui/onboarding?id=").concat(null==y?void 0:y.id),onCopy:()=>k.ZP.success("Copied!"),children:(0,a.jsx)(p.Z,{variant:"primary",children:"Copy invitation link"})})]})]}),(0,a.jsx)(p.Z,{className:"mb-5",onClick:()=>P(!0),children:"+ Add viewer"}),(0,a.jsx)(w.Z,{title:"Add viewer",visible:E,width:800,footer:null,onOk:()=>{P(!1),d.resetFields(),o.resetFields()},onCancel:()=>{P(!1),d.resetFields(),o.resetFields()},children:ec(eh)})]})})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(c,{level:4,children:"Add SSO"}),(0,a.jsxs)("div",{className:"flex justify-start mb-4",children:[(0,a.jsx)(p.Z,{onClick:()=>Y(!0),children:"Add SSO"}),(0,a.jsx)(w.Z,{title:"Add SSO",visible:H,width:800,footer:null,onOk:()=>{Y(!1),o.resetFields()},onCancel:()=>{Y(!1),o.resetFields()},children:(0,a.jsxs)(S.Z,{form:o,onFinish:e=>{ex(e),ep(e),Y(!1),X(!0)},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"PROXY BASE URL",name:"proxy_base_url",rules:[{required:!0,message:"Please enter the proxy base url"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT ID",name:"google_client_id",rules:[{required:!0,message:"Please enter the google client id"}],children:(0,a.jsx)(N.Z.Password,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT SECRET",name:"google_client_secret",rules:[{required:!0,message:"Please enter the google client secret"}],children:(0,a.jsx)(N.Z.Password,{})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})}),(0,a.jsxs)(w.Z,{title:"SSO Setup Instructions",visible:J,width:800,footer:null,onOk:en,onCancel:()=>{X(!1)},children:[(0,a.jsx)("p",{children:"Follow these steps to complete the SSO setup:"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"1. DO NOT Exit this TAB"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"2. Open a new tab, visit your proxy base url"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"3. Confirm your SSO is configured correctly and you can login on the new Tab"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"4. If Step 3 is successful, you can close this tab"}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{onClick:en,children:"Done"})})]})]}),(0,a.jsxs)(ey.Z,{title:"Login without SSO",color:"teal",children:["If you need to login without sso, you can access"," ",(0,a.jsxs)("a",{href:l,target:"_blank",children:[(0,a.jsx)("b",{children:l})," "]})]})]})]})},eL=s(42556),eU=s(90252),eD=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:t,handleSubmit:n,premiumUser:r}=e,[i]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:i,onFinish:()=>{let e=i.getFieldsValue();Object.values(e).some(e=>""===e||null==e)?console.log("Some form fields are empty."):n(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{align:"center",children:[(0,a.jsx)(f.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),e.premium_field?r?(0,a.jsx)(S.Z.Item,{name:e.field_name,children:(0,a.jsx)(D.Z,{children:"Integer"===e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(D.Z,{children:(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})})}):(0,a.jsx)(S.Z.Item,{name:e.field_name,className:"mb-0",children:(0,a.jsx)(D.Z,{children:"Integer"===e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(D.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eU.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:O.Z,color:"red",onClick:()=>t(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Update Settings"})})]})},eK=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,r.useState)([]);return console.log("INSIDE ALERTING SETTINGS"),(0,r.useEffect)(()=>{l&&(0,u.RQ)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(eD,{alertingSettings:t,handleInputChange:(e,l)=>{n(t.map(s=>s.field_name===e?{...s,field_value:l}:s))},handleResetField:(e,s)=>{if(l)try{let l=t.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:l.field_default_value}:l);console.log("INSIDE HANDLE RESET FIELD"),n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||null==e||void 0==e)return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let n={...e,...s};try{(0,u.jA)(l,"alerting_args",n),k.ZP.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})};let eq=[{name:"slack",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}},{name:"langfuse",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}},{name:"openmeter",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}}];var eB=e=>{let{accessToken:l,userRole:s,userID:t,premiumUser:n}=e,[i,o]=(0,r.useState)(eq),[d,c]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[g]=S.Z.useForm(),[Z,_]=(0,r.useState)(null),[b,N]=(0,r.useState)([]),[A,C]=(0,r.useState)(""),[E,P]=(0,r.useState)({}),[T,O]=(0,r.useState)([]),M=e=>{T.includes(e)?O(T.filter(l=>l!==e)):O([...T,e])},V={llm_exceptions:"LLM Exceptions",llm_too_slow:"LLM Responses Too Slow",llm_requests_hanging:"LLM Requests Hanging",budget_alerts:"Budget Alerts (API Keys, Users)",db_exceptions:"Database Exceptions (Read/Write)",daily_reports:"Weekly/Monthly Spend Reports",outage_alerts:"Outage Alerts",region_outage_alerts:"Region Outage Alerts"};(0,r.useEffect)(()=>{l&&s&&t&&(0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e);let l=eq;o(l=l.map(l=>{let s=e.callbacks.find(e=>e.name===l.name);return s?{...l,variables:{...l.variables,...s.variables}}:l}));let s=e.alerts;if(console.log("alerts_data",s),s&&s.length>0){let e=s[0];console.log("_alert_info",e);let l=e.variables.SLACK_WEBHOOK_URL;console.log("catch_all_webhook",l),O(e.active_alerts),C(l),P(e.alerts_to_webhook)}c(s)})},[l,s,t]);let z=e=>T&&T.includes(e),W=()=>{if(!l)return;let e={};d.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));n&&n.value&&(e[s]=null==n?void 0:n.value)})}),console.log("updatedVariables",e);try{(0,u.K_)(l,{general_settings:{alerting:["email"]},environment_variables:e})}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Email settings updated successfully")},G=e=>{if(!l)return;let s=Object.fromEntries(Object.entries(e.variables).map(e=>{var l;let[s,t]=e;return[s,(null===(l=document.querySelector('input[name="'.concat(s,'"]')))||void 0===l?void 0:l.value)||t]}));console.log("updatedVariables",s),console.log("updateAlertTypes",b);let t={environment_variables:s,litellm_settings:{success_callback:[e.name]}};try{(0,u.K_)(l,t)}catch(e){k.ZP.error("Failed to update callback: "+e,20)}k.ZP.success("Callback updated successfully")},H=()=>{l&&g.validateFields().then(e=>{let s;if(console.log("Form values:",e),"langfuse"===e.callback){s={environment_variables:{LANGFUSE_PUBLIC_KEY:e.langfusePublicKey,LANGFUSE_SECRET_KEY:e.langfusePrivateKey},litellm_settings:{success_callback:[e.callback]}},(0,u.K_)(l,s);let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:null,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:e.langfusePublicKey,LANGFUSE_SECRET_KEY:e.langfusePrivateKey,OPENMETER_API_KEY:null}};o(i?[...i,t]:[t])}else if("slack"===e.callback){console.log("values.slackWebhookUrl: ".concat(e.slackWebhookUrl)),s={general_settings:{alerting:["slack"],alerting_threshold:300},environment_variables:{SLACK_WEBHOOK_URL:e.slackWebhookUrl}},(0,u.K_)(l,s),console.log("values.callback: ".concat(e.callback));let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:e.slackWebhookUrl,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null}};o(i?[...i,t]:[t])}else if("openmeter"==e.callback){console.log("values.openMeterApiKey: ".concat(e.openMeterApiKey)),s={environment_variables:{OPENMETER_API_KEY:e.openMeterApiKey},litellm_settings:{success_callback:[e.callback]}},(0,u.K_)(l,s);let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:null,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:e.openMeterAPIKey}};o(i?[...i,t]:[t])}else s={error:"Invalid callback value"};h(!1),g.resetFields(),_(null)})};return l?(console.log("callbacks: ".concat(i)),(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(ey.Z,{title:"[UI] Presidio PII + Guardrails Coming Soon. https://docs.litellm.ai/docs/proxy/pii_masking",color:"sky"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(es.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(es.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(es.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Callback"}),(0,a.jsx)(q.Z,{children:"Callback Env Vars"})]})}),(0,a.jsx)(U.Z,{children:i.filter(e=>"slack"!==e.name).map((e,s)=>{var t;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:(0,a.jsx)(F.Z,{color:"emerald",children:e.name})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)("ul",{children:Object.entries(null!==(t=e.variables)&&void 0!==t?t:{}).filter(l=>{let[s,t]=l;return s.toLowerCase().includes(e.name)}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{children:[(0,a.jsx)(f.Z,{className:"mt-2",children:l}),"LANGFUSE_HOST"===l?(0,a.jsx)("p",{children:"default value=https://cloud.langfuse.com"}):(0,a.jsx)("div",{}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password"})]},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>G(e),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,e.name),className:"mx-2",children:"Test Callback"})]})]},s)})})]})})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(f.Z,{className:"my-2",children:["Alerts are only supported for Slack Webhook URLs. Get your webhook urls from"," ",(0,a.jsx)("a",{href:"https://api.slack.com/messaging/webhooks",target:"_blank",style:{color:"blue"},children:"here"})]}),(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{}),(0,a.jsx)(q.Z,{}),(0,a.jsx)(q.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(V).map((e,l)=>{let[s,t]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:"region_outage_alerts"==s?n?(0,a.jsx)(eL.Z,{id:"switch",name:"switch",checked:z(s),onChange:()=>M(s)}):(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})}):(0,a.jsx)(eL.Z,{id:"switch",name:"switch",checked:z(s),onChange:()=>M(s)})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:t})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(j.Z,{name:s,type:"password",defaultValue:E&&E[s]?E[s]:A})})]},l)})})]}),(0,a.jsx)(p.Z,{size:"xs",className:"mt-2",onClick:()=>{if(!l)return;let e={};Object.entries(V).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));console.log("key",s),console.log("webhookInput",n);let a=(null==n?void 0:n.value)||"";console.log("newWebhookValue",a),e[s]=a}),console.log("updatedAlertToWebhooks",e);let s={general_settings:{alert_to_webhook_url:e,alert_types:T}};console.log("payload",s);try{(0,u.K_)(l,s)}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Alerts updated successfully")},children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"slack"),className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(eK,{accessToken:l,premiumUser:n})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Email Settings"}),(0,a.jsxs)(f.Z,{children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: email alerts"})," ",(0,a.jsx)("br",{})]}),(0,a.jsx)("div",{className:"flex w-full",children:d.filter(e=>"email"===e.name).map((e,l)=>{var s;return(0,a.jsx)(D.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(x.Z,{numItems:2,children:Object.entries(null!==(s=e.variables)&&void 0!==s?s:{}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=n&&("EMAIL_LOGO_URL"===l||"EMAIL_SUPPORT_CONTACT"===l)?(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:(0,a.jsxs)(f.Z,{className:"mt-2",children:[" ","✨ ",l]})}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mt-2",children:l}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",style:{width:"400px"}})]}),(0,a.jsxs)("p",{style:{fontSize:"small",fontStyle:"italic"},children:["SMTP_HOST"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP host address, e.g. `smtp.resend.com`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PORT"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP port number, e.g. `587`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_USERNAME"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP username, e.g. `username`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PASSWORD"===l&&(0,a.jsx)("span",{style:{color:"red"},children:" Required * "}),"SMTP_SENDER_EMAIL"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the sender email address, e.g. `sender@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"TEST_EMAIL_ADDRESS"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Email Address to send `Test Email Alert` to. example: `info@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"EMAIL_LOGO_URL"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the Logo that appears in the email, pass a url to your logo"}),"EMAIL_SUPPORT_CONTACT"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the support email address that appears in the email. Default is support@berri.ai"})]})]},l)})})})},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>W(),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"email"),className:"mx-2",children:"Test Email Alerts"})]})})]})]})]}),(0,a.jsx)(w.Z,{title:"Add Callback",visible:m,onOk:H,width:800,onCancel:()=>{h(!1),g.resetFields(),_(null)},footer:null,children:(0,a.jsxs)(S.Z,{form:g,layout:"vertical",onFinish:H,children:[(0,a.jsx)(S.Z.Item,{label:"Callback",name:"callback",rules:[{required:!0,message:"Please select a callback"}],children:(0,a.jsxs)(v.default,{onChange:e=>{_(e)},children:[(0,a.jsx)(v.default.Option,{value:"langfuse",children:"langfuse"}),(0,a.jsx)(v.default.Option,{value:"openmeter",children:"openmeter"})]})}),"langfuse"===Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"LANGFUSE_PUBLIC_KEY",name:"langfusePublicKey",rules:[{required:!0,message:"Please enter the public key"}],children:(0,a.jsx)(j.Z,{type:"password"})}),(0,a.jsx)(S.Z.Item,{label:"LANGFUSE_PRIVATE_KEY",name:"langfusePrivateKey",rules:[{required:!0,message:"Please enter the private key"}],children:(0,a.jsx)(j.Z,{type:"password"})})]}),"openmeter"==Z&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"OPENMETER_API_KEY",name:"openMeterApiKey",rules:[{required:!0,message:"Please enter the openmeter api key"}],children:(0,a.jsx)(j.Z,{type:"password"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})]})):null};let{Option:eV}=v.default;var ez=e=>{let{models:l,accessToken:s,routerSettings:t,setRouterSettings:n}=e,[i]=S.Z.useForm(),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)("");return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>d(!0),children:"+ Add Fallbacks"}),(0,a.jsx)(w.Z,{title:"Add Fallbacks",visible:o,width:800,footer:null,onOk:()=>{d(!1),i.resetFields()},onCancel:()=>{d(!1),i.resetFields()},children:(0,a.jsxs)(S.Z,{form:i,onFinish:e=>{console.log(e);let{model_name:l,models:a}=e,r=[...t.fallbacks||[],{[l]:a}],o={...t,fallbacks:r};console.log(o);try{(0,u.K_)(s,{router_settings:o}),n(o)}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully"),d(!1),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Public Model Name",name:"model_name",rules:[{required:!0,message:"Set the model to fallback for"}],help:"required",children:(0,a.jsx)(V.Z,{defaultValue:c,children:l&&l.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>m(e),children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Fallback Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsx)(ei.Z,{value:l,children:l&&l.filter(e=>e!=c).map(e=>(0,a.jsx)(eo.Z,{value:e,children:e},e))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add Fallbacks"})})]})})]})},eW=s(12968);async function eG(e,l){console.log("isLocal:",!1);let s=window.location.origin,t=new eW.ZP.OpenAI({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0});try{let l=await t.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});k.ZP.success((0,a.jsxs)("span",{children:["Test model=",(0,a.jsx)("strong",{children:e}),", received model=",(0,a.jsx)("strong",{children:l.model}),". See"," ",(0,a.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}let eH={ttl:3600,lowest_latency_buffer:0},eY=e=>{let{selectedStrategy:l,strategyArgs:s,paramExplanation:t}=e;return(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(_.Z,{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Routing Strategy Specific Args"}),(0,a.jsx)(Z.Z,{children:"latency-based-routing"==l?(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(s).map(e=>{let[l,s]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:t[l]})]}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]})}):(0,a.jsx)(f.Z,{children:"No specific settings"})})]})};var eJ=e=>{let{accessToken:l,userRole:s,userID:t,modelData:n}=e,[i,o]=(0,r.useState)({}),[d,c]=(0,r.useState)({}),[m,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)(!1),[b]=S.Z.useForm(),[v,w]=(0,r.useState)(null),[N,I]=(0,r.useState)(null),[C,E]=(0,r.useState)(null),P={routing_strategy_args:"(dict) Arguments to pass to the routing strategy",routing_strategy:"(string) Routing strategy to use",allowed_fails:"(int) Number of times a deployment can fail before being added to cooldown",cooldown_time:"(int) time in seconds to cooldown a deployment after failure",num_retries:"(int) Number of retries for failed requests. Defaults to 0.",timeout:"(float) Timeout for requests. Defaults to None.",retry_after:"(int) Minimum time to wait before retrying a failed request",ttl:"(int) Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"(float) Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};(0,r.useEffect)(()=>{l&&s&&t&&((0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.router_settings)}),(0,u.YU)(l).then(e=>{g(e)}))},[l,s,t]);let T=async e=>{if(l){console.log("received key: ".concat(e)),console.log("routerSettings['fallbacks']: ".concat(i.fallbacks)),i.fallbacks.map(l=>(e in l&&delete l[e],l));try{await (0,u.K_)(l,{router_settings:i}),o({...i}),I(i.routing_strategy),k.ZP.success("Router settings updated successfully")}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}}},W=(e,l)=>{g(m.map(s=>s.field_name===e?{...s,field_value:l}:s))},G=(e,s)=>{if(!l)return;let t=m[s].field_value;if(null!=t&&void 0!=t)try{(0,u.jA)(l,e,t);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:!0}:l);g(s)}catch(e){}},H=(e,s)=>{if(l)try{(0,u.ao)(l,e);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:null}:l);g(s)}catch(e){}},Y=e=>{if(!l)return;console.log("router_settings",e);let s=Object.fromEntries(Object.entries(e).map(e=>{let[l,s]=e;if("routing_strategy_args"!==l&&"routing_strategy"!==l){var t;return[l,(null===(t=document.querySelector('input[name="'.concat(l,'"]')))||void 0===t?void 0:t.value)||s]}if("routing_strategy"==l)return[l,N];if("routing_strategy_args"==l&&"latency-based-routing"==N){let e={},l=document.querySelector('input[name="lowest_latency_buffer"]'),s=document.querySelector('input[name="ttl"]');return(null==l?void 0:l.value)&&(e.lowest_latency_buffer=Number(l.value)),(null==s?void 0:s.value)&&(e.ttl=Number(s.value)),console.log("setRoutingStrategyArgs: ".concat(e)),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,u.K_)(l,{router_settings:s})}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully")};return l?(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Loadbalancing"}),(0,a.jsx)(es.Z,{value:"2",children:"Fallbacks"}),(0,a.jsx)(es.Z,{value:"3",children:"General"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(y.Z,{children:"Router Settings"}),(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(i).filter(e=>{let[l,s]=e;return"fallbacks"!=l&&"context_window_fallbacks"!=l&&"routing_strategy_args"!=l}).map(e=>{let[l,s]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:P[l]})]}),(0,a.jsx)(D.Z,{children:"routing_strategy"==l?(0,a.jsxs)(V.Z,{defaultValue:s,className:"w-full max-w-md",onValueChange:I,children:[(0,a.jsx)(z.Z,{value:"usage-based-routing",children:"usage-based-routing"}),(0,a.jsx)(z.Z,{value:"latency-based-routing",children:"latency-based-routing"}),(0,a.jsx)(z.Z,{value:"simple-shuffle",children:"simple-shuffle"})]}):(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]}),(0,a.jsx)(eY,{selectedStrategy:N,strategyArgs:i&&i.routing_strategy_args&&Object.keys(i.routing_strategy_args).length>0?i.routing_strategy_args:eH,paramExplanation:P})]}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>Y(i),children:"Save Changes"})})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Model Name"}),(0,a.jsx)(q.Z,{children:"Fallbacks"})]})}),(0,a.jsx)(U.Z,{children:i.fallbacks&&i.fallbacks.map((e,s)=>Object.entries(e).map(e=>{let[t,n]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:t}),(0,a.jsx)(D.Z,{children:Array.isArray(n)?n.join(", "):n}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(p.Z,{onClick:()=>eG(t,l),children:"Test Fallback"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:O.Z,size:"sm",onClick:()=>T(t)})})]},s.toString()+t)}))})]}),(0,a.jsx)(ez,{models:(null==n?void 0:n.data)?n.data.map(e=>e.model_name):[],accessToken:l,routerSettings:i,setRouterSettings:o})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"}),(0,a.jsx)(q.Z,{children:"Status"}),(0,a.jsx)(q.Z,{children:"Action"})]})}),(0,a.jsx)(U.Z,{children:m.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),(0,a.jsx)(D.Z,{children:"Integer"==e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>W(e.field_name,l)}):null}),(0,a.jsx)(D.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eU.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(p.Z,{onClick:()=>G(e.field_name,l),children:"Update"}),(0,a.jsx)(M.Z,{icon:O.Z,color:"red",onClick:()=>H(e.field_name,l),children:"Reset"})]})]},l))})]})})})]})]})}):null},eX=e=>{let{isModalVisible:l,accessToken:s,setIsModalVisible:t,setBudgetList:n}=e,[r]=S.Z.useForm(),i=async e=>{if(null!=s&&void 0!=s)try{k.ZP.info("Making API Call");let l=await (0,u.Zr)(s,e);console.log("key create Response:",l),n(e=>e?[...e,l]:[l]),k.ZP.success("API Key Created"),r.resetFields()}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,a.jsx)(w.Z,{title:"Create Budget",visible:l,width:800,footer:null,onOk:()=>{t(!1),r.resetFields()},onCancel:()=>{t(!1),r.resetFields()},children:(0,a.jsxs)(S.Z,{form:r,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,a.jsx)(A.Z,{step:1,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,a.jsx)(A.Z,{step:1,precision:2,width:200})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(_.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},e$=e=>{let{accessToken:l}=e,[s,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&(0,u.O3)(l).then(e=>{i(e)})},[l]);let o=async(e,s)=>{if(null==l)return;k.ZP.info("Request made"),await (0,u.NV)(l,e);let t=[...n];t.splice(s,1),i(t),k.ZP.success("Budget Deleted.")};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsx)(p.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>t(!0),children:"+ Create Budget"}),(0,a.jsx)(eX,{accessToken:l,isModalVisible:s,setIsModalVisible:t,setBudgetList:i}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(f.Z,{children:"Create a budget to assign to customers."}),(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Budget ID"}),(0,a.jsx)(q.Z,{children:"Max Budget"}),(0,a.jsx)(q.Z,{children:"TPM"}),(0,a.jsx)(q.Z,{children:"RPM"})]})}),(0,a.jsx)(U.Z,{children:n.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.budget_id}),(0,a.jsx)(D.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,a.jsx)(D.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,a.jsx)(D.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,a.jsx)(M.Z,{icon:O.Z,size:"sm",onClick:()=>o(e.budget_id,l)})]},l))})]})]}),(0,a.jsxs)("div",{className:"mt-5",children:[(0,a.jsx)(f.Z,{className:"text-base",children:"How to use budget id"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"Assign Budget to Customer"}),(0,a.jsx)(es.Z,{children:"Test it (Curl)"}),(0,a.jsx)(es.Z,{children:"Test it (OpenAI SDK)"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="{let{}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,a.jsx)(f.Z,{className:"mt-2 mb-2",children:"LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below "}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"OpenAI Python SDK"}),(0,a.jsx)(es.Z,{children:"LlamaIndex"}),(0,a.jsx)(es.Z,{children:"Langchain Py"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n '})})]})]})]})})})};async function e1(e,l,s,t){console.log("isLocal:",!1);let n=window.location.origin,a=new eW.ZP.OpenAI({apiKey:t,baseURL:n,dangerouslyAllowBrowser:!0});try{for await(let t of(await a.chat.completions.create({model:s,stream:!0,messages:[{role:"user",content:e}]})))console.log(t),t.choices[0].delta.content&&l(t.choices[0].delta.content)}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}var e2=e=>{let{accessToken:l,token:s,userRole:t,userID:n}=e,[i,o]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)(void 0),[y,b]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{let e=await (0,u.So)(l,n,t);if(console.log("model_info:",e),(null==e?void 0:e.data.length)>0){let l=e.data.map(e=>({value:e.id,label:e.id}));console.log(l),b(l),_(e.data[0].id)}}catch(e){console.error("Error fetching model info:",e)}})()},[l,n,t]);let S=(e,l)=>{g(s=>{let t=s[s.length-1];return t&&t.role===e?[...s.slice(0,s.length-1),{role:e,content:t.content+l}]:[...s,{role:e,content:l}]})},k=async()=>{if(""!==d.trim()&&i&&s&&t&&n){g(e=>[...e,{role:"user",content:d}]);try{Z&&await e1(d,e=>S("assistant",e),Z,i)}catch(e){console.error("Error fetching model response",e),S("assistant","Error fetching model response")}c("")}};if(t&&"Admin Viewer"==t){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to test models"})]})}return(0,a.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsx)(en.Z,{children:(0,a.jsx)(es.Z,{children:"Chat"})}),(0,a.jsx)(er.Z,{children:(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("div",{className:"sm:max-w-2xl",children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"API Key"}),(0,a.jsx)(j.Z,{placeholder:"Type API Key here",type:"password",onValueChange:o,value:i})]}),(0,a.jsxs)(h.Z,{className:"mx-2",children:[(0,a.jsx)(f.Z,{children:"Select Model:"}),(0,a.jsx)(v.default,{placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),_(e)},options:y,style:{width:"200px"}})]})]})}),(0,a.jsxs)(L.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,a.jsx)(K.Z,{children:(0,a.jsx)(B.Z,{children:(0,a.jsx)(D.Z,{})})}),(0,a.jsx)(U.Z,{children:m.map((e,l)=>(0,a.jsx)(B.Z,{children:(0,a.jsx)(D.Z,{children:"".concat(e.role,": ").concat(e.content)})},l))})]}),(0,a.jsx)("div",{className:"mt-3",style:{position:"absolute",bottom:5,width:"95%"},children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(j.Z,{type:"text",value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&k()},placeholder:"Type your message..."}),(0,a.jsx)(p.Z,{onClick:k,className:"ml-2",children:"Send"})]})})]})})]})})})})},e4=s(33509),e5=s(95781);let{Sider:e8}=e4.default;var e3=e=>{let{setPage:l,userRole:s,defaultSelectedKey:t}=e;return"Admin Viewer"==s?(0,a.jsx)(e4.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,a.jsx)(e8,{width:120,children:(0,a.jsx)(e5.Z,{mode:"inline",defaultSelectedKeys:t||["4"],style:{height:"100%",borderRight:0},children:(0,a.jsx)(e5.Z.Item,{onClick:()=>l("usage"),children:"Usage"},"1")})})}):(0,a.jsx)(e4.default,{style:{minHeight:"100vh",maxWidth:"145px"},children:(0,a.jsx)(e8,{width:145,children:(0,a.jsxs)(e5.Z,{mode:"inline",defaultSelectedKeys:t||["1"],style:{height:"100%",borderRight:0},children:[(0,a.jsx)(e5.Z.Item,{onClick:()=>l("api-keys"),children:(0,a.jsx)(f.Z,{children:"API Keys"})},"1"),(0,a.jsx)(e5.Z.Item,{onClick:()=>l("llm-playground"),children:(0,a.jsx)(f.Z,{children:"Test Key"})},"3"),"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("models"),children:(0,a.jsx)(f.Z,{children:"Models"})},"2"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("usage"),children:(0,a.jsx)(f.Z,{children:"Usage"})},"4"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("teams"),children:(0,a.jsx)(f.Z,{children:"Teams"})},"6"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("users"),children:(0,a.jsx)(f.Z,{children:"Internal Users"})},"5"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("settings"),children:(0,a.jsx)(f.Z,{children:"Logging & Alerts"})},"8"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("budgets"),children:(0,a.jsx)(f.Z,{children:"Budgets"})},"9"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("general-settings"),children:(0,a.jsx)(f.Z,{children:"Router Settings"})},"10"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("admin-panel"),children:(0,a.jsx)(f.Z,{children:"Admin"})},"11"):null,(0,a.jsx)(e5.Z.Item,{onClick:()=>l("api_ref"),children:(0,a.jsx)(f.Z,{children:"API Reference"})},"12"),(0,a.jsx)(e5.Z.Item,{onClick:()=>l("model-hub"),children:(0,a.jsx)(f.Z,{children:"Model Hub"})},"14")]})})})},e6=s(67989),e9=s(52703),e7=e=>{let{accessToken:l,token:s,userRole:t,userID:n,keys:i,premiumUser:o}=e,d=new Date,[c,m]=(0,r.useState)([]),[j,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)([]),[b,v]=(0,r.useState)([]),[S,k]=(0,r.useState)([]),[w,N]=(0,r.useState)([]),[A,I]=(0,r.useState)([]),[C,E]=(0,r.useState)([]),[P,T]=(0,r.useState)([]),[O,F]=(0,r.useState)([]),[M,W]=(0,r.useState)({}),[G,Y]=(0,r.useState)([]),[J,X]=(0,r.useState)(""),[$,Q]=(0,r.useState)(["all-tags"]),[em,eu]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),eh=new Date(d.getFullYear(),d.getMonth(),1),ex=new Date(d.getFullYear(),d.getMonth()+1,0),ep=ef(eh),ej=ef(ex);function eg(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",i),console.log("premium user in usage",o),(0,r.useEffect)(()=>{e_(em.from,em.to)},[em,$]);let eZ=async(e,s,t)=>{if(!e||!s||!l)return;s.setHours(23,59,59,999),e.setHours(0,0,0,0),console.log("uiSelectedKey",t);let n=await (0,u.b1)(l,t,e.toISOString(),s.toISOString());console.log("End user data updated successfully",n),v(n)},e_=async(e,s)=>{e&&s&&l&&(s.setHours(23,59,59,999),e.setHours(0,0,0,0),N((await (0,u.J$)(l,e.toISOString(),s.toISOString(),0===$.length?void 0:$)).spend_per_tag),console.log("Tag spend data updated successfully"))};function ef(e){let l=e.getFullYear(),s=e.getMonth()+1,t=e.getDate();return"".concat(l,"-").concat(s<10?"0"+s:s,"-").concat(t<10?"0"+t:t)}return console.log("Start date is ".concat(ep)),console.log("End date is ".concat(ej)),(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{if(console.log("user role: ".concat(t)),"Admin"==t||"Admin Viewer"==t){var e,a;let t=await (0,u.FC)(l);m(t);let n=await (0,u.OU)(l,s,ep,ej);console.log("provider_spend",n),F(n);let r=(await (0,u.tN)(l)).map(e=>({key:(e.key_alias||e.key_name||e.api_key).substring(0,10),spend:e.total_spend}));g(r);let i=(await (0,u.Au)(l)).map(e=>({key:e.model,spend:e.total_spend}));_(i);let o=await (0,u.mR)(l);console.log("teamSpend",o),k(o.daily_spend),E(o.teams);let d=o.total_spend_per_team;d=d.map(e=>(e.name=e.team_id||"",e.value=e.total_spend||0,e.value=e.value.toFixed(2),e)),T(d);let c=await (0,u.X)(l);I(c.tag_names);let h=await (0,u.J$)(l,null===(e=em.from)||void 0===e?void 0:e.toISOString(),null===(a=em.to)||void 0===a?void 0:a.toISOString(),void 0);N(h.spend_per_tag);let x=await (0,u.b1)(l,null,void 0,void 0);v(x),console.log("spend/user result",x);let p=await (0,u.wd)(l,ep,ej);W(p);let j=await (0,u.xA)(l,ep,ej);console.log("global activity per model",j),Y(j)}else"App Owner"==t&&await (0,u.HK)(l,s,t,n,ep,ej).then(async e=>{if(console.log("result from spend logs call",e),"daily_spend"in e){let l=e.daily_spend;console.log("daily spend",l),m(l);let s=e.top_api_keys;g(s)}else{let s=(await (0,u.e2)(l,function(e){let l=[];e.forEach(e=>{Object.entries(e).forEach(e=>{let[s,t]=e;"spend"!==s&&"startTime"!==s&&"models"!==s&&"users"!==s&&l.push({key:s,spend:t})})}),l.sort((e,l)=>Number(l.spend)-Number(e.spend));let s=l.slice(0,5).map(e=>e.key);return console.log("topKeys: ".concat(Object.keys(s[0]))),s}(e))).info.map(e=>({key:(e.key_name||e.key_alias).substring(0,10),spend:e.spend}));g(s),m(e)}})}catch(e){console.error("There was an error fetching the data",e)}})()},[l,s,t,n,ep,ej]),(0,a.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{className:"mt-2",children:[(0,a.jsx)(es.Z,{children:"All Up"}),(0,a.jsx)(es.Z,{children:"Team Based Usage"}),(0,a.jsx)(es.Z,{children:"Customer Usage"}),(0,a.jsx)(es.Z,{children:"Tag Based Usage"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(es.Z,{children:"Cost"}),(0,a.jsx)(es.Z,{children:"Activity"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,a.jsx)(H,{userID:n,userRole:t,accessToken:l,userSpend:null,selectedTeam:null}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Monthly Spend"}),(0,a.jsx)(ec.Z,{data:c,index:"date",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Top API Keys"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:j,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:80,tickGap:5,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Top Models"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:Z,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"✨ Spend by Provider"}),o?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(e9.Z,{className:"mt-4 h-40",variant:"pie",data:O,index:"provider",category:"spend"})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Provider"}),(0,a.jsx)(q.Z,{children:"Spend"})]})}),(0,a.jsx)(U.Z,{children:O.map(e=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.provider}),(0,a.jsx)(D.Z,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":e.spend.toFixed(2)})]},e.provider))})]})})]})}):(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})]})]})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"All Up"}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(M.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:M.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(M.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:M.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),o?(0,a.jsx)(a.Fragment,{children:G.map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:eg,onValueChange:e=>console.log(e)})]})]})]},l))}):(0,a.jsx)(a.Fragment,{children:G&&G.length>0&&G.slice(0,1).map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Activity by Model"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see analytics for all models"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],valueFormatter:eg,categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]})]},l))})]})})]})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(h.Z,{numColSpan:2,children:[(0,a.jsxs)(R.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"Total Spend Per Team"}),(0,a.jsx)(e6.Z,{data:P})]}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Daily Spend Per Team"}),(0,a.jsx)(ec.Z,{className:"h-72",data:S,showLegend:!0,index:"date",categories:C,yAxisWidth:80,colors:["blue","green","yellow","red","purple"],stack:!0})]})]}),(0,a.jsx)(h.Z,{numColSpan:2})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:em,onValueChange:e=>{eu(e),eZ(e.from,e.to,null)}})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Key"}),(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{eZ(em.from,em.to,null)},children:"All Keys"},"all-keys"),null==i?void 0:i.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{eZ(em.from,em.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,a.jsx)(R.Z,{className:"mt-4",children:(0,a.jsxs)(L.Z,{className:"max-h-[70vh] min-h-[500px]",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Customer"}),(0,a.jsx)(q.Z,{children:"Spend"}),(0,a.jsx)(q.Z,{children:"Total Events"})]})}),(0,a.jsx)(U.Z,{children:null==b?void 0:b.map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.end_user}),(0,a.jsx)(D.Z,{children:null===(s=e.total_spend)||void 0===s?void 0:s.toFixed(4)}),(0,a.jsx)(D.Z,{children:e.total_count})]},l)})})]})})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(el.Z,{className:"mb-4",enableSelect:!0,value:em,onValueChange:e=>{eu(e),e_(e.from,e.to)}})}),(0,a.jsx)(h.Z,{children:o?(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),A&&A.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsx)(eo.Z,{value:String(e),children:e},e))]})}):(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),A&&A.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsxs)(z.Z,{value:String(e),disabled:!0,children:["✨ ",e," (Enterpise only Feature)"]},e))]})})})]}),(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Spend Per Tag"}),(0,a.jsxs)(f.Z,{children:["Get Started Tracking cost per tag ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,a.jsx)(ec.Z,{className:"h-72",data:w,index:"name",categories:["spend"],colors:["blue"]})]})}),(0,a.jsx)(h.Z,{numColSpan:2})]})]})]})]})})},le=()=>{let{Title:e,Paragraph:l}=$.default,[s,t]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[u,h]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(!0),Z=(0,i.useSearchParams)(),[_,f]=(0,r.useState)({data:[]}),y=Z.get("userID"),b=Z.get("token"),[v,S]=(0,r.useState)("api-keys"),[k,w]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(b){let e=(0,X.o)(b);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),w(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e.toLowerCase())),console.log("Received user role length: ".concat(e.toLowerCase().length)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),t(l),"Admin Viewer"==l&&S("usage")}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e)),e.login_method?g("username_password"==e.login_method):console.log("User Email is not set ".concat(e)),e.premium_user&&o(e.premium_user)}}},[b]),(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{children:"Loading..."}),children:(0,a.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,a.jsx)(m,{userID:y,userRole:s,userEmail:d,showSSOBanner:j,premiumUser:n}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,a.jsx)("div",{className:"mt-8",children:(0,a.jsx)(e3,{setPage:S,userRole:s,defaultSelectedKey:null})}),"api-keys"==v?(0,a.jsx)(Q,{userID:y,userRole:s,teams:u,keys:x,setUserRole:t,userEmail:d,setUserEmail:c,setTeams:h,setKeys:p}):"models"==v?(0,a.jsx)(eE,{userID:y,userRole:s,token:b,keys:x,accessToken:k,modelData:_,setModelData:f,premiumUser:n}):"llm-playground"==v?(0,a.jsx)(e2,{userID:y,userRole:s,token:b,accessToken:k}):"users"==v?(0,a.jsx)(eF,{userID:y,userRole:s,token:b,keys:x,teams:u,accessToken:k,setKeys:p}):"teams"==v?(0,a.jsx)(eR,{teams:u,setTeams:h,searchParams:Z,accessToken:k,userID:y,userRole:s}):"admin-panel"==v?(0,a.jsx)(eM,{setTeams:h,searchParams:Z,accessToken:k,showSSOBanner:j}):"api_ref"==v?(0,a.jsx)(e0,{}):"settings"==v?(0,a.jsx)(eB,{userID:y,userRole:s,accessToken:k,premiumUser:n}):"budgets"==v?(0,a.jsx)(e$,{accessToken:k}):"general-settings"==v?(0,a.jsx)(eJ,{userID:y,userRole:s,accessToken:k,modelData:_}):"model-hub"==v?(0,a.jsx)(eQ.Z,{accessToken:k,publicPage:!1,premiumUser:n}):(0,a.jsx)(e7,{userID:y,userRole:s,token:b,accessToken:k,keys:x,premiumUser:n})]})]})})}},41134:function(e,l,s){"use strict";s.d(l,{Z:function(){return y}});var t=s(3827),n=s(64090),a=s(47907),r=s(777),i=s(16450),o=s(13810),d=s(92836),c=s(26734),m=s(41608),u=s(32126),h=s(23682),x=s(71801),p=s(42440),j=s(84174),g=s(50459),Z=s(6180),_=s(99129),f=s(67951),y=e=>{var l;let{accessToken:s,publicPage:y,premiumUser:b}=e,[v,S]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,A]=(0,n.useState)(!1),[I,C]=(0,n.useState)(!1),[E,P]=(0,n.useState)(null),T=(0,a.useRouter)();(0,n.useEffect)(()=>{s&&(async()=>{try{let e=await (0,r.kn)(s);console.log("ModelHubData:",e),w(e.data),(0,r.E9)(s,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&S(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}})()},[s,y]);let O=e=>{P(e),A(!0)},F=async()=>{s&&(0,r.jA)(s,"enable_public_model_hub",!0).then(e=>{C(!0)})},R=()=>{A(!1),C(!1),P(null)},M=()=>{A(!1),C(!1),P(null)},L=e=>{navigator.clipboard.writeText(e)};return(0,t.jsxs)("div",{children:[y&&v||!1==y?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsx)("div",{className:"relative w-full"}),(0,t.jsxs)("div",{className:"flex ".concat(y?"justify-between":"items-center"),children:[(0,t.jsx)(p.Z,{className:"ml-8 text-center ",children:"Model Hub"}),!1==y?b?(0,t.jsx)(i.Z,{className:"ml-4",onClick:()=>F(),children:"✨ Make Public"}):(0,t.jsx)(i.Z,{className:"ml-4",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Make Public"})}):(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("p",{children:"Filter by key:"}),(0,t.jsx)(x.Z,{className:"bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center",children:"/ui/model_hub?key="})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-6 sm:grid-cols-3 lg:grid-cols-4 pr-8",children:k&&k.map(e=>(0,t.jsxs)(o.Z,{className:"mt-5 mx-8",children:[(0,t.jsxs)("pre",{className:"flex justify-between",children:[(0,t.jsx)(p.Z,{children:e.model_group}),(0,t.jsx)(Z.Z,{title:e.model_group,children:(0,t.jsx)(j.Z,{onClick:()=>L(e.model_group),style:{cursor:"pointer",marginRight:"10px"}})})]}),(0,t.jsxs)("div",{className:"my-5",children:[(0,t.jsxs)(x.Z,{children:["Mode: ",e.mode]}),(0,t.jsxs)(x.Z,{children:["Supports Function Calling:"," ",(null==e?void 0:e.supports_function_calling)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Supports Vision:"," ",(null==e?void 0:e.supports_vision)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Max Input Tokens:"," ",(null==e?void 0:e.max_input_tokens)?null==e?void 0:e.max_input_tokens:"N/A"]}),(0,t.jsxs)(x.Z,{children:["Max Output Tokens:"," ",(null==e?void 0:e.max_output_tokens)?null==e?void 0:e.max_output_tokens:"N/A"]})]}),(0,t.jsx)("div",{style:{marginTop:"auto",textAlign:"right"},children:(0,t.jsxs)("a",{href:"#",onClick:()=>O(e),style:{color:"#1890ff",fontSize:"smaller"},children:["View more ",(0,t.jsx)(g.Z,{})]})})]},e.model_group))})]}):(0,t.jsxs)(o.Z,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(x.Z,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(_.Z,{title:"Public Model Hub",width:600,visible:I,footer:null,onOk:R,onCancel:M,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(x.Z,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(x.Z,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"/ui/model_hub?key="})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Z,{onClick:()=>{T.replace("/model_hub?key=".concat(s))},children:"See Page"})})]})}),(0,t.jsx)(_.Z,{title:E&&E.model_group?E.model_group:"Unknown Model",width:800,visible:N,footer:null,onOk:R,onCancel:M,children:E&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-4",children:(0,t.jsx)("strong",{children:"Model Information & Usage"})}),(0,t.jsxs)(c.Z,{children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:"OpenAI Python SDK"}),(0,t.jsx)(d.Z,{children:"Supported OpenAI Params"}),(0,t.jsx)(d.Z,{children:"LlamaIndex"}),(0,t.jsx)(d.Z,{children:"Langchain Py"})]}),(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(E.model_group,'", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:"".concat(null===(l=E.supported_openai_params)||void 0===l?void 0:l.map(e=>"".concat(e,"\n")).join(""))})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="'.concat(E.model_group,'", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "'.concat(E.model_group,'",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n ')})})]})]})]})})]})}}},function(e){e.O(0,[936,294,131,235,759,777,971,69,744],function(){return e(e.s=20661)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-7788673d99ee79d9.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-7788673d99ee79d9.js
new file mode 100644
index 000000000..15b2ad673
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-7788673d99ee79d9.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{20661:function(e,l,s){Promise.resolve().then(s.bind(s,31034))},31034:function(e,l,s){"use strict";s.r(l),s.d(l,{default:function(){return ls}});var t,n,a=s(3827),r=s(64090),i=s(47907),o=s(8792),d=s(40491),c=s(65270),m=e=>{let{userID:l,userRole:s,userEmail:t,showSSOBanner:n,premiumUser:r}=e;console.log("User ID:",l),console.log("userEmail:",t),console.log("showSSOBanner:",n),console.log("premiumUser:",r);let i=[{key:"1",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:["Role: ",s]}),(0,a.jsxs)("p",{children:["ID: ",l]}),(0,a.jsxs)("p",{children:["Premium User: ",String(r)]})]})},{key:"2",label:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("p",{children:"Logout"})})}];return(0,a.jsxs)("nav",{className:"left-0 right-0 top-0 flex justify-between items-center h-12 mb-4",children:[(0,a.jsx)("div",{className:"text-left my-2 absolute top-0 left-0",children:(0,a.jsx)("div",{className:"flex flex-col items-center",children:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("button",{className:"text-gray-800 rounded text-center",children:(0,a.jsx)("img",{src:"/get_image",width:160,height:160,alt:"LiteLLM Brand",className:"mr-2"})})})})}),(0,a.jsxs)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0 flex items-center justify-end space-x-2",children:[n?(0,a.jsx)("div",{style:{padding:"6px",borderRadius:"8px"},children:(0,a.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",style:{fontSize:"14px",textDecoration:"underline"},children:"Get enterpise license"})}):null,(0,a.jsx)("div",{style:{border:"1px solid #391085",padding:"6px",borderRadius:"8px"},children:(0,a.jsx)(d.Z,{menu:{items:i},children:(0,a.jsx)(c.Z,{children:t})})})]})]})},u=s(777),h=s(10384),x=s(46453),p=s(16450),j=s(52273),g=s(26780),Z=s(15595),f=s(6698),_=s(71801),y=s(42440),b=s(42308),v=s(50670),S=s(60620),k=s(80588),w=s(99129),N=s(44839),I=s(88707),A=s(1861);let{Option:C}=v.default;var P=e=>{let{userID:l,team:s,userRole:t,accessToken:n,data:i,setData:o}=e,[d]=S.Z.useForm(),[c,m]=(0,r.useState)(!1),[P,T]=(0,r.useState)(null),[E,O]=(0,r.useState)(null),[F,M]=(0,r.useState)([]),[R,D]=(0,r.useState)([]),L=()=>{m(!1),d.resetFields()},U=()=>{m(!1),T(null),d.resetFields()};(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===t)return;if(null!==n){let e=(await (0,u.So)(n,l,t)).data.map(e=>e.id);console.log("available_model_names:",e),M(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,t]);let q=async e=>{try{var s,t,a;let r=null!==(s=null==e?void 0:e.key_alias)&&void 0!==s?s:"",c=null!==(t=null==e?void 0:e.team_id)&&void 0!==t?t:null;if((null!==(a=null==i?void 0:i.filter(e=>e.team_id===c).map(e=>e.key_alias))&&void 0!==a?a:[]).includes(r))throw Error("Key alias ".concat(r," already exists for team with ID ").concat(c,", please provide another key alias"));k.ZP.info("Making API Call"),m(!0);let h=await (0,u.wX)(n,l,e);console.log("key create Response:",h),o(e=>e?[...e,h]:[h]),T(h.key),O(h.soft_budget),k.ZP.success("API Key Created"),d.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,r.useEffect)(()=>{D(s&&s.models.length>0?s.models.includes("all-proxy-models")?F:s.models:F)},[s,F]),(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>m(!0),children:"+ Create New Key"}),(0,a.jsx)(w.Z,{title:"Create Key",visible:c,width:800,footer:null,onOk:L,onCancel:U,children:(0,a.jsxs)(S.Z,{form:d,onFinish:q,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",hidden:!0,initialValue:s?s.team_id:null,valuePropName:"team_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s?s.team_alias:"",disabled:!0})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},onChange:e=>{e.includes("all-team-models")&&d.setFieldsValue({models:["all-team-models"]})},children:[(0,a.jsx)(C,{value:"all-team-models",children:"All Team Models"},"all-team-models"),R.map(e=>(0,a.jsx)(C,{value:e,children:e},e))]})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(f.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==s?void 0:s.max_budget)!==null&&(null==s?void 0:s.max_budget)!==void 0?null==s?void 0:s.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.max_budget&&l>s.max_budget)throw Error("Budget cannot exceed team max budget: $".concat(s.max_budget))}}],children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",help:"Team Reset Budget: ".concat((null==s?void 0:s.budget_duration)!==null&&(null==s?void 0:s.budget_duration)!==void 0?null==s?void 0:s.budget_duration:"None"),children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Tokens per minute Limit (TPM)",name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==s?void 0:s.tpm_limit)!==null&&(null==s?void 0:s.tpm_limit)!==void 0?null==s?void 0:s.tpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.tpm_limit&&l>s.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(s.tpm_limit))}}],children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Requests per minute Limit (RPM)",name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==s?void 0:s.rpm_limit)!==null&&(null==s?void 0:s.rpm_limit)!==void 0?null==s?void 0:s.rpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.rpm_limit&&l>s.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(s.rpm_limit))}}],children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Expire Key (eg: 30s, 30h, 30d)",name:"duration",className:"mt-8",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",className:"mt-8",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Key"})})]})}),P&&(0,a.jsx)(w.Z,{visible:c,onOk:L,onCancel:U,footer:null,children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Save your Key"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons, ",(0,a.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,a.jsx)(h.Z,{numColSpan:1,children:null!=P?(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mt-3",children:"API Key:"}),(0,a.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,a.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:P})}),(0,a.jsx)(b.CopyToClipboard,{text:P,onCopy:()=>{k.ZP.success("API Key copied to clipboard")},children:(0,a.jsx)(p.Z,{className:"mt-3",children:"Copy API Key"})})]}):(0,a.jsx)(_.Z,{children:"Key being created, this might take 30s"})})]})})]})},T=s(9454),E=s(98941),O=s(33393),F=s(5),M=s(13810),R=s(61244),D=s(10827),L=s(3851),U=s(2044),q=s(64167),V=s(74480),z=s(7178),B=s(95093),K=s(27166);let{Option:W}=v.default;var H=e=>{let{userID:l,userRole:s,accessToken:t,selectedTeam:n,data:i,setData:o,teams:d}=e,[c,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(!1),[j,g]=(0,r.useState)(null),[Z,f]=(0,r.useState)(null),[b,C]=(0,r.useState)(null),[P,H]=(0,r.useState)(""),[G,J]=(0,r.useState)(!1),[Y,X]=(0,r.useState)(!1),[$,Q]=(0,r.useState)(null),[ee,el]=(0,r.useState)([]),es=new Set,[et,en]=(0,r.useState)(es);(0,r.useEffect)(()=>{(async()=>{try{if(null===l)return;if(null!==t&&null!==s){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),el(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[t,l,s]),(0,r.useEffect)(()=>{if(d){let e=new Set;d.forEach((l,s)=>{let t=l.team_id;e.add(t)}),en(e)}},[d]);let ea=e=>{console.log("handleEditClick:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),Q(e),J(!0)},er=async e=>{if(null==t)return;let l=e.token;e.key=l,console.log("handleEditSubmit:",e);let s=await (0,u.Nc)(t,e);console.log("handleEditSubmit: newKeyValues",s),i&&o(i.map(e=>e.token===l?s:e)),k.ZP.success("Key updated successfully"),J(!1),Q(null)},ei=async e=>{console.log("handleDelete:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),null!=i&&(g(e.token),localStorage.removeItem("userData"+l),x(!0))},eo=async()=>{if(null!=j&&null!=i){try{await (0,u.I1)(t,j);let e=i.filter(e=>e.token!==j);o(e)}catch(e){console.error("Error deleting the key:",e)}x(!1),g(null)}};if(null!=i)return console.log("RERENDER TRIGGERED"),(0,a.jsxs)("div",{children:[(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4 mt-2",children:[(0,a.jsxs)(D.Z,{className:"mt-5 max-h-[300px] min-h-[300px]",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Key Alias"}),(0,a.jsx)(V.Z,{children:"Secret Key"}),(0,a.jsx)(V.Z,{children:"Spend (USD)"}),(0,a.jsx)(V.Z,{children:"Budget (USD)"}),(0,a.jsx)(V.Z,{children:"Models"}),(0,a.jsx)(V.Z,{children:"TPM / RPM Limits"})]})}),(0,a.jsx)(L.Z,{children:i.map(e=>{if(console.log(e),"litellm-dashboard"===e.team_id)return null;if(n){if(console.log("item team id: ".concat(e.team_id,", knownTeamIDs.has(item.team_id): ").concat(et.has(e.team_id),", selectedTeam id: ").concat(n.team_id)),(null!=n.team_id||null===e.team_id||et.has(e.team_id))&&e.team_id!=n.team_id)return null;console.log("item team id: ".concat(e.team_id,", is returned"))}return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{style:{maxWidth:"2px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!=e.key_alias?(0,a.jsx)(_.Z,{children:e.key_alias}):(0,a.jsx)(_.Z,{children:"Not Set"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:e.key_name})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:(()=>{try{return parseFloat(e.spend).toFixed(4)}catch(l){return e.spend}})()})}),(0,a.jsx)(U.Z,{children:null!=e.max_budget?(0,a.jsx)(_.Z,{children:e.max_budget}):(0,a.jsx)(_.Z,{children:"Unlimited"})}),(0,a.jsx)(U.Z,{children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(a.Fragment,{children:n&&n.models&&n.models.length>0?n.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l)):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:"all-proxy-models"})})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(U.Z,{children:(0,a.jsxs)(_.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{})," RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{onClick:()=>{Q(e),X(!0)},icon:T.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:Y,onCancel:()=>{X(!1),Q(null)},footer:null,width:800,children:$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-8",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Spend"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:(()=>{try{return parseFloat($.spend).toFixed(4)}catch(e){return $.spend}})()})})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Budget"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.max_budget?(0,a.jsx)(a.Fragment,{children:$.max_budget}):(0,a.jsx)(a.Fragment,{children:"Unlimited"})})})]},e.name),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Expires"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor-default font-small text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.expires?(0,a.jsx)(a.Fragment,{children:new Date($.expires).toLocaleString(void 0,{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}):(0,a.jsx)(a.Fragment,{children:"Never"})})})]},e.name)]}),(0,a.jsxs)(M.Z,{className:"my-4",children:[(0,a.jsx)(y.Z,{children:"Token Name"}),(0,a.jsx)(_.Z,{className:"my-1",children:$.key_alias?$.key_alias:$.key_name}),(0,a.jsx)(y.Z,{children:"Token ID"}),(0,a.jsx)(_.Z,{className:"my-1 text-[12px]",children:$.token}),(0,a.jsx)(y.Z,{children:"Metadata"}),(0,a.jsx)(_.Z,{className:"my-1",children:(0,a.jsxs)("pre",{children:[JSON.stringify($.metadata)," "]})})]}),(0,a.jsx)(p.Z,{className:"mx-auto flex items-center",onClick:()=>{X(!1),Q(null)},children:"Close"})]})}),(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>ea(e)}),(0,a.jsx)(R.Z,{onClick:()=>ei(e),icon:O.Z,size:"sm"})]})]},e.token)})})]}),h&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Key"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this key ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:eo,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{x(!1),g(null)},children:"Cancel"})]})]})]})})]}),$&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,token:t,onSubmit:i}=e,[o]=S.Z.useForm(),[c,m]=(0,r.useState)(n),[u,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1);return(0,a.jsx)(w.Z,{title:"Edit Key",visible:l,width:800,footer:null,onOk:()=>{o.validateFields().then(e=>{o.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:o,onFinish:er,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{validator:(e,l)=>{let s=l.filter(e=>!c.models.includes(e)&&"all-team-models"!==e&&"all-proxy-models"!==e&&!c.models.includes("all-proxy-models"));return(console.log("errorModels: ".concat(s)),s.length>0)?Promise.reject("Some models are not part of the new team's models - ".concat(s,"Team models: ").concat(c.models)):Promise.resolve()}}],children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(W,{value:"all-team-models",children:"All Team Models"},"all-team-models"),c&&c.models?c.models.includes("all-proxy-models")?ee.filter(e=>"all-proxy-models"!==e).map(e=>(0,a.jsx)(W,{value:e,children:e},e)):c.models.map(e=>(0,a.jsx)(W,{value:e,children:e},e)):ee.map(e=>(0,a.jsx)(W,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: ".concat((null==c?void 0:c.max_budget)!==null&&(null==c?void 0:c.max_budget)!==void 0?null==c?void 0:c.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&c&&null!==c.max_budget&&l>c.max_budget)throw console.log("keyTeam.max_budget: ".concat(c.max_budget)),Error("Budget cannot exceed team max budget: $".concat(c.max_budget))}}],children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"token",name:"token",hidden:!0}),(0,a.jsx)(S.Z.Item,{label:"Team",name:"team_id",help:"the team this key belongs to",children:(0,a.jsx)(B.Z,{value:t.team_alias,children:null==d?void 0:d.map((e,l)=>(0,a.jsx)(K.Z,{value:e.team_id,onClick:()=>m(e),children:e.team_alias},l))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Edit Key"})})]})})},{visible:G,onCancel:()=>{J(!1),Q(null)},token:$,onSubmit:er})]})},G=e=>{let{userID:l,userRole:s,accessToken:t,userSpend:n,selectedTeam:i}=e;console.log("userSpend: ".concat(n));let[o,d]=(0,r.useState)(null!==n?n:0),[c,m]=(0,r.useState)(0),[h,x]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(t&&l&&s&&"Admin"===s&&null==n)try{let e=await (0,u.Qy)(t);e&&(e.spend?d(e.spend):d(0),e.max_budget?m(e.max_budget):m(0))}catch(e){console.error("Error fetching global spend data:",e)}};(async()=>{try{if(null===l||null===s)return;if(null!==t){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),x(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[s,t,l]),(0,r.useEffect)(()=>{null!==n&&d(n)},[n]);let p=[];i&&i.models&&(p=i.models),p&&p.includes("all-proxy-models")?(console.log("user models:",h),p=h):p&&p.includes("all-team-models")?p=i.models:p&&0===p.length&&(p=h);let j=void 0!==o?o.toFixed(4):null;return console.log("spend in view user spend: ".concat(o)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("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:["$",j]})]})})},J=e=>{let{userID:l,userRole:s,selectedTeam:t,accessToken:n}=e,[i,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===s)return;if(null!==n){let e=(await (0,u.So)(n,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),o(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,s]);let d=[];return t&&t.models&&(d=t.models),d&&d.includes("all-proxy-models")&&(console.log("user models:",i),d=i),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"mb-5",children:(0,a.jsx)("p",{className:"text-3xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:null==t?void 0:t.team_alias})})})},Y=e=>{let l,{teams:s,setSelectedTeam:t,userRole:n}=e,i={models:[],team_id:null,team_alias:"Default Team"},[o,d]=(0,r.useState)(i);return(l="App User"===n?s:s?[...s,i]:[i],"App User"===n)?null:(0,a.jsxs)("div",{className:"mt-5 mb-5",children:[(0,a.jsx)(y.Z,{children:"Select Team"}),(0,a.jsx)(_.Z,{children:"If you belong to multiple teams, this setting controls which team is used by default when creating new API Keys."}),(0,a.jsxs)(_.Z,{className:"mt-3 mb-3",children:[(0,a.jsx)("b",{children:"Default Team:"})," If no team_id is set for a key, it will be grouped under here."]}),l&&l.length>0?(0,a.jsx)(B.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(K.Z,{value:String(l),onClick:()=>t(e),children:e.team_alias},l))}):(0,a.jsxs)(_.Z,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]})},X=s(37963),$=s(97482);console.log("isLocal:",!1);var Q=e=>{let{userID:l,userRole:s,teams:t,keys:n,setUserRole:o,userEmail:d,setUserEmail:c,setTeams:m,setKeys:p}=e,[j,g]=(0,r.useState)(null),Z=(0,i.useSearchParams)();Z.get("viewSpend"),(0,i.useRouter)();let f=Z.get("token"),[_,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[S,k]=(0,r.useState)([]),w={models:[],team_alias:"Default Team",team_id:null},[N,I]=(0,r.useState)(t?t[0]:w);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,r.useEffect)(()=>{if(f){let e=(0,X.o)(f);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),y(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),o(l)}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e))}}if(l&&_&&s&&!n&&!j){let e=sessionStorage.getItem("userModels"+l);e?k(JSON.parse(e)):(async()=>{try{let e=await (0,u.Br)(_,l,s,!1,null,null);if(console.log("received teams in user dashboard: ".concat(Object.keys(e),"; team values: ").concat(Object.entries(e.teams))),"Admin"==s){let e=await (0,u.Qy)(_);g(e),console.log("globalSpend:",e)}else g(e.user_info);p(e.keys),m(e.teams);let t=[...e.teams];t.length>0?(console.log("response['teams']: ".concat(t)),I(t[0])):I(w),sessionStorage.setItem("userData"+l,JSON.stringify(e.keys)),sessionStorage.setItem("userSpendData"+l,JSON.stringify(e.user_info));let n=(await (0,u.So)(_,l,s)).data.map(e=>e.id);console.log("available_model_names:",n),k(n),console.log("userModels:",S),sessionStorage.setItem("userModels"+l,JSON.stringify(n))}catch(e){console.error("There was an error fetching the data",e)}})()}},[l,f,_,n,s]),(0,r.useEffect)(()=>{if(null!==n&&null!=N&&null!==N.team_id){let e=0;for(let l of n)N.hasOwnProperty("team_id")&&null!==l.team_id&&l.team_id===N.team_id&&(e+=l.spend);v(e)}else if(null!==n){let e=0;for(let l of n)e+=l.spend;v(e)}},[N]),null==l||null==f){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}if(null==_)return null;if(null==s&&o("App Owner"),s&&"Admin Viewer"==s){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",N),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(J,{userID:l,userRole:s,selectedTeam:N||null,accessToken:_}),(0,a.jsx)(G,{userID:l,userRole:s,accessToken:_,userSpend:b,selectedTeam:N||null}),(0,a.jsx)(H,{userID:l,userRole:s,accessToken:_,selectedTeam:N||null,data:n,setData:p,teams:t}),(0,a.jsx)(P,{userID:l,team:N||null,userRole:s,accessToken:_,data:n,setData:p},N?N.team_id:null),(0,a.jsx)(Y,{teams:t,setSelectedTeam:I,userRole:s})]})})})},ee=s(49167),el=s(35087),es=s(92836),et=s(26734),en=s(41608),ea=s(32126),er=s(23682),ei=s(47047),eo=s(76628),ed=s(25707),ec=s(44041),em=s(6180),eu=s(28683),eh=s(38302),ex=s(66242),ep=s(78578),ej=s(63954),eg=s(34658),eZ=e=>{let{modelID:l,accessToken:s}=e,[t,n]=(0,r.useState)(!1),i=async()=>{try{k.ZP.info("Making API Call"),n(!0);let e=await (0,u.Og)(s,l);console.log("model delete Response:",e),k.ZP.success("Model ".concat(l," deleted successfully")),n(!1)}catch(e){console.error("Error deleting the model:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{onClick:()=>n(!0),icon:O.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:t,onOk:i,okType:"danger",onCancel:()=>n(!1),children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Delete Model"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)("p",{children:"Are you sure you want to delete this model? This action is irreversible."})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Model ID: ",(0,a.jsx)("b",{children:l})]})})]})})]})},ef=s(97766),e_=s(46495),ey=s(18190),eb=s(91118),ev=e=>{let{modelMetrics:l,modelMetricsCategories:s,customTooltip:t,premiumUser:n}=e;return n?(0,a.jsx)(eb.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:s,colors:["indigo","rose"],connectNulls:!0,customTooltip:t}):(0,a.jsxs)("div",{children:[(0,a.jsx)(ey.Z,{title:"✨ Enterprise Feature",color:"teal",className:"mt-2 mb-4",children:"Enterprise features are available for users with a specific license, please contact LiteLLM to unlock this limitation."}),(0,a.jsx)(p.Z,{variant:"primary",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get in touch"})})]})},eS=e=>{let{fields:l,selectedProvider:s}=e;return 0===l.length?null:(0,a.jsx)(a.Fragment,{children:l.map(e=>(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:e.field_name.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),name:e.field_name,tooltip:e.field_description,className:"mb-2",children:(0,a.jsx)(j.Z,{placeholder:e.field_value,type:"password"})},e.field_name))})},ek=s(67951);let{Title:ew,Link:eN}=$.default;(t=n||(n={})).OpenAI="OpenAI",t.Azure="Azure",t.Anthropic="Anthropic",t.Google_AI_Studio="Google AI Studio",t.Bedrock="Amazon Bedrock",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.Databricks="Databricks";let eI={OpenAI:"openai",Azure:"azure",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",OpenAI_Compatible:"openai",Vertex_AI:"vertex_ai",Databricks:"databricks"},eA={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"},eC=async(e,l,s)=>{try{let t=Array.isArray(e.model)?e.model:[e.model];console.log("received deployments: ".concat(t)),console.log("received type of deployments: ".concat(typeof t)),t.forEach(async s=>{console.log("litellm_model: ".concat(s));let t={},n={};t.model=s;let a="";for(let[l,s]of(console.log("formValues add deployment:",e),Object.entries(e)))if(""!==s){if("model_name"==l)a+=s;else if("custom_llm_provider"==l)continue;else if("model"==l)continue;else if("base_model"===l)n[l]=s;else if("litellm_extra_params"==l){console.log("litellm_extra_params:",s);let e={};if(s&&void 0!=s){try{e=JSON.parse(s)}catch(e){throw k.ZP.error("Failed to parse LiteLLM Extra Params: "+e,10),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,s]of Object.entries(e))t[l]=s}}else t[l]=s}let r={model_name:a,litellm_params:t,model_info:n},i=await (0,u.kK)(l,r);console.log("response for model create call: ".concat(i.data))}),s.resetFields()}catch(e){k.ZP.error("Failed to create model: "+e,10)}};var eP=e=>{var l,s,t;let i,{accessToken:o,token:d,userRole:c,userID:m,modelData:h={data:[]},keys:g,setModelData:Z,premiumUser:f}=e,[b,v]=(0,r.useState)([]),[N]=S.Z.useForm(),[C,P]=(0,r.useState)(null),[O,W]=(0,r.useState)(""),[H,G]=(0,r.useState)([]),J=Object.values(n).filter(e=>isNaN(Number(e))),[Y,X]=(0,r.useState)([]),[Q,ey]=(0,r.useState)("OpenAI"),[eb,eP]=(0,r.useState)(""),[eT,eE]=(0,r.useState)(!1),[eO,eF]=(0,r.useState)(!1),[eM,eR]=(0,r.useState)(null),[eD,eL]=(0,r.useState)([]),[eU,eq]=(0,r.useState)(null),[eV,ez]=(0,r.useState)([]),[eB,eK]=(0,r.useState)([]),[eW,eH]=(0,r.useState)([]),[eG,eJ]=(0,r.useState)([]),[eY,eX]=(0,r.useState)([]),[e$,eQ]=(0,r.useState)([]),[e0,e1]=(0,r.useState)([]),[e2,e4]=(0,r.useState)([]),[e5,e8]=(0,r.useState)([]),[e3,e6]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[e9,e7]=(0,r.useState)(null),[le,ll]=(0,r.useState)(0),[ls,lt]=(0,r.useState)({}),[ln,la]=(0,r.useState)([]),[lr,li]=(0,r.useState)(!1),[lo,ld]=(0,r.useState)(null),[lc,lm]=(0,r.useState)(null),[lu,lh]=(0,r.useState)([]);(0,r.useEffect)(()=>{lb(eU,e3.from,e3.to)},[lo,lc]);let lx=e=>{eR(e),eE(!0)},lp=e=>{eR(e),eF(!0)},lj=async e=>{if(console.log("handleEditSubmit:",e),null==o)return;let l={},s=null;for(let[t,n]of Object.entries(e))"model_id"!==t?l[t]=n:s=n;let t={litellm_params:l,model_info:{id:s}};console.log("handleEditSubmit payload:",t);try{await (0,u.um)(o,t),k.ZP.success("Model updated successfully, restart server to see updates"),eE(!1),eR(null)}catch(e){console.log("Error occurred")}},lg=()=>{W(new Date().toLocaleString())},lZ=async()=>{if(!o){console.error("Access token is missing");return}console.log("new modelGroupRetryPolicy:",e9);try{await (0,u.K_)(o,{router_settings:{model_group_retry_policy:e9}}),k.ZP.success("Retry settings saved successfully")}catch(e){console.error("Failed to save retry settings:",e),k.ZP.error("Failed to save retry settings")}};if((0,r.useEffect)(()=>{if(!o||!d||!c||!m)return;let e=async()=>{try{var e,l,s,t,n,a,r,i,d,h,x,p;let j=await (0,u.hy)(o);X(j);let g=await (0,u.AZ)(o,m,c);console.log("Model data response:",g.data),Z(g);let f=new Set;for(let e=0;e0&&(y=_[_.length-1],console.log("_initial_model_group:",y),eq(y)),console.log("selectedModelGroup:",eU);let b=await (0,u.o6)(o,m,c,y,null===(e=e3.from)||void 0===e?void 0:e.toISOString(),null===(l=e3.to)||void 0===l?void 0:l.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model metrics response:",b),eK(b.data),eH(b.all_api_bases);let v=await (0,u.Rg)(o,y,null===(s=e3.from)||void 0===s?void 0:s.toISOString(),null===(t=e3.to)||void 0===t?void 0:t.toISOString());eJ(v.data),eX(v.all_api_bases);let S=await (0,u.N8)(o,m,c,y,null===(n=e3.from)||void 0===n?void 0:n.toISOString(),null===(a=e3.to)||void 0===a?void 0:a.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model exceptions response:",S),eQ(S.data),e1(S.exception_types);let k=await (0,u.fP)(o,m,c,y,null===(r=e3.from)||void 0===r?void 0:r.toISOString(),null===(i=e3.to)||void 0===i?void 0:i.toISOString(),null==lo?void 0:lo.token,lc),w=await (0,u.n$)(o,null===(d=e3.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(h=e3.to)||void 0===h?void 0:h.toISOString().split("T")[0],y);lt(w);let N=await (0,u.v9)(o,null===(x=e3.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=e3.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);la(N),console.log("dailyExceptions:",w),console.log("dailyExceptionsPerDeplyment:",N),console.log("slowResponses:",k),e8(k);let I=await (0,u.j2)(o);lh(null==I?void 0:I.end_users);let A=(await (0,u.BL)(o,m,c)).router_settings;console.log("routerSettingsInfo:",A);let C=A.model_group_retry_policy,P=A.num_retries;console.log("model_group_retry_policy:",C),console.log("default_retries:",P),e7(C),ll(P)}catch(e){console.error("There was an error fetching the model data",e)}};o&&d&&c&&m&&e();let l=async()=>{let e=await (0,u.qm)();console.log("received model cost map data: ".concat(Object.keys(e))),P(e)};null==C&&l(),lg()},[o,d,c,m,C,O]),!h||!o||!d||!c||!m)return(0,a.jsx)("div",{children:"Loading..."});let lf=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(C)),null!=C&&"object"==typeof C&&e in C)?C[e].litellm_provider:"openai";if(n){let e=n.split("/"),l=e[0];r=1===e.length?u(n):l}else r="openai";a&&(i=null==a?void 0:a.input_cost_per_token,o=null==a?void 0:a.output_cost_per_token,d=null==a?void 0:a.max_tokens,c=null==a?void 0:a.max_input_tokens),(null==t?void 0:t.litellm_params)&&(m=Object.fromEntries(Object.entries(null==t?void 0:t.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),h.data[e].provider=r,h.data[e].input_cost=i,h.data[e].output_cost=o,h.data[e].input_cost&&(h.data[e].input_cost=(1e6*Number(h.data[e].input_cost)).toFixed(2)),h.data[e].output_cost&&(h.data[e].output_cost=(1e6*Number(h.data[e].output_cost)).toFixed(2)),h.data[e].max_tokens=d,h.data[e].max_input_tokens=c,h.data[e].api_base=null==t?void 0:null===(s=t.litellm_params)||void 0===s?void 0:s.api_base,h.data[e].cleanedLitellmParams=m,lf.push(t.model_name),console.log(h.data[e])}if(c&&"Admin Viewer"==c){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let l_=e=>{console.log("received provider string: ".concat(e));let l=Object.keys(n).find(l=>n[l]===e);if(l){let e=eI[l];console.log("mappingResult: ".concat(e));let s=[];"object"==typeof C&&Object.entries(C).forEach(l=>{let[t,n]=l;null!==n&&"object"==typeof n&&"litellm_provider"in n&&(n.litellm_provider===e||n.litellm_provider.includes(e))&&s.push(t)}),G(s),console.log("providerModels: ".concat(H))}},ly=async()=>{try{k.ZP.info("Running health check..."),eP("");let e=await (0,u.EY)(o);eP(e)}catch(e){console.error("Error running health check:",e),eP("Error running health check")}},lb=async(e,l,s)=>{if(console.log("Updating model metrics for group:",e),!o||!m||!c||!l||!s)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",s),eq(e);let t=null==lo?void 0:lo.token;void 0===t&&(t=null);let n=lc;void 0===n&&(n=null),l.setHours(0),l.setMinutes(0),l.setSeconds(0),s.setHours(23),s.setMinutes(59),s.setSeconds(59);try{let a=await (0,u.o6)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model metrics response:",a),eK(a.data),eH(a.all_api_bases);let r=await (0,u.Rg)(o,e,l.toISOString(),s.toISOString());eJ(r.data),eX(r.all_api_bases);let i=await (0,u.N8)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model exceptions response:",i),eQ(i.data),e1(i.exception_types);let d=await (0,u.fP)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);if(console.log("slowResponses:",d),e8(d),e){let t=await (0,u.n$)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);lt(t);let n=await (0,u.v9)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);la(n)}}catch(e){console.error("Failed to fetch model metrics",e)}},lv=(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mb-1",children:"Select API Key Name"}),f?(0,a.jsxs)("div",{children:[(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{ld(e)},children:e.key_alias},l):null)]}),(0,a.jsx)(_.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(B.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(K.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>{lm(e)},children:e},l))]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsxs)(K.Z,{value:String(l),disabled:!0,onClick:()=>{ld(e)},children:["✨ ",e.key_alias," (Enterpise only Feature)"]},l):null)]}),(0,a.jsx)(_.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(B.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(K.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsxs)(K.Z,{value:e,disabled:!0,onClick:()=>{lm(e)},children:["✨ ",e," (Enterpise only Feature)"]},l))]})]})]}),lS=e=>{var l,s;let{payload:t,active:n}=e;if(!n||!t)return null;let r=null===(s=t[0])||void 0===s?void 0:null===(l=s.payload)||void 0===l?void 0:l.date,i=t.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:t.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,a.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[r&&(0,a.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",r]}),i.map((e,l)=>{let s=parseFloat(e.value.toFixed(5)),t=0===s&&e.value>0?"<0.00001":s.toFixed(5);return(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,a.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:t})]},l)})]})};console.log("selectedProvider: ".concat(Q)),console.log("providerModels.length: ".concat(H.length));let lk=Object.keys(n).find(e=>n[e]===Q);return lk&&(i=Y.find(e=>e.name===eI[lk])),(0,a.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(es.Z,{children:"All Models"}),(0,a.jsx)(es.Z,{children:"Add Model"}),(0,a.jsx)(es.Z,{children:(0,a.jsx)("pre",{children:"/health Models"})}),(0,a.jsx)(es.Z,{children:"Model Analytics"}),(0,a.jsx)(es.Z,{children:"Model Retry Settings"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[O&&(0,a.jsxs)(_.Z,{children:["Last Refreshed: ",O]}),(0,a.jsx)(R.Z,{icon:ej.Z,variant:"shadow",size:"xs",className:"self-center",onClick:lg})]})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(_.Z,{children:"Filter by Public Model Name"}),(0,a.jsxs)(B.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eU||eD[0],onValueChange:e=>eq("all"===e?"all":e),value:eU||eD[0],children:[(0,a.jsx)(K.Z,{value:"all",children:"All Models"}),eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>eq(e),children:e},l))]})]}),(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{style:{maxWidth:"1500px",width:"100%"},children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Public Model Name"}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Provider"}),"Admin"===c&&(0,a.jsx)(V.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"API Base"}),(0,a.jsxs)(V.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Input Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsxs)(V.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Output Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:f?"Created At":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created At"]})}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:f?"Created By":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created By"]})}),(0,a.jsx)(V.Z,{style:{maxWidth:"50px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Status"}),(0,a.jsx)(V.Z,{})]})}),(0,a.jsx)(L.Z,{children:h.data.filter(e=>"all"===eU||e.model_name===eU||null==eU||""===eU).map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{style:{maxHeight:"1px",minHeight:"1px"},children:[(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.model_name||"-"})}),(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.provider||"-"})}),"Admin"===c&&(0,a.jsx)(U.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)(em.Z,{title:e&&e.api_base,children:(0,a.jsx)("pre",{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},className:"text-xs",title:e&&e.api_base?e.api_base:"",children:e&&e.api_base?e.api_base.slice(0,20):"-"})})}),(0,a.jsx)(U.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.input_cost?e.input_cost:e.litellm_params.input_cost_per_token?(1e6*Number(e.litellm_params.input_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(U.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.output_cost?e.output_cost:e.litellm_params.output_cost_per_token?(1e6*Number(e.litellm_params.output_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:f&&((s=e.model_info.created_at)?new Date(s).toLocaleDateString("en-US"):null)||"-"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:f&&e.model_info.created_by||"-"})}),(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:e.model_info.db_model?(0,a.jsx)(F.Z,{size:"xs",className:"text-white",children:(0,a.jsx)("p",{className:"text-xs",children:"DB Model"})}):(0,a.jsx)(F.Z,{size:"xs",className:"text-black",children:(0,a.jsx)("p",{className:"text-xs",children:"Config Model"})})}),(0,a.jsx)(U.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsxs)(x.Z,{numItems:3,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{icon:T.Z,size:"sm",onClick:()=>lp(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>lx(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(eZ,{modelID:e.model_info.id,accessToken:o})})]})})]},l)})})]})})]}),(0,a.jsx)(e=>{let{visible:l,onCancel:s,model:t,onSubmit:n}=e,[r]=S.Z.useForm(),i={},o="",d="";if(t){i=t.litellm_params,o=t.model_name;let e=t.model_info;e&&(d=e.id,console.log("model_id: ".concat(d)),i.model_id=d)}return(0,a.jsx)(w.Z,{title:"Edit Model "+o,visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n(e),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:lj,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"api_base",name:"api_base",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"tpm",name:"tpm",tooltip:"int (optional) - Tokens limit for this deployment: in tokens per minute (tpm). Find this information on your model/providers website",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"rpm",name:"rpm",tooltip:"int (optional) - Rate limit for this deployment: in requests per minute (rpm). Find this information on your model/providers website",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"max_retries",name:"max_retries",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"timeout",name:"timeout",tooltip:"int (optional) - Timeout in seconds for LLM requests (Defaults to 600 seconds)",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"stream_timeout",name:"stream_timeout",tooltip:"int (optional) - Timeout for stream requests (seconds)",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"input_cost_per_token",name:"input_cost_per_token",tooltip:"float (optional) - Input cost per token",children:(0,a.jsx)(I.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"output_cost_per_token",name:"output_cost_per_token",tooltip:"float (optional) - Output cost per token",children:(0,a.jsx)(I.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"model_id",name:"model_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})},{visible:eT,onCancel:()=>{eE(!1),eR(null)},model:eM,onSubmit:lj}),(0,a.jsxs)(w.Z,{title:eM&&eM.model_name,visible:eO,width:800,footer:null,onCancel:()=>{eF(!1),eR(null)},children:[(0,a.jsx)(y.Z,{children:"Model Info"}),(0,a.jsx)(ek.Z,{language:"json",children:eM&&JSON.stringify(eM,null,2)})]})]}),(0,a.jsxs)(ea.Z,{className:"h-full",children:[(0,a.jsx)(ew,{level:2,children:"Add new model"}),(0,a.jsx)(M.Z,{children:(0,a.jsxs)(S.Z,{form:N,onFinish:()=>{N.validateFields().then(e=>{eC(e,o,N)}).catch(e=>{console.error("Validation failed:",e)})},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(B.Z,{value:Q.toString(),children:J.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>{l_(e),ey(e)},children:e},l))})}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Public Model Name",name:"model_name",tooltip:"Model name your users will pass in. Also used for load-balancing, LiteLLM will load balance between all models with this public name.",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"Vertex AI (Anthropic, Gemini, etc.)"===(t=Q.toString())?"gemini-pro":"Anthropic"==t?"claude-3-opus":"Amazon Bedrock"==t?"claude-3-opus":"Google AI Studio"==t?"gemini-pro":"gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(_.Z,{className:"mb-3 mt-1",children:"Model name your users will pass in."})})]}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"LiteLLM Model Name(s)",name:"model",tooltip:"Actual model name used for making litellm.completion() call.",className:"mb-0",children:"Azure"===Q?(0,a.jsx)(j.Z,{placeholder:"Enter model name"}):H.length>0?(0,a.jsx)(ei.Z,{value:H,children:H.map((e,l)=>(0,a.jsx)(eo.Z,{value:e,children:e},l))}):(0,a.jsx)(j.Z,{placeholder:"gpt-3.5-turbo-0125"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-3 mt-1",children:["Actual model name used for making"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/providers",target:"_blank",children:"litellm.completion() call"}),". We'll"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/proxy/reliability#step-1---set-deployments-on-config",target:"_blank",children:"loadbalance"})," ","models with the same 'public name'"]})})]}),void 0!==i&&i.fields.length>0&&(0,a.jsx)(eS,{fields:i.fields,selectedProvider:i.name}),"Amazon Bedrock"!=Q&&"Vertex AI (Anthropic, Gemini, etc.)"!=Q&&(void 0===i||0==i.fields.length)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Key",name:"api_key",children:(0,a.jsx)(j.Z,{placeholder:"sk-",type:"password"})}),"OpenAI"==Q&&(0,a.jsx)(S.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,a.jsx)(j.Z,{placeholder:"[OPTIONAL] my-unique-org"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Project",name:"vertex_project",children:(0,a.jsx)(j.Z,{placeholder:"adroit-cadet-1234.."})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Location",name:"vertex_location",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Credentials",name:"vertex_credentials",className:"mb-0",children:(0,a.jsx)(e_.Z,{name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;N.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?k.ZP.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&k.ZP.error("".concat(e.file.name," file upload failed."))},children:(0,a.jsx)(A.ZP,{icon:(0,a.jsx)(ef.Z,{}),children:"Click to Upload"})})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(_.Z,{className:"mb-3 mt-1",children:"Give litellm a gcp service account(.json file), so it can make the relevant calls"})})]}),("Azure"==Q||"OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)"==Q)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Base",name:"api_base",children:(0,a.jsx)(j.Z,{placeholder:"https://..."})}),"Azure"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Version",name:"api_version",children:(0,a.jsx)(j.Z,{placeholder:"2023-07-01-preview"})}),"Azure"==Q&&(0,a.jsxs)("div",{children:[(0,a.jsx)(S.Z.Item,{label:"Base Model",name:"base_model",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"azure/gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,a.jsx)(eN,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Access Key ID",name:"aws_access_key_id",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Secret Access Key",name:"aws_secret_access_key",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Region Name",name:"aws_region_name",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),(0,a.jsx)(S.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-0",children:(0,a.jsx)(ep.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-3 mt-1",children:["Pass JSON of litellm supported params"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]})]}),(0,a.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add Model"})}),(0,a.jsx)(em.Z,{title:"Get help on our github",children:(0,a.jsx)($.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})})]})})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(_.Z,{children:"`/health` will run a very small request through your models configured on litellm"}),(0,a.jsx)(p.Z,{onClick:ly,children:"Run `/health`"}),eb&&(0,a.jsx)("pre",{children:JSON.stringify(eb,null,2)})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:e3,className:"mr-2",onValueChange:e=>{e6(e),lb(eU,e.from,e.to)}})]}),(0,a.jsxs)(eu.Z,{className:"ml-2",children:[(0,a.jsx)(_.Z,{children:"Select Model Group"}),(0,a.jsx)(B.Z,{defaultValue:eU||eD[0],value:eU||eD[0],children:eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>lb(e,e3.from,e3.to),children:e},l))})]}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(ex.Z,{trigger:"click",content:lv,overlayStyle:{width:"20vw"},children:(0,a.jsx)(p.Z,{icon:eg.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>li(!0)})})})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Avg. Latency per Token"}),(0,a.jsx)(es.Z,{value:"2",children:"✨ Time to first token"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,a.jsx)(_.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),eB&&eW&&(0,a.jsx)(ed.Z,{title:"Model Latency",className:"h-72",data:eB,showLegend:!1,index:"date",categories:eW,connectNulls:!0,customTooltip:lS})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ev,{modelMetrics:eG,modelMetricsCategories:eY,customTooltip:lS,premiumUser:f})})]})]})})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Deployment"}),(0,a.jsx)(V.Z,{children:"Success Responses"}),(0,a.jsxs)(V.Z,{children:["Slow Responses ",(0,a.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,a.jsx)(L.Z,{children:e5.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.api_base}),(0,a.jsx)(U.Z,{children:e.total_count}),(0,a.jsx)(U.Z,{children:e.slow_count})]},l))})]})})})]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(y.Z,{children:["All Up Rate Limit Errors (429) for ",eU]}),(0,a.jsxs)(x.Z,{numItems:1,children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",ls.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:ls.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,a.jsx)(eu.Z,{})]})]}),f?(0,a.jsx)(a.Fragment,{children:ln.map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,a.jsx)(a.Fragment,{children:ln&&ln.length>0&&ln.slice(0,1).map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(_.Z,{children:"Filter by Public Model Name"}),(0,a.jsx)(B.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eU||eD[0],value:eU||eD[0],onValueChange:e=>eq(e),children:eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>eq(e),children:e},l))})]}),(0,a.jsxs)(y.Z,{children:["Retry Policy for ",eU]}),(0,a.jsx)(_.Z,{className:"mb-6",children:"How many retries should be attempted based on the Exception"}),eA&&(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Object.entries(eA).map((e,l)=>{var s;let[t,n]=e,r=null==e9?void 0:null===(s=e9[eU])||void 0===s?void 0:s[n];return null==r&&(r=le),(0,a.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("td",{children:(0,a.jsx)(_.Z,{children:t})}),(0,a.jsx)("td",{children:(0,a.jsx)(I.Z,{className:"ml-5",value:r,min:0,step:1,onChange:e=>{e7(l=>{var s;let t=null!==(s=null==l?void 0:l[eU])&&void 0!==s?s:{};return{...null!=l?l:{},[eU]:{...t,[n]:e}}})}})})]},l)})})}),(0,a.jsx)(p.Z,{className:"mt-6 mr-8",onClick:lZ,children:"Save"})]})]})]})})};let{Option:eT}=v.default;var eE=e=>{let{userID:l,accessToken:s,teams:t}=e,[n]=S.Z.useForm(),[i,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[m,h]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{let e=await (0,u.So)(s,l,"any"),t=[];for(let l=0;l{o(!1),n.resetFields()},g=()=>{o(!1),c(null),n.resetFields()},Z=async e=>{try{k.ZP.info("Making API Call"),o(!0),console.log("formValues in create user:",e);let t=await (0,u.Ov)(s,null,e);console.log("user create Response:",t),c(t.key),k.ZP.success("API user Created"),n.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the user:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-0",onClick:()=>o(!0),children:"+ Invite User"}),(0,a.jsxs)(w.Z,{title:"Invite User",visible:i,width:800,footer:null,onOk:x,onCancel:g,children:[(0,a.jsx)(_.Z,{className:"mb-1",children:"Invite a user to login to the Admin UI and create Keys"}),(0,a.jsx)(_.Z,{className:"mb-6",children:(0,a.jsx)("b",{children:"Note: SSO Setup Required for this"})}),(0,a.jsxs)(S.Z,{form:n,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(S.Z.Item,{label:"User Email",name:"user_email",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(v.default,{placeholder:"Select Team ID",style:{width:"100%"},children:t?t.map(e=>(0,a.jsx)(eT,{value:e.team_id,children:e.team_alias},e.team_id)):(0,a.jsx)(eT,{value:null,children:"Default Team"},"default")})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create User"})})]})]}),d&&(0,a.jsxs)(w.Z,{title:"User Created Successfully",visible:i,onOk:x,onCancel:g,footer:null,children:[(0,a.jsx)("p",{children:"User has been created to access your proxy. Please Ask them to Log In."}),(0,a.jsx)("br",{}),(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:"Note: This Feature is only supported through SSO on the Admin UI"})})]})]})},eO=e=>{let{visible:l,possibleUIRoles:s,onCancel:t,user:n,onSubmit:i}=e,[o,d]=(0,r.useState)(n),[c]=S.Z.useForm();(0,r.useEffect)(()=>{c.resetFields()},[n]);let m=async()=>{c.resetFields(),t()},u=async e=>{i(e),c.resetFields(),t()};return n?(0,a.jsx)(w.Z,{visible:l,onCancel:m,footer:null,title:"Edit User "+n.user_id,width:1e3,children:(0,a.jsx)(S.Z,{form:c,onFinish:u,initialValues:n,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"User Role",name:"user_role",children:(0,a.jsx)(v.default,{children:s&&Object.entries(s).map(e=>{let[l,{ui_label:s,description:t}]=e;return(0,a.jsx)(K.Z,{value:l,title:s,children:(0,a.jsxs)("div",{className:"flex",children:[s," ",(0,a.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:t})]})},l)})})}),(0,a.jsx)(S.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},eF=e=>{let{accessToken:l,token:s,keys:t,userRole:n,userID:i,teams:o,setKeys:d}=e,[c,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(0),[Z,f]=r.useState(null),[_,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),[N,I]=(0,r.useState)({}),A=async()=>{w(null),v(!1)},C=async e=>{if(console.log("inside handleEditSubmit:",e),l&&s&&n&&i){try{await (0,u.pf)(l,e,null),k.ZP.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}c&&m(c.map(l=>l.user_id===e.user_id?e:l)),w(null),v(!1)}};return((0,r.useEffect)(()=>{if(!l||!s||!n||!i)return;let e=async()=>{try{let e=await (0,u.Br)(l,null,n,!0,j,25);console.log("user data response:",e),m(e);let s=await (0,u.lg)(l);I(s)}catch(e){console.error("There was an error fetching the model data",e)}};l&&s&&n&&i&&e()},[l,s,n,i,j]),c&&l&&s&&n&&i)?(0,a.jsx)("div",{style:{width:"100%"},children:(0,a.jsxs)(x.Z,{className:"gap-2 p-2 h-[90vh] w-full mt-8",children:[(0,a.jsx)(eE,{userID:i,accessToken:l,teams:o}),(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[90vh] mb-4",children:[(0,a.jsx)("div",{className:"mb-4 mt-1"}),(0,a.jsx)(et.Z,{children:(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(D.Z,{className:"mt-5",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"User ID"}),(0,a.jsx)(V.Z,{children:"User Email"}),(0,a.jsx)(V.Z,{children:"Role"}),(0,a.jsx)(V.Z,{children:"User Spend ($ USD)"}),(0,a.jsx)(V.Z,{children:"User Max Budget ($ USD)"}),(0,a.jsx)(V.Z,{children:"API Keys"}),(0,a.jsx)(V.Z,{})]})}),(0,a.jsx)(L.Z,{children:c.map(e=>{var l,s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_id||"-"}),(0,a.jsx)(U.Z,{children:e.user_email||"-"}),(0,a.jsx)(U.Z,{children:(null==N?void 0:null===(l=N[null==e?void 0:e.user_role])||void 0===l?void 0:l.ui_label)||"-"}),(0,a.jsx)(U.Z,{children:e.spend?null===(s=e.spend)||void 0===s?void 0:s.toFixed(2):"-"}),(0,a.jsx)(U.Z,{children:e.max_budget?e.max_budget:"Unlimited"}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(x.Z,{numItems:2,children:e&&e.key_aliases&&e.key_aliases.filter(e=>null!==e).length>0?(0,a.jsxs)(F.Z,{size:"xs",color:"indigo",children:[e.key_aliases.filter(e=>null!==e).length,"\xa0Keys"]}):(0,a.jsx)(F.Z,{size:"xs",color:"gray",children:"No Keys"})})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:E.Z,onClick:()=>{w(e),v(!0)},children:"View Keys"})})]},e.user_id)})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("div",{className:"flex-1 flex justify-between items-center"})]})})]})}),(0,a.jsx)(eO,{visible:b,possibleUIRoles:N,onCancel:A,user:S,onSubmit:C})]}),function(){if(!c)return null;let e=Math.ceil(c.length/25);return(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)("div",{children:["Showing Page ",j+1," of ",e]}),(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none",disabled:0===j,onClick:()=>g(j-1),children:"← Prev"}),(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r focus:outline-none",onClick:()=>{g(j+1)},children:"Next →"})]})]})}()]})}):(0,a.jsx)("div",{children:"Loading..."})},eM=e=>{let{teams:l,searchParams:s,accessToken:t,setTeams:n,userID:i,userRole:o}=e,[d]=S.Z.useForm(),[c]=S.Z.useForm(),{Title:m,Paragraph:g}=$.default,[Z,f]=(0,r.useState)(""),[y,b]=(0,r.useState)(!1),[C,P]=(0,r.useState)(l?l[0]:null),[T,W]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[J,Y]=(0,r.useState)([]),[X,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)({}),en=e=>{P(e),b(!0)},ea=async e=>{let s=e.team_id;if(console.log("handleEditSubmit:",e),null==t)return;let a=await (0,u.Gh)(t,e);l&&n(l.map(e=>e.team_id===s?a.data:e)),k.ZP.success("Team updated successfully"),b(!1),P(null)},er=async e=>{el(e),Q(!0)},ei=async()=>{if(null!=ee&&null!=l&&null!=t){try{await (0,u.rs)(t,ee);let e=l.filter(e=>e.team_id!==ee);n(e)}catch(e){console.error("Error deleting the team:",e)}Q(!1),el(null)}};(0,r.useEffect)(()=>{let e=async()=>{try{if(null===i||null===o||null===t||null===l)return;console.log("fetching team info:");let e={};for(let s=0;s<(null==l?void 0:l.length);s++){let n=l[s].team_id,a=await (0,u.Xm)(t,n);console.log("teamInfo response:",a),null!==a&&(e={...e,[n]:a})}et(e)}catch(e){console.error("Error fetching team info:",e)}};(async()=>{try{if(null===i||null===o)return;if(null!==t){let e=(await (0,u.So)(t,i,o)).data.map(e=>e.id);console.log("available_model_names:",e),Y(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[t,i,o,l]);let eo=async e=>{try{if(null!=t){var s;let a=null==e?void 0:e.team_alias;if((null!==(s=null==l?void 0:l.map(e=>e.team_alias))&&void 0!==s?s:[]).includes(a))throw Error("Team alias ".concat(a," already exists, please pick another alias"));k.ZP.info("Creating Team");let r=await (0,u.hT)(t,e);null!==l?n([...l,r]):n([r]),console.log("response for team create call: ".concat(r)),k.ZP.success("Team created"),W(!1)}}catch(e){console.error("Error creating the team:",e),k.ZP.error("Error creating the team: "+e,20)}},ed=async e=>{try{if(null!=t&&null!=l){k.ZP.info("Adding Member");let s={role:"user",user_email:e.user_email,user_id:e.user_id},a=await (0,u.cu)(t,C.team_id,s);console.log("response for team create call: ".concat(a.data));let r=l.findIndex(e=>(console.log("team.team_id=".concat(e.team_id,"; response.data.team_id=").concat(a.data.team_id)),e.team_id===a.data.team_id));if(console.log("foundIndex: ".concat(r)),-1!==r){let e=[...l];e[r]=a.data,n(e),P(a.data)}G(!1)}}catch(e){console.error("Error creating the team:",e)}};return console.log("received teams ".concat(JSON.stringify(l))),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"All Teams"}),(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Team Name"}),(0,a.jsx)(V.Z,{children:"Spend (USD)"}),(0,a.jsx)(V.Z,{children:"Budget (USD)"}),(0,a.jsx)(V.Z,{children:"Models"}),(0,a.jsx)(V.Z,{children:"TPM / RPM Limits"}),(0,a.jsx)(V.Z,{children:"Info"})]})}),(0,a.jsx)(L.Z,{children:l&&l.length>0?l.map(e=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.spend}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.max_budget?e.max_budget:"No limit"}),(0,a.jsx)(U.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,a.jsxs)(_.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{}),"RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsxs)(_.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].keys&&es[e.team_id].keys.length," ","Keys"]}),(0,a.jsxs)(_.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].team_info&&es[e.team_id].team_info.members_with_roles&&es[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>en(e)}),(0,a.jsx)(R.Z,{onClick:()=>er(e.team_id),icon:O.Z,size:"sm"})]})]},e.team_id)):null})]}),X&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Team"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this team ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:ei,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{Q(!1),el(null)},children:"Cancel"})]})]})]})})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>W(!0),children:"+ Create New Team"}),(0,a.jsx)(w.Z,{title:"Create Team",visible:T,width:800,footer:null,onOk:()=>{W(!1),d.resetFields()},onCancel:()=>{W(!1),d.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:eo,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),J.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"Team Members"}),(0,a.jsx)(g,{children:"If you belong to multiple teams, this setting controls which teams members you see."}),l&&l.length>0?(0,a.jsx)(B.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{P(e)},children:e.team_alias},l))}):(0,a.jsxs)(g,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Member Name"}),(0,a.jsx)(V.Z,{children:"Role"})]})}),(0,a.jsx)(L.Z,{children:C?C.members_with_roles.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsx)(U.Z,{children:e.role})]},l)):null})]})}),C&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,team:t,onSubmit:n}=e,[r]=S.Z.useForm();return(0,a.jsx)(w.Z,{title:"Edit Team",visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n({...e,team_id:t.team_id}),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:ea,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),J&&J.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"team_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Edit Team"})})]})})},{visible:y,onCancel:()=>{b(!1),P(null)},team:C,onSubmit:ea})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-5",onClick:()=>G(!0),children:"+ Add member"}),(0,a.jsx)(w.Z,{title:"Add member",visible:H,width:800,footer:null,onOk:()=>{G(!1),c.resetFields()},onCancel:()=>{G(!1),c.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:ed,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,a.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,a.jsx)(S.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eR=e=>{let l,{searchParams:s,accessToken:t,showSSOBanner:n}=e,[o]=S.Z.useForm(),[d]=S.Z.useForm(),{Title:c,Paragraph:m}=$.default,[j,g]=(0,r.useState)(""),[Z,f]=(0,r.useState)(null),[y,v]=(0,r.useState)(null),[I,C]=(0,r.useState)(!1),[P,T]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[W,H]=(0,r.useState)(!1),[G,J]=(0,r.useState)(!1),[Y,X]=(0,r.useState)(!1),Q=(0,i.useRouter)(),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)("");try{l=window.location.origin}catch(e){l=""}l+="/fallback/login";let en=()=>{X(!1)},ea=["proxy_admin","proxy_admin_viewer"];(0,r.useEffect)(()=>{if(Q){let{protocol:e,host:l}=window.location;et("".concat(e,"//").concat(l))}},[Q]),(0,r.useEffect)(()=>{(async()=>{if(null!=t){let e=[],l=await (0,u.Xd)(t,"proxy_admin_viewer");l.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy viewers: ".concat(l));let s=await (0,u.Xd)(t,"proxy_admin");s.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy admins: ".concat(s)),console.log("combinedList: ".concat(e)),f(e),el(await (0,u.lg)(t))}})()},[t]);let er=()=>{H(!1),d.resetFields(),o.resetFields()},ei=()=>{F(!1),d.resetFields(),o.resetFields()},eo=()=>{F(!1),C(!1),d.resetFields(),o.resetFields()},ed=()=>{H(!1),d.resetFields(),o.resetFields()},ec=e=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-8 mt-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},className:"mt-4",children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add member"})})]}),em=(e,l,s)=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"User Role",name:"user_role",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(B.Z,{value:l,children:ea.map((e,l)=>(0,a.jsx)(K.Z,{value:e,children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"user_id",hidden:!0,initialValue:s,valuePropName:"user_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s,disabled:!0})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Update role"})})]}),eu=async e=>{try{if(null!=t&&null!=Z){k.ZP.info("Making API Call");let l=await (0,u.pf)(t,e,null);console.log("response for team create call: ".concat(l));let s=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(l.user_id)),e.user_id===l.user_id));console.log("foundIndex: ".concat(s)),-1==s&&(console.log("updates admin with new user"),Z.push(l),f(Z)),k.ZP.success("Refresh tab to see updated user role"),H(!1)}}catch(e){console.error("Error creating the key:",e)}},eh=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call");let s=await (0,u.pf)(t,e,"proxy_admin_viewer");console.log("response for team create call: ".concat(s));let n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)});let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(s.user_id)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),f(Z)),o.resetFields(),T(!1)}}catch(e){console.error("Error creating the key:",e)}},ex=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call"),e.user_email,e.user_id;let s=await (0,u.pf)(t,e,"proxy_admin"),n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)}),console.log("response for team create call: ".concat(s));let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(n)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),f(Z)),o.resetFields(),F(!1)}}catch(e){console.error("Error creating the key:",e)}},ep=async e=>{if(null==t)return;let l={environment_variables:{PROXY_BASE_URL:e.proxy_base_url,GOOGLE_CLIENT_ID:e.google_client_id,GOOGLE_CLIENT_SECRET:e.google_client_secret}};(0,u.K_)(t,l)};return console.log("admins: ".concat(null==Z?void 0:Z.length)),(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsx)(c,{level:4,children:"Admin Access "}),(0,a.jsxs)(m,{children:[n&&(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#restrict-ui-access",children:"Requires SSO Setup"}),(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin: "})," Can create keys, teams, users, add models, etc."," ",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin Viewer: "}),"Can just view spend. They cannot create keys, teams or grant users access to new models."," "]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-2 w-full",children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Member Name"}),(0,a.jsx)(V.Z,{children:"Role"})]})}),(0,a.jsx)(L.Z,{children:Z?Z.map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsxs)(U.Z,{children:[" ",(null==ee?void 0:null===(s=ee[null==e?void 0:e.user_role])||void 0===s?void 0:s.ui_label)||"-"]}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>H(!0)}),(0,a.jsx)(w.Z,{title:"Update role",visible:W,width:800,footer:null,onOk:er,onCancel:ed,children:em(eu,e.user_role,e.user_id)})]})]},l)}):null})]})})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("div",{className:"flex justify-start",children:[(0,a.jsx)(p.Z,{className:"mr-4 mb-5",onClick:()=>F(!0),children:"+ Add admin"}),(0,a.jsx)(w.Z,{title:"Add admin",visible:O,width:800,footer:null,onOk:ei,onCancel:eo,children:ec(ex)}),(0,a.jsxs)(w.Z,{title:"Invitation Link",visible:I,width:800,footer:null,onOk:ei,onCancel:eo,children:[(0,a.jsx)(m,{children:"Copy and send the generated link to onboard this user to the proxy."}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(_.Z,{className:"text-base",children:"User ID"}),(0,a.jsx)(_.Z,{children:null==y?void 0:y.user_id})]}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(_.Z,{children:"Invitation Link"}),(0,a.jsxs)(_.Z,{children:[es,"/ui/onboarding?id=",null==y?void 0:y.id]})]}),(0,a.jsxs)("div",{className:"flex justify-end mt-5",children:[(0,a.jsx)("div",{}),(0,a.jsx)(b.CopyToClipboard,{text:"".concat(es,"/ui/onboarding?id=").concat(null==y?void 0:y.id),onCopy:()=>k.ZP.success("Copied!"),children:(0,a.jsx)(p.Z,{variant:"primary",children:"Copy invitation link"})})]})]}),(0,a.jsx)(p.Z,{className:"mb-5",onClick:()=>T(!0),children:"+ Add viewer"}),(0,a.jsx)(w.Z,{title:"Add viewer",visible:P,width:800,footer:null,onOk:()=>{T(!1),d.resetFields(),o.resetFields()},onCancel:()=>{T(!1),d.resetFields(),o.resetFields()},children:ec(eh)})]})})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(c,{level:4,children:"Add SSO"}),(0,a.jsxs)("div",{className:"flex justify-start mb-4",children:[(0,a.jsx)(p.Z,{onClick:()=>J(!0),children:"Add SSO"}),(0,a.jsx)(w.Z,{title:"Add SSO",visible:G,width:800,footer:null,onOk:()=>{J(!1),o.resetFields()},onCancel:()=>{J(!1),o.resetFields()},children:(0,a.jsxs)(S.Z,{form:o,onFinish:e=>{ex(e),ep(e),J(!1),X(!0)},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"PROXY BASE URL",name:"proxy_base_url",rules:[{required:!0,message:"Please enter the proxy base url"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT ID",name:"google_client_id",rules:[{required:!0,message:"Please enter the google client id"}],children:(0,a.jsx)(N.Z.Password,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT SECRET",name:"google_client_secret",rules:[{required:!0,message:"Please enter the google client secret"}],children:(0,a.jsx)(N.Z.Password,{})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})}),(0,a.jsxs)(w.Z,{title:"SSO Setup Instructions",visible:Y,width:800,footer:null,onOk:en,onCancel:()=>{X(!1)},children:[(0,a.jsx)("p",{children:"Follow these steps to complete the SSO setup:"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"1. DO NOT Exit this TAB"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"2. Open a new tab, visit your proxy base url"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"3. Confirm your SSO is configured correctly and you can login on the new Tab"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"4. If Step 3 is successful, you can close this tab"}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{onClick:en,children:"Done"})})]})]}),(0,a.jsxs)(ey.Z,{title:"Login without SSO",color:"teal",children:["If you need to login without sso, you can access"," ",(0,a.jsxs)("a",{href:l,target:"_blank",children:[(0,a.jsx)("b",{children:l})," "]})]})]})]})},eD=s(42556),eL=s(90252),eU=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:t,handleSubmit:n,premiumUser:r}=e,[i]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:i,onFinish:()=>{let e=i.getFieldsValue();Object.values(e).some(e=>""===e||null==e)?console.log("Some form fields are empty."):n(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{align:"center",children:[(0,a.jsx)(_.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),e.premium_field?r?(0,a.jsx)(S.Z.Item,{name:e.field_name,children:(0,a.jsx)(U.Z,{children:"Integer"===e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(U.Z,{children:(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})})}):(0,a.jsx)(S.Z.Item,{name:e.field_name,className:"mb-0",children:(0,a.jsx)(U.Z,{children:"Integer"===e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(U.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eL.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:O.Z,color:"red",onClick:()=>t(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Update Settings"})})]})},eq=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,r.useState)([]);return console.log("INSIDE ALERTING SETTINGS"),(0,r.useEffect)(()=>{l&&(0,u.RQ)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(eU,{alertingSettings:t,handleInputChange:(e,l)=>{n(t.map(s=>s.field_name===e?{...s,field_value:l}:s))},handleResetField:(e,s)=>{if(l)try{let l=t.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:l.field_default_value}:l);console.log("INSIDE HANDLE RESET FIELD"),n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||null==e||void 0==e)return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let n={...e,...s};try{(0,u.jA)(l,"alerting_args",n),k.ZP.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})},eV=s(84406);let{Title:ez,Paragraph:eB}=$.default;var eK=e=>{let{accessToken:l,userRole:s,userID:t,premiumUser:n}=e,[i,o]=(0,r.useState)([]),[d,c]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[g]=S.Z.useForm(),[Z,f]=(0,r.useState)(null),[y,b]=(0,r.useState)([]),[N,I]=(0,r.useState)(""),[C,P]=(0,r.useState)({}),[T,O]=(0,r.useState)([]),[F,B]=(0,r.useState)(!1),[W,H]=(0,r.useState)([]),[G,J]=(0,r.useState)(null),[Y,X]=(0,r.useState)([]),[$,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),ei=e=>{T.includes(e)?O(T.filter(l=>l!==e)):O([...T,e])},eo={llm_exceptions:"LLM Exceptions",llm_too_slow:"LLM Responses Too Slow",llm_requests_hanging:"LLM Requests Hanging",budget_alerts:"Budget Alerts (API Keys, Users)",db_exceptions:"Database Exceptions (Read/Write)",daily_reports:"Weekly/Monthly Spend Reports",outage_alerts:"Outage Alerts",region_outage_alerts:"Region Outage Alerts"};(0,r.useEffect)(()=>{l&&s&&t&&(0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.callbacks),H(e.available_callbacks);let l=e.alerts;if(console.log("alerts_data",l),l&&l.length>0){let e=l[0];console.log("_alert_info",e);let s=e.variables.SLACK_WEBHOOK_URL;console.log("catch_all_webhook",s),O(e.active_alerts),I(s),P(e.alerts_to_webhook)}c(l)})},[l,s,t]);let ed=e=>T&&T.includes(e),ec=()=>{if(!l)return;let e={};d.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));n&&n.value&&(e[s]=null==n?void 0:n.value)})}),console.log("updatedVariables",e);try{(0,u.K_)(l,{general_settings:{alerting:["email"]},environment_variables:e})}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Email settings updated successfully")},em=async e=>{if(!l)return;let s={};Object.entries(e).forEach(e=>{let[l,t]=e;"callback"!==l&&(s[l]=t)});try{await (0,u.K_)(l,{environment_variables:s}),k.ZP.success("Callback added successfully"),h(!1),g.resetFields(),f(null)}catch(e){k.ZP.error("Failed to add callback: "+e,20)}},eu=async e=>{if(!l)return;let s=null==e?void 0:e.callback,t={};Object.entries(e).forEach(e=>{let[l,s]=e;"callback"!==l&&(t[l]=s)});try{await (0,u.K_)(l,{environment_variables:t,litellm_settings:{success_callback:[s]}}),k.ZP.success("Callback ".concat(s," added successfully")),h(!1),g.resetFields(),f(null)}catch(e){k.ZP.error("Failed to add callback: "+e,20)}},eh=e=>{console.log("inside handleSelectedCallbackChange",e),f(e.litellm_callback_name),console.log("all callbacks",W),e&&e.litellm_callback_params?(X(e.litellm_callback_params),console.log("selectedCallbackParams",Y)):X([])};return l?(console.log("callbacks: ".concat(i)),(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(es.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(es.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(es.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)(ez,{level:4,children:"Active Logging Callbacks"}),(0,a.jsx)(x.Z,{numItems:2,children:(0,a.jsx)(M.Z,{className:"max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsx)(z.Z,{children:(0,a.jsx)(V.Z,{children:"Callback Name"})})}),(0,a.jsx)(L.Z,{children:i.map((e,s)=>(0,a.jsxs)(z.Z,{className:"flex justify-between",children:[(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:e.name})}),(0,a.jsx)(U.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"flex justify-between",children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>{el(e),Q(!0)}}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,e.name),className:"ml-2",variant:"secondary",children:"Test Callback"})]})})]},s))})]})})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>B(!0),children:"Add Callback"})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(_.Z,{className:"my-2",children:["Alerts are only supported for Slack Webhook URLs. Get your webhook urls from"," ",(0,a.jsx)("a",{href:"https://api.slack.com/messaging/webhooks",target:"_blank",style:{color:"blue"},children:"here"})]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{}),(0,a.jsx)(V.Z,{}),(0,a.jsx)(V.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(eo).map((e,l)=>{let[s,t]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:"region_outage_alerts"==s?n?(0,a.jsx)(eD.Z,{id:"switch",name:"switch",checked:ed(s),onChange:()=>ei(s)}):(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})}):(0,a.jsx)(eD.Z,{id:"switch",name:"switch",checked:ed(s),onChange:()=>ei(s)})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:t})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(j.Z,{name:s,type:"password",defaultValue:C&&C[s]?C[s]:N})})]},l)})})]}),(0,a.jsx)(p.Z,{size:"xs",className:"mt-2",onClick:()=>{if(!l)return;let e={};Object.entries(eo).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));console.log("key",s),console.log("webhookInput",n);let a=(null==n?void 0:n.value)||"";console.log("newWebhookValue",a),e[s]=a}),console.log("updatedAlertToWebhooks",e);let s={general_settings:{alert_to_webhook_url:e,alert_types:T}};console.log("payload",s);try{(0,u.K_)(l,s)}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Alerts updated successfully")},children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"slack"),className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(eq,{accessToken:l,premiumUser:n})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(ez,{level:4,children:"Email Settings"}),(0,a.jsxs)(_.Z,{children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: email alerts"})," ",(0,a.jsx)("br",{})]}),(0,a.jsx)("div",{className:"flex w-full",children:d.filter(e=>"email"===e.name).map((e,l)=>{var s;return(0,a.jsx)(U.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(x.Z,{numItems:2,children:Object.entries(null!==(s=e.variables)&&void 0!==s?s:{}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=n&&("EMAIL_LOGO_URL"===l||"EMAIL_SUPPORT_CONTACT"===l)?(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:(0,a.jsxs)(_.Z,{className:"mt-2",children:[" ","✨ ",l]})}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mt-2",children:l}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",style:{width:"400px"}})]}),(0,a.jsxs)("p",{style:{fontSize:"small",fontStyle:"italic"},children:["SMTP_HOST"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP host address, e.g. `smtp.resend.com`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PORT"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP port number, e.g. `587`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_USERNAME"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP username, e.g. `username`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PASSWORD"===l&&(0,a.jsx)("span",{style:{color:"red"},children:" Required * "}),"SMTP_SENDER_EMAIL"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the sender email address, e.g. `sender@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"TEST_EMAIL_ADDRESS"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Email Address to send `Test Email Alert` to. example: `info@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"EMAIL_LOGO_URL"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the Logo that appears in the email, pass a url to your logo"}),"EMAIL_SUPPORT_CONTACT"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the support email address that appears in the email. Default is support@berri.ai"})]})]},l)})})})},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>ec(),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"email"),className:"mx-2",children:"Test Email Alerts"})]})})]})]})}),(0,a.jsxs)(w.Z,{title:"Add Logging Callback",visible:F,width:800,onCancel:()=>B(!1),footer:null,children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/logging",className:"mb-8 mt-4",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: Logging"}),(0,a.jsx)(S.Z,{form:g,onFinish:eu,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eV.Z,{label:"Callback",name:"callback",rules:[{required:!0,message:"Please select a callback"}],children:(0,a.jsx)(v.default,{onChange:e=>{let l=W[e];l&&(console.log(l.ui_callback_name),eh(l))},children:W&&Object.values(W).map(e=>(0,a.jsx)(K.Z,{value:e.litellm_callback_name,children:e.ui_callback_name},e.litellm_callback_name))})}),Y&&Y.map(e=>(0,a.jsx)(eV.Z,{label:e,name:e,rules:[{required:!0,message:"Please enter the value for "+e}],children:(0,a.jsx)(j.Z,{type:"password"})},e)),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})]}),(0,a.jsx)(w.Z,{visible:$,width:800,title:"Edit ".concat(null==ee?void 0:ee.name," Settings"),onCancel:()=>Q(!1),footer:null,children:(0,a.jsxs)(S.Z,{form:g,onFinish:em,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:ee&&ee.variables&&Object.entries(ee.variables).map(e=>{let[l,s]=e;return(0,a.jsx)(eV.Z,{label:l,name:l,children:(0,a.jsx)(j.Z,{type:"password",defaultValue:s})},l)})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})]})):null};let{Option:eW}=v.default;var eH=e=>{let{models:l,accessToken:s,routerSettings:t,setRouterSettings:n}=e,[i]=S.Z.useForm(),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)("");return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>d(!0),children:"+ Add Fallbacks"}),(0,a.jsx)(w.Z,{title:"Add Fallbacks",visible:o,width:800,footer:null,onOk:()=>{d(!1),i.resetFields()},onCancel:()=>{d(!1),i.resetFields()},children:(0,a.jsxs)(S.Z,{form:i,onFinish:e=>{console.log(e);let{model_name:l,models:a}=e,r=[...t.fallbacks||[],{[l]:a}],o={...t,fallbacks:r};console.log(o);try{(0,u.K_)(s,{router_settings:o}),n(o)}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully"),d(!1),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Public Model Name",name:"model_name",rules:[{required:!0,message:"Set the model to fallback for"}],help:"required",children:(0,a.jsx)(B.Z,{defaultValue:c,children:l&&l.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>m(e),children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Fallback Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsx)(ei.Z,{value:l,children:l&&l.filter(e=>e!=c).map(e=>(0,a.jsx)(eo.Z,{value:e,children:e},e))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add Fallbacks"})})]})})]})},eG=s(12968);async function eJ(e,l){console.log("isLocal:",!1);let s=window.location.origin,t=new eG.ZP.OpenAI({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0});try{let l=await t.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});k.ZP.success((0,a.jsxs)("span",{children:["Test model=",(0,a.jsx)("strong",{children:e}),", received model=",(0,a.jsx)("strong",{children:l.model}),". See"," ",(0,a.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}let eY={ttl:3600,lowest_latency_buffer:0},eX=e=>{let{selectedStrategy:l,strategyArgs:s,paramExplanation:t}=e;return(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(f.Z,{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Routing Strategy Specific Args"}),(0,a.jsx)(Z.Z,{children:"latency-based-routing"==l?(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(s).map(e=>{let[l,s]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:t[l]})]}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]})}):(0,a.jsx)(_.Z,{children:"No specific settings"})})]})};var e$=e=>{let{accessToken:l,userRole:s,userID:t,modelData:n}=e,[i,o]=(0,r.useState)({}),[d,c]=(0,r.useState)({}),[m,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)(!1),[b]=S.Z.useForm(),[v,w]=(0,r.useState)(null),[N,A]=(0,r.useState)(null),[C,P]=(0,r.useState)(null),T={routing_strategy_args:"(dict) Arguments to pass to the routing strategy",routing_strategy:"(string) Routing strategy to use",allowed_fails:"(int) Number of times a deployment can fail before being added to cooldown",cooldown_time:"(int) time in seconds to cooldown a deployment after failure",num_retries:"(int) Number of retries for failed requests. Defaults to 0.",timeout:"(float) Timeout for requests. Defaults to None.",retry_after:"(int) Minimum time to wait before retrying a failed request",ttl:"(int) Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"(float) Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};(0,r.useEffect)(()=>{l&&s&&t&&((0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.router_settings)}),(0,u.YU)(l).then(e=>{g(e)}))},[l,s,t]);let E=async e=>{if(l){console.log("received key: ".concat(e)),console.log("routerSettings['fallbacks']: ".concat(i.fallbacks)),i.fallbacks.map(l=>(e in l&&delete l[e],l));try{await (0,u.K_)(l,{router_settings:i}),o({...i}),A(i.routing_strategy),k.ZP.success("Router settings updated successfully")}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}}},W=(e,l)=>{g(m.map(s=>s.field_name===e?{...s,field_value:l}:s))},H=(e,s)=>{if(!l)return;let t=m[s].field_value;if(null!=t&&void 0!=t)try{(0,u.jA)(l,e,t);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:!0}:l);g(s)}catch(e){}},G=(e,s)=>{if(l)try{(0,u.ao)(l,e);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:null}:l);g(s)}catch(e){}},J=e=>{if(!l)return;console.log("router_settings",e);let s=Object.fromEntries(Object.entries(e).map(e=>{let[l,s]=e;if("routing_strategy_args"!==l&&"routing_strategy"!==l){var t;return[l,(null===(t=document.querySelector('input[name="'.concat(l,'"]')))||void 0===t?void 0:t.value)||s]}if("routing_strategy"==l)return[l,N];if("routing_strategy_args"==l&&"latency-based-routing"==N){let e={},l=document.querySelector('input[name="lowest_latency_buffer"]'),s=document.querySelector('input[name="ttl"]');return(null==l?void 0:l.value)&&(e.lowest_latency_buffer=Number(l.value)),(null==s?void 0:s.value)&&(e.ttl=Number(s.value)),console.log("setRoutingStrategyArgs: ".concat(e)),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,u.K_)(l,{router_settings:s})}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully")};return l?(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Loadbalancing"}),(0,a.jsx)(es.Z,{value:"2",children:"Fallbacks"}),(0,a.jsx)(es.Z,{value:"3",children:"General"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(y.Z,{children:"Router Settings"}),(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(i).filter(e=>{let[l,s]=e;return"fallbacks"!=l&&"context_window_fallbacks"!=l&&"routing_strategy_args"!=l}).map(e=>{let[l,s]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:T[l]})]}),(0,a.jsx)(U.Z,{children:"routing_strategy"==l?(0,a.jsxs)(B.Z,{defaultValue:s,className:"w-full max-w-md",onValueChange:A,children:[(0,a.jsx)(K.Z,{value:"usage-based-routing",children:"usage-based-routing"}),(0,a.jsx)(K.Z,{value:"latency-based-routing",children:"latency-based-routing"}),(0,a.jsx)(K.Z,{value:"simple-shuffle",children:"simple-shuffle"})]}):(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]}),(0,a.jsx)(eX,{selectedStrategy:N,strategyArgs:i&&i.routing_strategy_args&&Object.keys(i.routing_strategy_args).length>0?i.routing_strategy_args:eY,paramExplanation:T})]}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>J(i),children:"Save Changes"})})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Model Name"}),(0,a.jsx)(V.Z,{children:"Fallbacks"})]})}),(0,a.jsx)(L.Z,{children:i.fallbacks&&i.fallbacks.map((e,s)=>Object.entries(e).map(e=>{let[t,n]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:t}),(0,a.jsx)(U.Z,{children:Array.isArray(n)?n.join(", "):n}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(p.Z,{onClick:()=>eJ(t,l),children:"Test Fallback"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:O.Z,size:"sm",onClick:()=>E(t)})})]},s.toString()+t)}))})]}),(0,a.jsx)(eH,{models:(null==n?void 0:n.data)?n.data.map(e=>e.model_name):[],accessToken:l,routerSettings:i,setRouterSettings:o})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"}),(0,a.jsx)(V.Z,{children:"Status"}),(0,a.jsx)(V.Z,{children:"Action"})]})}),(0,a.jsx)(L.Z,{children:m.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),(0,a.jsx)(U.Z,{children:"Integer"==e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>W(e.field_name,l)}):null}),(0,a.jsx)(U.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eL.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(p.Z,{onClick:()=>H(e.field_name,l),children:"Update"}),(0,a.jsx)(R.Z,{icon:O.Z,color:"red",onClick:()=>G(e.field_name,l),children:"Reset"})]})]},l))})]})})})]})]})}):null},eQ=e=>{let{isModalVisible:l,accessToken:s,setIsModalVisible:t,setBudgetList:n}=e,[r]=S.Z.useForm(),i=async e=>{if(null!=s&&void 0!=s)try{k.ZP.info("Making API Call");let l=await (0,u.Zr)(s,e);console.log("key create Response:",l),n(e=>e?[...e,l]:[l]),k.ZP.success("API Key Created"),r.resetFields()}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,a.jsx)(w.Z,{title:"Create Budget",visible:l,width:800,footer:null,onOk:()=>{t(!1),r.resetFields()},onCancel:()=>{t(!1),r.resetFields()},children:(0,a.jsxs)(S.Z,{form:r,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,a.jsx)(I.Z,{step:1,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,a.jsx)(I.Z,{step:1,precision:2,width:200})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(f.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},e0=e=>{let{accessToken:l}=e,[s,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&(0,u.O3)(l).then(e=>{i(e)})},[l]);let o=async(e,s)=>{if(null==l)return;k.ZP.info("Request made"),await (0,u.NV)(l,e);let t=[...n];t.splice(s,1),i(t),k.ZP.success("Budget Deleted.")};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsx)(p.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>t(!0),children:"+ Create Budget"}),(0,a.jsx)(eQ,{accessToken:l,isModalVisible:s,setIsModalVisible:t,setBudgetList:i}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(_.Z,{children:"Create a budget to assign to customers."}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Budget ID"}),(0,a.jsx)(V.Z,{children:"Max Budget"}),(0,a.jsx)(V.Z,{children:"TPM"}),(0,a.jsx)(V.Z,{children:"RPM"})]})}),(0,a.jsx)(L.Z,{children:n.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.budget_id}),(0,a.jsx)(U.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,a.jsx)(U.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,a.jsx)(U.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,a.jsx)(R.Z,{icon:O.Z,size:"sm",onClick:()=>o(e.budget_id,l)})]},l))})]})]}),(0,a.jsxs)("div",{className:"mt-5",children:[(0,a.jsx)(_.Z,{className:"text-base",children:"How to use budget id"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"Assign Budget to Customer"}),(0,a.jsx)(es.Z,{children:"Test it (Curl)"}),(0,a.jsx)(es.Z,{children:"Test it (OpenAI SDK)"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="{let{}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,a.jsx)(_.Z,{className:"mt-2 mb-2",children:"LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below "}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"OpenAI Python SDK"}),(0,a.jsx)(es.Z,{children:"LlamaIndex"}),(0,a.jsx)(es.Z,{children:"Langchain Py"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n '})})]})]})]})})})};async function e4(e,l,s,t){console.log("isLocal:",!1);let n=window.location.origin,a=new eG.ZP.OpenAI({apiKey:t,baseURL:n,dangerouslyAllowBrowser:!0});try{for await(let t of(await a.chat.completions.create({model:s,stream:!0,messages:[{role:"user",content:e}]})))console.log(t),t.choices[0].delta.content&&l(t.choices[0].delta.content)}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}var e5=e=>{let{accessToken:l,token:s,userRole:t,userID:n}=e,[i,o]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)(void 0),[y,b]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{let e=await (0,u.So)(l,n,t);if(console.log("model_info:",e),(null==e?void 0:e.data.length)>0){let l=e.data.map(e=>({value:e.id,label:e.id}));console.log(l),b(l),f(e.data[0].id)}}catch(e){console.error("Error fetching model info:",e)}})()},[l,n,t]);let S=(e,l)=>{g(s=>{let t=s[s.length-1];return t&&t.role===e?[...s.slice(0,s.length-1),{role:e,content:t.content+l}]:[...s,{role:e,content:l}]})},k=async()=>{if(""!==d.trim()&&i&&s&&t&&n){g(e=>[...e,{role:"user",content:d}]);try{Z&&await e4(d,e=>S("assistant",e),Z,i)}catch(e){console.error("Error fetching model response",e),S("assistant","Error fetching model response")}c("")}};if(t&&"Admin Viewer"==t){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to test models"})]})}return(0,a.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsx)(M.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsx)(en.Z,{children:(0,a.jsx)(es.Z,{children:"Chat"})}),(0,a.jsx)(er.Z,{children:(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("div",{className:"sm:max-w-2xl",children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"API Key"}),(0,a.jsx)(j.Z,{placeholder:"Type API Key here",type:"password",onValueChange:o,value:i})]}),(0,a.jsxs)(h.Z,{className:"mx-2",children:[(0,a.jsx)(_.Z,{children:"Select Model:"}),(0,a.jsx)(v.default,{placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),f(e)},options:y,style:{width:"200px"}})]})]})}),(0,a.jsxs)(D.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,a.jsx)(q.Z,{children:(0,a.jsx)(z.Z,{children:(0,a.jsx)(U.Z,{})})}),(0,a.jsx)(L.Z,{children:m.map((e,l)=>(0,a.jsx)(z.Z,{children:(0,a.jsx)(U.Z,{children:"".concat(e.role,": ").concat(e.content)})},l))})]}),(0,a.jsx)("div",{className:"mt-3",style:{position:"absolute",bottom:5,width:"95%"},children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(j.Z,{type:"text",value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&k()},placeholder:"Type your message..."}),(0,a.jsx)(p.Z,{onClick:k,className:"ml-2",children:"Send"})]})})]})})]})})})})},e8=s(33509),e3=s(95781);let{Sider:e6}=e8.default;var e9=e=>{let{setPage:l,userRole:s,defaultSelectedKey:t}=e;return"Admin Viewer"==s?(0,a.jsx)(e8.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,a.jsx)(e6,{width:120,children:(0,a.jsx)(e3.Z,{mode:"inline",defaultSelectedKeys:t||["4"],style:{height:"100%",borderRight:0},children:(0,a.jsx)(e3.Z.Item,{onClick:()=>l("usage"),children:"Usage"},"1")})})}):(0,a.jsx)(e8.default,{style:{minHeight:"100vh",maxWidth:"145px"},children:(0,a.jsx)(e6,{width:145,children:(0,a.jsxs)(e3.Z,{mode:"inline",defaultSelectedKeys:t||["1"],style:{height:"100%",borderRight:0},children:[(0,a.jsx)(e3.Z.Item,{onClick:()=>l("api-keys"),children:(0,a.jsx)(_.Z,{children:"API Keys"})},"1"),(0,a.jsx)(e3.Z.Item,{onClick:()=>l("llm-playground"),children:(0,a.jsx)(_.Z,{children:"Test Key"})},"3"),"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("models"),children:(0,a.jsx)(_.Z,{children:"Models"})},"2"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("usage"),children:(0,a.jsx)(_.Z,{children:"Usage"})},"4"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("teams"),children:(0,a.jsx)(_.Z,{children:"Teams"})},"6"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("users"),children:(0,a.jsx)(_.Z,{children:"Internal Users"})},"5"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("settings"),children:(0,a.jsx)(_.Z,{children:"Logging & Alerts"})},"8"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("budgets"),children:(0,a.jsx)(_.Z,{children:"Budgets"})},"9"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("general-settings"),children:(0,a.jsx)(_.Z,{children:"Router Settings"})},"10"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("admin-panel"),children:(0,a.jsx)(_.Z,{children:"Admin"})},"11"):null,(0,a.jsx)(e3.Z.Item,{onClick:()=>l("api_ref"),children:(0,a.jsx)(_.Z,{children:"API Reference"})},"12"),(0,a.jsx)(e3.Z.Item,{onClick:()=>l("model-hub"),children:(0,a.jsx)(_.Z,{children:"Model Hub"})},"14")]})})})},e7=s(67989),le=s(52703),ll=e=>{let{accessToken:l,token:s,userRole:t,userID:n,keys:i,premiumUser:o}=e,d=new Date,[c,m]=(0,r.useState)([]),[j,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)([]),[b,v]=(0,r.useState)([]),[S,k]=(0,r.useState)([]),[w,N]=(0,r.useState)([]),[I,A]=(0,r.useState)([]),[C,P]=(0,r.useState)([]),[T,E]=(0,r.useState)([]),[O,F]=(0,r.useState)([]),[R,W]=(0,r.useState)({}),[H,J]=(0,r.useState)([]),[Y,X]=(0,r.useState)(""),[$,Q]=(0,r.useState)(["all-tags"]),[em,eu]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),eh=new Date(d.getFullYear(),d.getMonth(),1),ex=new Date(d.getFullYear(),d.getMonth()+1,0),ep=e_(eh),ej=e_(ex);function eg(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",i),console.log("premium user in usage",o),(0,r.useEffect)(()=>{ef(em.from,em.to)},[em,$]);let eZ=async(e,s,t)=>{if(!e||!s||!l)return;s.setHours(23,59,59,999),e.setHours(0,0,0,0),console.log("uiSelectedKey",t);let n=await (0,u.b1)(l,t,e.toISOString(),s.toISOString());console.log("End user data updated successfully",n),v(n)},ef=async(e,s)=>{e&&s&&l&&(s.setHours(23,59,59,999),e.setHours(0,0,0,0),N((await (0,u.J$)(l,e.toISOString(),s.toISOString(),0===$.length?void 0:$)).spend_per_tag),console.log("Tag spend data updated successfully"))};function e_(e){let l=e.getFullYear(),s=e.getMonth()+1,t=e.getDate();return"".concat(l,"-").concat(s<10?"0"+s:s,"-").concat(t<10?"0"+t:t)}return console.log("Start date is ".concat(ep)),console.log("End date is ".concat(ej)),(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{if(console.log("user role: ".concat(t)),"Admin"==t||"Admin Viewer"==t){var e,a;let t=await (0,u.FC)(l);m(t);let n=await (0,u.OU)(l,s,ep,ej);console.log("provider_spend",n),F(n);let r=(await (0,u.tN)(l)).map(e=>({key:(e.key_alias||e.key_name||e.api_key).substring(0,10),spend:e.total_spend}));g(r);let i=(await (0,u.Au)(l)).map(e=>({key:e.model,spend:e.total_spend}));f(i);let o=await (0,u.mR)(l);console.log("teamSpend",o),k(o.daily_spend),P(o.teams);let d=o.total_spend_per_team;d=d.map(e=>(e.name=e.team_id||"",e.value=e.total_spend||0,e.value=e.value.toFixed(2),e)),E(d);let c=await (0,u.X)(l);A(c.tag_names);let h=await (0,u.J$)(l,null===(e=em.from)||void 0===e?void 0:e.toISOString(),null===(a=em.to)||void 0===a?void 0:a.toISOString(),void 0);N(h.spend_per_tag);let x=await (0,u.b1)(l,null,void 0,void 0);v(x),console.log("spend/user result",x);let p=await (0,u.wd)(l,ep,ej);W(p);let j=await (0,u.xA)(l,ep,ej);console.log("global activity per model",j),J(j)}else"App Owner"==t&&await (0,u.HK)(l,s,t,n,ep,ej).then(async e=>{if(console.log("result from spend logs call",e),"daily_spend"in e){let l=e.daily_spend;console.log("daily spend",l),m(l);let s=e.top_api_keys;g(s)}else{let s=(await (0,u.e2)(l,function(e){let l=[];e.forEach(e=>{Object.entries(e).forEach(e=>{let[s,t]=e;"spend"!==s&&"startTime"!==s&&"models"!==s&&"users"!==s&&l.push({key:s,spend:t})})}),l.sort((e,l)=>Number(l.spend)-Number(e.spend));let s=l.slice(0,5).map(e=>e.key);return console.log("topKeys: ".concat(Object.keys(s[0]))),s}(e))).info.map(e=>({key:(e.key_name||e.key_alias).substring(0,10),spend:e.spend}));g(s),m(e)}})}catch(e){console.error("There was an error fetching the data",e)}})()},[l,s,t,n,ep,ej]),(0,a.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{className:"mt-2",children:[(0,a.jsx)(es.Z,{children:"All Up"}),(0,a.jsx)(es.Z,{children:"Team Based Usage"}),(0,a.jsx)(es.Z,{children:"Customer Usage"}),(0,a.jsx)(es.Z,{children:"Tag Based Usage"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(es.Z,{children:"Cost"}),(0,a.jsx)(es.Z,{children:"Activity"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,a.jsx)(G,{userID:n,userRole:t,accessToken:l,userSpend:null,selectedTeam:null}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Monthly Spend"}),(0,a.jsx)(ec.Z,{data:c,index:"date",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Top API Keys"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:j,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:80,tickGap:5,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Top Models"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:Z,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"✨ Spend by Provider"}),o?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(le.Z,{className:"mt-4 h-40",variant:"pie",data:O,index:"provider",category:"spend"})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Provider"}),(0,a.jsx)(V.Z,{children:"Spend"})]})}),(0,a.jsx)(L.Z,{children:O.map(e=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.provider}),(0,a.jsx)(U.Z,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":e.spend.toFixed(2)})]},e.provider))})]})})]})}):(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})]})]})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"All Up"}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(R.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:R.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(R.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:R.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),o?(0,a.jsx)(a.Fragment,{children:H.map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:eg,onValueChange:e=>console.log(e)})]})]})]},l))}):(0,a.jsx)(a.Fragment,{children:H&&H.length>0&&H.slice(0,1).map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Activity by Model"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see analytics for all models"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],valueFormatter:eg,categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]})]},l))})]})})]})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(h.Z,{numColSpan:2,children:[(0,a.jsxs)(M.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"Total Spend Per Team"}),(0,a.jsx)(e7.Z,{data:T})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Daily Spend Per Team"}),(0,a.jsx)(ec.Z,{className:"h-72",data:S,showLegend:!0,index:"date",categories:C,yAxisWidth:80,colors:["blue","green","yellow","red","purple"],stack:!0})]})]}),(0,a.jsx)(h.Z,{numColSpan:2})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:em,onValueChange:e=>{eu(e),eZ(e.from,e.to,null)}})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Key"}),(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{eZ(em.from,em.to,null)},children:"All Keys"},"all-keys"),null==i?void 0:i.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{eZ(em.from,em.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,a.jsx)(M.Z,{className:"mt-4",children:(0,a.jsxs)(D.Z,{className:"max-h-[70vh] min-h-[500px]",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Customer"}),(0,a.jsx)(V.Z,{children:"Spend"}),(0,a.jsx)(V.Z,{children:"Total Events"})]})}),(0,a.jsx)(L.Z,{children:null==b?void 0:b.map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.end_user}),(0,a.jsx)(U.Z,{children:null===(s=e.total_spend)||void 0===s?void 0:s.toFixed(4)}),(0,a.jsx)(U.Z,{children:e.total_count})]},l)})})]})})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(el.Z,{className:"mb-4",enableSelect:!0,value:em,onValueChange:e=>{eu(e),ef(e.from,e.to)}})}),(0,a.jsx)(h.Z,{children:o?(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),I&&I.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsx)(eo.Z,{value:String(e),children:e},e))]})}):(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),I&&I.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsxs)(K.Z,{value:String(e),disabled:!0,children:["✨ ",e," (Enterpise only Feature)"]},e))]})})})]}),(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Spend Per Tag"}),(0,a.jsxs)(_.Z,{children:["Get Started Tracking cost per tag ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,a.jsx)(ec.Z,{className:"h-72",data:w,index:"name",categories:["spend"],colors:["blue"]})]})}),(0,a.jsx)(h.Z,{numColSpan:2})]})]})]})]})})},ls=()=>{let{Title:e,Paragraph:l}=$.default,[s,t]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[u,h]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(!0),Z=(0,i.useSearchParams)(),[f,_]=(0,r.useState)({data:[]}),y=Z.get("userID"),b=Z.get("token"),[v,S]=(0,r.useState)("api-keys"),[k,w]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(b){let e=(0,X.o)(b);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),w(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e.toLowerCase())),console.log("Received user role length: ".concat(e.toLowerCase().length)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"internal_user":return"Internal User";case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),t(l),"Admin Viewer"==l&&S("usage")}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e)),e.login_method?g("username_password"==e.login_method):console.log("User Email is not set ".concat(e)),e.premium_user&&o(e.premium_user)}}},[b]),(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{children:"Loading..."}),children:(0,a.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,a.jsx)(m,{userID:y,userRole:s,userEmail:d,showSSOBanner:j,premiumUser:n}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,a.jsx)("div",{className:"mt-8",children:(0,a.jsx)(e9,{setPage:S,userRole:s,defaultSelectedKey:null})}),"api-keys"==v?(0,a.jsx)(Q,{userID:y,userRole:s,teams:u,keys:x,setUserRole:t,userEmail:d,setUserEmail:c,setTeams:h,setKeys:p}):"models"==v?(0,a.jsx)(eP,{userID:y,userRole:s,token:b,keys:x,accessToken:k,modelData:f,setModelData:_,premiumUser:n}):"llm-playground"==v?(0,a.jsx)(e5,{userID:y,userRole:s,token:b,accessToken:k}):"users"==v?(0,a.jsx)(eF,{userID:y,userRole:s,token:b,keys:x,teams:u,accessToken:k,setKeys:p}):"teams"==v?(0,a.jsx)(eM,{teams:u,setTeams:h,searchParams:Z,accessToken:k,userID:y,userRole:s}):"admin-panel"==v?(0,a.jsx)(eR,{setTeams:h,searchParams:Z,accessToken:k,showSSOBanner:j}):"api_ref"==v?(0,a.jsx)(e2,{}):"settings"==v?(0,a.jsx)(eK,{userID:y,userRole:s,accessToken:k,premiumUser:n}):"budgets"==v?(0,a.jsx)(e0,{accessToken:k}):"general-settings"==v?(0,a.jsx)(e$,{userID:y,userRole:s,accessToken:k,modelData:f}):"model-hub"==v?(0,a.jsx)(e1.Z,{accessToken:k,publicPage:!1,premiumUser:n}):(0,a.jsx)(ll,{userID:y,userRole:s,token:b,accessToken:k,keys:x,premiumUser:n})]})]})})}},41134:function(e,l,s){"use strict";s.d(l,{Z:function(){return y}});var t=s(3827),n=s(64090),a=s(47907),r=s(777),i=s(16450),o=s(13810),d=s(92836),c=s(26734),m=s(41608),u=s(32126),h=s(23682),x=s(71801),p=s(42440),j=s(84174),g=s(50459),Z=s(6180),f=s(99129),_=s(67951),y=e=>{var l;let{accessToken:s,publicPage:y,premiumUser:b}=e,[v,S]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,I]=(0,n.useState)(!1),[A,C]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null),E=(0,a.useRouter)();(0,n.useEffect)(()=>{s&&(async()=>{try{let e=await (0,r.kn)(s);console.log("ModelHubData:",e),w(e.data),(0,r.E9)(s,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&S(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}})()},[s,y]);let O=e=>{T(e),I(!0)},F=async()=>{s&&(0,r.jA)(s,"enable_public_model_hub",!0).then(e=>{C(!0)})},M=()=>{I(!1),C(!1),T(null)},R=()=>{I(!1),C(!1),T(null)},D=e=>{navigator.clipboard.writeText(e)};return(0,t.jsxs)("div",{children:[y&&v||!1==y?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsx)("div",{className:"relative w-full"}),(0,t.jsxs)("div",{className:"flex ".concat(y?"justify-between":"items-center"),children:[(0,t.jsx)(p.Z,{className:"ml-8 text-center ",children:"Model Hub"}),!1==y?b?(0,t.jsx)(i.Z,{className:"ml-4",onClick:()=>F(),children:"✨ Make Public"}):(0,t.jsx)(i.Z,{className:"ml-4",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Make Public"})}):(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("p",{children:"Filter by key:"}),(0,t.jsx)(x.Z,{className:"bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center",children:"/ui/model_hub?key="})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-6 sm:grid-cols-3 lg:grid-cols-4 pr-8",children:k&&k.map(e=>(0,t.jsxs)(o.Z,{className:"mt-5 mx-8",children:[(0,t.jsxs)("pre",{className:"flex justify-between",children:[(0,t.jsx)(p.Z,{children:e.model_group}),(0,t.jsx)(Z.Z,{title:e.model_group,children:(0,t.jsx)(j.Z,{onClick:()=>D(e.model_group),style:{cursor:"pointer",marginRight:"10px"}})})]}),(0,t.jsxs)("div",{className:"my-5",children:[(0,t.jsxs)(x.Z,{children:["Mode: ",e.mode]}),(0,t.jsxs)(x.Z,{children:["Supports Function Calling:"," ",(null==e?void 0:e.supports_function_calling)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Supports Vision:"," ",(null==e?void 0:e.supports_vision)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Max Input Tokens:"," ",(null==e?void 0:e.max_input_tokens)?null==e?void 0:e.max_input_tokens:"N/A"]}),(0,t.jsxs)(x.Z,{children:["Max Output Tokens:"," ",(null==e?void 0:e.max_output_tokens)?null==e?void 0:e.max_output_tokens:"N/A"]})]}),(0,t.jsx)("div",{style:{marginTop:"auto",textAlign:"right"},children:(0,t.jsxs)("a",{href:"#",onClick:()=>O(e),style:{color:"#1890ff",fontSize:"smaller"},children:["View more ",(0,t.jsx)(g.Z,{})]})})]},e.model_group))})]}):(0,t.jsxs)(o.Z,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(x.Z,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(f.Z,{title:"Public Model Hub",width:600,visible:A,footer:null,onOk:M,onCancel:R,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(x.Z,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(x.Z,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"/ui/model_hub?key="})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Z,{onClick:()=>{E.replace("/model_hub?key=".concat(s))},children:"See Page"})})]})}),(0,t.jsx)(f.Z,{title:P&&P.model_group?P.model_group:"Unknown Model",width:800,visible:N,footer:null,onOk:M,onCancel:R,children:P&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-4",children:(0,t.jsx)("strong",{children:"Model Information & Usage"})}),(0,t.jsxs)(c.Z,{children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:"OpenAI Python SDK"}),(0,t.jsx)(d.Z,{children:"Supported OpenAI Params"}),(0,t.jsx)(d.Z,{children:"LlamaIndex"}),(0,t.jsx)(d.Z,{children:"Langchain Py"})]}),(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(P.model_group,'", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:"".concat(null===(l=P.supported_openai_params)||void 0===l?void 0:l.map(e=>"".concat(e,"\n")).join(""))})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="'.concat(P.model_group,'", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "'.concat(P.model_group,'",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n ')})})]})]})]})})]})}}},function(e){e.O(0,[936,294,131,684,759,777,971,69,744],function(){return e(e.s=20661)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_buildManifest.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_buildManifest.js
rename to litellm/proxy/_experimental/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_buildManifest.js
diff --git a/litellm/proxy/_experimental/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_ssgManifest.js
similarity index 100%
rename from litellm/proxy/_experimental/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_ssgManifest.js
rename to litellm/proxy/_experimental/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_ssgManifest.js
diff --git a/litellm/proxy/_experimental/out/index.html b/litellm/proxy/_experimental/out/index.html
index f458d65ec..5a054d50f 100644
--- a/litellm/proxy/_experimental/out/index.html
+++ b/litellm/proxy/_experimental/out/index.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/index.txt b/litellm/proxy/_experimental/out/index.txt
index 9189dd058..b6ba7c9a5 100644
--- a/litellm/proxy/_experimental/out/index.txt
+++ b/litellm/proxy/_experimental/out/index.txt
@@ -1,7 +1,7 @@
2:I[77831,[],""]
-3:I[30217,["936","static/chunks/2f6dbc85-052c4579f80d66ae.js","294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","235","static/chunks/235-bab36c9b7a1c87ea.js","759","static/chunks/759-83a8bdddfe32b5d9.js","777","static/chunks/777-ce1c9c18434e9ecb.js","931","static/chunks/app/page-42570e92ea8bcf56.js"],""]
+3:I[31034,["936","static/chunks/2f6dbc85-052c4579f80d66ae.js","294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","684","static/chunks/684-bb2d2f93d92acb0b.js","759","static/chunks/759-83a8bdddfe32b5d9.js","777","static/chunks/777-ce1c9c18434e9ecb.js","931","static/chunks/app/page-7788673d99ee79d9.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/litellm/proxy/_experimental/out/model_hub.html b/litellm/proxy/_experimental/out/model_hub.html
index 0e379c329..80a9a9ee0 100644
--- a/litellm/proxy/_experimental/out/model_hub.html
+++ b/litellm/proxy/_experimental/out/model_hub.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/model_hub.txt b/litellm/proxy/_experimental/out/model_hub.txt
index 68e46fe14..53fcf5eca 100644
--- a/litellm/proxy/_experimental/out/model_hub.txt
+++ b/litellm/proxy/_experimental/out/model_hub.txt
@@ -2,6 +2,6 @@
3:I[87494,["294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","777","static/chunks/777-ce1c9c18434e9ecb.js","418","static/chunks/app/model_hub/page-ed96a1646c72dbd1.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["model_hub",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["model_hub",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","model_hub","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["model_hub",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["model_hub",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","model_hub","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html
index 01b9a2047..50b15455f 100644
--- a/litellm/proxy/_experimental/out/onboarding.html
+++ b/litellm/proxy/_experimental/out/onboarding.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/onboarding.txt b/litellm/proxy/_experimental/out/onboarding.txt
index 90d840005..e4c35ff96 100644
--- a/litellm/proxy/_experimental/out/onboarding.txt
+++ b/litellm/proxy/_experimental/out/onboarding.txt
@@ -1,7 +1,7 @@
2:I[77831,[],""]
-3:I[667,["665","static/chunks/3014691f-589a5f4865c3822f.js","294","static/chunks/294-0e35509d5ca95267.js","235","static/chunks/235-bab36c9b7a1c87ea.js","777","static/chunks/777-ce1c9c18434e9ecb.js","461","static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js"],""]
+3:I[667,["665","static/chunks/3014691f-589a5f4865c3822f.js","294","static/chunks/294-0e35509d5ca95267.js","684","static/chunks/684-bb2d2f93d92acb0b.js","777","static/chunks/777-ce1c9c18434e9ecb.js","461","static/chunks/app/onboarding/page-3c7091570f67cd10.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["onboarding",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["onboarding",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","onboarding","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["onboarding",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["onboarding",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","onboarding","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/out/404.html b/ui/litellm-dashboard/out/404.html
index 6deb96549..41cc292f2 100644
--- a/ui/litellm-dashboard/out/404.html
+++ b/ui/litellm-dashboard/out/404.html
@@ -1 +1 @@
-404: This page could not be found.LiteLLM Dashboard404
This page could not be found.
\ No newline at end of file
+404: This page could not be found.LiteLLM Dashboard404
This page could not be found.
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/chunks/235-bab36c9b7a1c87ea.js b/ui/litellm-dashboard/out/_next/static/chunks/235-bab36c9b7a1c87ea.js
deleted file mode 100644
index 23aac1a58..000000000
--- a/ui/litellm-dashboard/out/_next/static/chunks/235-bab36c9b7a1c87ea.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[235],{52273:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(69703),o=n(64090),a=n(99250),l=n(65492);let c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),o.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))},i=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),o.createElement("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"}))},s=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{fillRule:"evenodd",d:"M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z",clipRule:"evenodd"}),o.createElement("path",{d:"M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z"}))};var d=n(91753);let u=o.forwardRef((e,t)=>{let{value:n,defaultValue:u,type:m,placeholder:p="Type...",icon:f,error:g=!1,errorMessage:h,disabled:b=!1,stepper:v,makeInputClassName:y,className:x,onChange:w,onValueChange:E,autoFocus:k}=e,O=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus"]),[C,j]=(0,o.useState)(k||!1),[S,M]=(0,o.useState)(!1),I=(0,o.useCallback)(()=>M(!S),[S,M]),N=(0,o.useRef)(null),q=(0,d.Uh)(n||u);return o.useEffect(()=>{let e=()=>j(!0),t=()=>j(!1),n=N.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),k&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[k]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,a.q)(y("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,d.um)(q,b,g),C&&(0,a.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),x)},f?o.createElement(f,{className:(0,a.q)(y("icon"),"shrink-0 h-5 w-5 ml-2.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,l.lq)([N,t]),defaultValue:u,value:n,type:S?"text":m,className:(0,a.q)(y("input"),"w-full focus:outline-none focus:ring-0 border-none bg-transparent text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",f?"pl-2":"pl-3",g?"pr-3":"pr-4",b?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:b,"data-testid":"base-input",onChange:e=>{null==w||w(e),null==E||E(e.target.value)}},O)),"password"!==m||b?null:o.createElement("button",{className:(0,a.q)(y("toggleButton"),"mr-2"),type:"button",onClick:()=>I(),"aria-label":S?"Hide password":"Show Password"},S?o.createElement(s,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):o.createElement(i,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),g?o.createElement(c,{className:(0,a.q)(y("errorIcon"),"text-red-500 shrink-0 w-5 h-5 mr-2.5")}):null,null!=v?v:null),g&&h?o.createElement("p",{className:(0,a.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});u.displayName="BaseInput";let m=(0,l.fn)("TextInput"),p=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(u,Object.assign({ref:t,type:n,makeInputClassName:m},a))});p.displayName="TextInput"},91753:function(e,t,n){n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return l},um:function(){return i}});var r=n(99250),o=n(64090);let a=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(a).join(""):"object"==typeof e&&e?a(e.props.children):void 0;function l(e){let t=new Map;return o.Children.map(e,e=>{var n;t.set(e.props.value,null!==(n=a(e))&&void 0!==n?n:e.props.value)}),t}function c(e,t){return o.Children.map(t,t=>{var n;if((null!==(n=a(t))&&void 0!==n?n:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.q)(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500",n?"border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},10384:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:d,children:u,className:m}=e,p=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),(()=>{let e=f(n,c.PT),t=f(a,c.SP),r=f(s,c.VS),l=f(d,c._w);return(0,o.q)(e,t,r,l)})(),m)},p),u)});s.displayName="Col"},46453:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=l.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:a,numItemsMd:d,numItemsLg:u,children:m,className:p}=e,f=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,c._m),h=s(a,c.LH),b=s(d,c.l5),v=s(u,c.N4),y=(0,o.q)(g,h,b,v);return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",y,p)},f),m)});d.displayName="Grid"},50217:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return l},PT:function(){return c},SP:function(){return i},VS:function(){return s},_m:function(){return r},_w:function(){return d},l5:function(){return a}});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"},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"},l={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"},c={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"}},18190:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(64090),a=n(2898),l=n(99250),c=n(65492);let i=(0,c.fn)("Callout"),s=o.forwardRef((e,t)=>{let{title:n,icon:s,color:d,className:u,children:m}=e,p=(0,r._T)(e,["title","icon","color","className","children"]);return o.createElement("div",Object.assign({ref:t,className:(0,l.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,l.q)((0,c.bM)(d,a.K.background).bgColor,(0,c.bM)(d,a.K.darkBorder).borderColor,(0,c.bM)(d,a.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,l.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"),u)},p),o.createElement("div",{className:(0,l.q)(i("header"),"flex items-start")},s?o.createElement(s,{className:(0,l.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,o.createElement("h4",{className:(0,l.q)(i("title"),"font-semibold")},n)),o.createElement("p",{className:(0,l.q)(i("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout"},81583:function(e,t,n){n.d(t,{Z:function(){return eP}});var r=n(63787),o=n(16480),a=n.n(o),l=n(49367),c=n(64090),i=n(47387),s=n(47137);function d(e){let[t,n]=c.useState(e);return c.useEffect(()=>{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}var u=n(8985),m=n(11303),p=n(58854),f=n(46154),g=n(80316),h=n(76585),b=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut," !important"),["&".concat(r,"-appear, &").concat(r,"-enter")]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},["&".concat(r,"-leave-active")]:{transform:"translateY(-5px)"}}}}};let v=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:"".concat((0,u.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:"0 0 0 ".concat((0,u.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),y=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},x=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,m.Wf)(e)),v(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},y(e,e.controlHeightSM)),"&-large":Object.assign({},y(e,e.controlHeightLG))})}},w=e=>{let{formItemCls:t,iconCls:n,componentCls:r,rootPrefixCls:o,labelRequiredMarkColor:a,labelColor:l,labelFontSize:c,labelHeight:i,labelColonMarginInlineStart:s,labelColonMarginInlineEnd:d,itemMarginBottom:u}=e;return{[t]:Object.assign(Object.assign({},(0,m.Wf)(e)),{marginBottom:u,verticalAlign:"top","&-with-help":{transition:"none"},["&-hidden,\n &-hidden.".concat(o,"-row")]:{display:"none"},"&-has-warning":{["".concat(t,"-split")]:{color:e.colorError}},"&-has-error":{["".concat(t,"-split")]:{color:e.colorWarning}},["".concat(t,"-label")]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:i,color:l,fontSize:c,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required:not(").concat(t,"-required-mark-optional)::before")]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:a,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:s,marginInlineEnd:d},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(o,"-col-'\"]):not([class*=\"' ").concat(o,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:"color ".concat(e.motionDurationMid," ").concat(e.motionEaseOut)},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},["&-with-help ".concat(t,"-explain")]:{height:"auto",opacity:1},["".concat(t,"-feedback-icon")]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:p.kr,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},E=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-horizontal")]:{["".concat(n,"-label")]:{flexGrow:0},["".concat(n,"-control")]:{flex:"1 1 0",minWidth:0},["".concat(n,"-label[class$='-24'], ").concat(n,"-label[class*='-24 ']")]:{["& + ".concat(n,"-control")]:{minWidth:"unset"}}}}},k=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},["> ".concat(n,"-label,\n > ").concat(n,"-control")]:{display:"inline-block",verticalAlign:"top"},["> ".concat(n,"-label")]:{flex:"none"},["".concat(t,"-text")]:{display:"inline-block"},["".concat(n,"-has-feedback")]:{display:"inline-block"}}}}},O=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),C=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:O(e),["".concat(t,":not(").concat(t,"-inline)")]:{[n]:{flexWrap:"wrap",["".concat(n,"-label, ").concat(n,"-control")]:{['&:not([class*=" '.concat(r,'-col-xs"])')]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},j=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(t,"-vertical")]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},["".concat(t,"-item-control")]:{width:"100%"}}},["".concat(t,"-vertical ").concat(n,"-label,\n .").concat(r,"-col-24").concat(n,"-label,\n .").concat(r,"-col-xl-24").concat(n,"-label")]:O(e),["@media (max-width: ".concat((0,u.bf)(e.screenXSMax),")")]:[C(e),{[t]:{[".".concat(r,"-col-xs-24").concat(n,"-label")]:O(e)}}],["@media (max-width: ".concat((0,u.bf)(e.screenSMMax),")")]:{[t]:{[".".concat(r,"-col-sm-24").concat(n,"-label")]:O(e)}},["@media (max-width: ".concat((0,u.bf)(e.screenMDMax),")")]:{[t]:{[".".concat(r,"-col-md-24").concat(n,"-label")]:O(e)}},["@media (max-width: ".concat((0,u.bf)(e.screenLGMax),")")]:{[t]:{[".".concat(r,"-col-lg-24").concat(n,"-label")]:O(e)}}}},S=(e,t)=>(0,g.TS)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var M=(0,h.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=S(e,n);return[x(r),w(r),b(r),E(r),k(r),j(r),(0,f.Z)(r),p.kr]},e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:"0 0 ".concat(e.paddingXS,"px"),verticalLabelMargin:0}),{order:-1e3}),I=n(92935);let N=[];function q(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{key:"string"==typeof e?e:"".concat(t,"-").concat(r),error:e,errorStatus:n}}var Z=e=>{let{help:t,helpStatus:n,errors:o=N,warnings:u=N,className:m,fieldId:p,onVisibleChanged:f}=e,{prefixCls:g}=c.useContext(s.Rk),h="".concat(g,"-item-explain"),b=(0,I.Z)(g),[v,y,x]=M(g,b),w=(0,c.useMemo)(()=>(0,i.Z)(g),[g]),E=d(o),k=d(u),O=c.useMemo(()=>null!=t?[q(t,"help",n)]:[].concat((0,r.Z)(E.map((e,t)=>q(e,"error","error",t))),(0,r.Z)(k.map((e,t)=>q(e,"warning","warning",t)))),[t,n,E,k]),C={};return p&&(C.id="".concat(p,"_help")),v(c.createElement(l.ZP,{motionDeadline:w.motionDeadline,motionName:"".concat(g,"-show-help"),visible:!!O.length,onVisibleChanged:f},e=>{let{className:t,style:n}=e;return c.createElement("div",Object.assign({},C,{className:a()(h,t,x,b,m,y),style:n,role:"alert"}),c.createElement(l.V4,Object.assign({keys:O},(0,i.Z)(g),{motionName:"".concat(g,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:o,style:l}=e;return c.createElement("div",{key:t,className:a()(o,{["".concat(h,"-").concat(r)]:r}),style:l},n)}))}))},F=n(76570),R=n(57499),_=n(17094),P=n(10693),T=n(97303);let L=e=>"object"==typeof e&&null!=e&&1===e.nodeType,W=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,H=(e,t)=>{if(e.clientHeight{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeightat||a>e&&l=t&&c>=n?a-e-r:l>t&&cn?l-t+o:0,V=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},A=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:l,block:c,inline:i,boundary:s,skipOverflowHiddenElements:d}=t,u="function"==typeof s?s:e=>e!==s;if(!L(e))throw TypeError("Invalid target");let m=document.scrollingElement||document.documentElement,p=[],f=e;for(;L(f)&&u(f);){if((f=V(f))===m){p.push(f);break}null!=f&&f===document.body&&H(f)&&!H(document.documentElement)||null!=f&&H(f,d)&&p.push(f)}let g=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,h=null!=(a=null==(o=window.visualViewport)?void 0:o.height)?a:innerHeight,{scrollX:b,scrollY:v}=window,{height:y,width:x,top:w,right:E,bottom:k,left:O}=e.getBoundingClientRect(),{top:C,right:j,bottom:S,left:M}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),I="start"===c||"nearest"===c?w-C:"end"===c?k+S:w+y/2-C+S,N="center"===i?O+x/2-M+j:"end"===i?E+j:O-M,q=[];for(let e=0;e=0&&O>=0&&k<=h&&E<=g&&w>=o&&k<=s&&O>=d&&E<=a)break;let u=getComputedStyle(t),f=parseInt(u.borderLeftWidth,10),C=parseInt(u.borderTopWidth,10),j=parseInt(u.borderRightWidth,10),S=parseInt(u.borderBottomWidth,10),M=0,Z=0,F="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-j:0,R="offsetHeight"in t?t.offsetHeight-t.clientHeight-C-S:0,_="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,P="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(m===t)M="start"===c?I:"end"===c?I-h:"nearest"===c?z(v,v+h,h,C,S,v+I,v+I+y,y):I-h/2,Z="start"===i?N:"center"===i?N-g/2:"end"===i?N-g:z(b,b+g,g,f,j,b+N,b+N+x,x),M=Math.max(0,M+v),Z=Math.max(0,Z+b);else{M="start"===c?I-o-C:"end"===c?I-s+S+R:"nearest"===c?z(o,s,n,C,S+R,I,I+y,y):I-(o+n/2)+R/2,Z="start"===i?N-d-f:"center"===i?N-(d+r/2)+F/2:"end"===i?N-a+j+F:z(d,a,r,f,j+F,N,N+x,x);let{scrollLeft:e,scrollTop:l}=t;M=0===P?0:Math.max(0,Math.min(l+M/P,t.scrollHeight-n/P+R)),Z=0===_?0:Math.max(0,Math.min(e+Z/_,t.scrollWidth-r/_+F)),I+=l-M,N+=e-Z}q.push({el:t,top:M,left:Z})}return q},D=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"},B=["parentNode"];function X(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function G(e,t){if(!e.length)return;let n=e.join("_");return t?"".concat(t,"_").concat(n):B.includes(n)?"".concat("form_item","_").concat(n):n}function U(e,t,n,r,o,a){let l=r;return void 0!==a?l=a:n.validating?l="validating":e.length?l="error":t.length?l="warning":(n.touched||o&&n.validated)&&(l="success"),l}function $(e){return X(e).join("_")}function K(e){let[t]=(0,F.cI)(),n=c.useRef({}),r=c.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=$(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=G(X(e),r.__INTERNAL__.name),o=n?document.getElementById(n):null;o&&function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(A(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:l}of A(e,D(t))){let e=a-n.top+n.bottom,t=l-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(o,Object.assign({scrollMode:"if-needed",block:"nearest"},t))},getFieldInstance:e=>{let t=$(e);return n.current[t]}}),[e,t]);return[r]}var Y=n(12519),J=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};let Q=c.forwardRef((e,t)=>{let n=c.useContext(_.Z),{getPrefixCls:r,direction:o,form:l}=c.useContext(R.E_),{prefixCls:i,className:d,rootClassName:u,size:m,disabled:p=n,form:f,colon:g,labelAlign:h,labelWrap:b,labelCol:v,wrapperCol:y,hideRequiredMark:x,layout:w="horizontal",scrollToFirstError:E,requiredMark:k,onFinishFailed:O,name:C,style:j,feedbackIcons:S,variant:N}=e,q=J(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),Z=(0,P.Z)(m),L=c.useContext(Y.Z),W=(0,c.useMemo)(()=>void 0!==k?k:!x&&(!l||void 0===l.requiredMark||l.requiredMark),[x,k,l]),H=null!=g?g:null==l?void 0:l.colon,z=r("form",i),V=(0,I.Z)(z),[A,D,B]=M(z,V),X=a()(z,"".concat(z,"-").concat(w),{["".concat(z,"-hide-required-mark")]:!1===W,["".concat(z,"-rtl")]:"rtl"===o,["".concat(z,"-").concat(Z)]:Z},B,V,D,null==l?void 0:l.className,d,u),[G]=K(f),{__INTERNAL__:U}=G;U.name=C;let $=(0,c.useMemo)(()=>({name:C,labelAlign:h,labelCol:v,labelWrap:b,wrapperCol:y,vertical:"vertical"===w,colon:H,requiredMark:W,itemRef:U.itemRef,form:G,feedbackIcons:S}),[C,h,v,y,w,H,W,G,S]);c.useImperativeHandle(t,()=>G);let Q=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=e),G.scrollToField(t,n)}};return A(c.createElement(s.pg.Provider,{value:N},c.createElement(_.n,{disabled:p},c.createElement(T.Z.Provider,{value:Z},c.createElement(s.RV,{validateMessages:L},c.createElement(s.q3.Provider,{value:$},c.createElement(F.ZP,Object.assign({id:C},q,{name:C,onFinishFailed:e=>{if(null==O||O(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==E){Q(E,t);return}l&&void 0!==l.scrollToFirstError&&Q(l.scrollToFirstError,t)}},form:G,style:Object.assign(Object.assign({},null==l?void 0:l.style),j),className:X}))))))))});var ee=n(89211),et=n(74084),en=n(65823),er=n(76564),eo=n(33054);let ea=()=>{let{status:e,errors:t=[],warnings:n=[]}=(0,c.useContext)(s.aM);return{status:e,errors:t,warnings:n}};ea.Context=s.aM;var el=n(19223),ec=n(73193),ei=n(24800),es=n(35704),ed=n(5056),eu=n(90791);let em=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var ep=(0,h.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return[em(S(e,n))]}),ef=e=>{let{prefixCls:t,status:n,wrapperCol:r,children:o,errors:l,warnings:i,_internalItemRender:d,extra:u,help:m,fieldId:p,marginBottom:f,onErrorVisibleChanged:g}=e,h="".concat(t,"-item"),b=c.useContext(s.q3),v=r||b.wrapperCol||{},y=a()("".concat(h,"-control"),v.className),x=c.useMemo(()=>Object.assign({},b),[b]);delete x.labelCol,delete x.wrapperCol;let w=c.createElement("div",{className:"".concat(h,"-control-input")},c.createElement("div",{className:"".concat(h,"-control-input-content")},o)),E=c.useMemo(()=>({prefixCls:t,status:n}),[t,n]),k=null!==f||l.length||i.length?c.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},c.createElement(s.Rk.Provider,{value:E},c.createElement(Z,{fieldId:p,errors:l,warnings:i,help:m,helpStatus:n,className:"".concat(h,"-explain-connected"),onVisibleChanged:g})),!!f&&c.createElement("div",{style:{width:0,height:f}})):null,O={};p&&(O.id="".concat(p,"_extra"));let C=u?c.createElement("div",Object.assign({},O,{className:"".concat(h,"-extra")}),u):null,j=d&&"pro_table_render"===d.mark&&d.render?d.render(e,{input:w,errorList:k,extra:C}):c.createElement(c.Fragment,null,w,k,C);return c.createElement(s.q3.Provider,{value:x},c.createElement(eu.Z,Object.assign({},v,{className:y}),j),c.createElement(ep,{prefixCls:t}))},eg=n(14749),eh={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:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},eb=n(60688),ev=c.forwardRef(function(e,t){return c.createElement(eb.Z,(0,eg.Z)({},e,{ref:t,icon:eh}))}),ey=n(79474),ex=n(70595),ew=n(6180),eE=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},ek=e=>{var t;let{prefixCls:n,label:r,htmlFor:o,labelCol:l,labelAlign:i,colon:d,required:u,requiredMark:m,tooltip:p}=e,[f]=(0,ex.Z)("Form"),{vertical:g,labelAlign:h,labelCol:b,labelWrap:v,colon:y}=c.useContext(s.q3);if(!r)return null;let x=l||b||{},w="".concat(n,"-item-label"),E=a()(w,"left"===(i||h)&&"".concat(w,"-left"),x.className,{["".concat(w,"-wrap")]:!!v}),k=r,O=!0===d||!1!==y&&!1!==d;O&&!g&&"string"==typeof r&&""!==r.trim()&&(k=r.replace(/[:|:]\s*$/,""));let C=p?"object"!=typeof p||c.isValidElement(p)?{title:p}:p:null;if(C){let{icon:e=c.createElement(ev,null)}=C,t=eE(C,["icon"]),r=c.createElement(ew.Z,Object.assign({},t),c.cloneElement(e,{className:"".concat(n,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));k=c.createElement(c.Fragment,null,k,r)}let j="optional"===m,S="function"==typeof m;S?k=m(k,{required:!!u}):j&&!u&&(k=c.createElement(c.Fragment,null,k,c.createElement("span",{className:"".concat(n,"-item-optional"),title:""},(null==f?void 0:f.optional)||(null===(t=ey.Z.Form)||void 0===t?void 0:t.optional))));let M=a()({["".concat(n,"-item-required")]:u,["".concat(n,"-item-required-mark-optional")]:j||S,["".concat(n,"-item-no-colon")]:!O});return c.createElement(eu.Z,Object.assign({},x,{className:E}),c.createElement("label",{htmlFor:o,className:M,title:"string"==typeof r?r:""},k))},eO=n(99537),eC=n(77136),ej=n(20653),eS=n(66155);let eM={success:eO.Z,warning:ej.Z,error:eC.Z,validating:eS.Z};function eI(e){let{children:t,errors:n,warnings:r,hasFeedback:o,validateStatus:l,prefixCls:i,meta:d,noStyle:u}=e,m="".concat(i,"-item"),{feedbackIcons:p}=c.useContext(s.q3),f=U(n,r,d,null,!!o,l),{isFormItemInput:g,status:h,hasFeedback:b,feedbackIcon:v}=c.useContext(s.aM),y=c.useMemo(()=>{var e;let t;if(o){let l=!0!==o&&o.icons||p,i=f&&(null===(e=null==l?void 0:l({status:f,errors:n,warnings:r}))||void 0===e?void 0:e[f]),s=f&&eM[f];t=!1!==i&&s?c.createElement("span",{className:a()("".concat(m,"-feedback-icon"),"".concat(m,"-feedback-icon-").concat(f))},i||c.createElement(s,null)):null}let l={status:f||"",errors:n,warnings:r,hasFeedback:!!o,feedbackIcon:t,isFormItemInput:!0};return u&&(l.status=(null!=f?f:h)||"",l.isFormItemInput=g,l.hasFeedback=!!(null!=o?o:b),l.feedbackIcon=void 0!==o?l.feedbackIcon:v),l},[f,o,u,g,h]);return c.createElement(s.aM.Provider,{value:y},t)}var eN=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};function eq(e){let{prefixCls:t,className:n,rootClassName:r,style:o,help:l,errors:i,warnings:u,validateStatus:m,meta:p,hasFeedback:f,hidden:g,children:h,fieldId:b,required:v,isRequired:y,onSubItemMetaChange:x}=e,w=eN(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),E="".concat(t,"-item"),{requiredMark:k}=c.useContext(s.q3),O=c.useRef(null),C=d(i),j=d(u),S=null!=l,M=!!(S||i.length||u.length),I=!!O.current&&(0,ec.Z)(O.current),[N,q]=c.useState(null);(0,ei.Z)(()=>{M&&O.current&&q(parseInt(getComputedStyle(O.current).marginBottom,10))},[M,I]);let Z=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return U(e?C:p.errors,e?j:p.warnings,p,"",!!f,m)}(),F=a()(E,n,r,{["".concat(E,"-with-help")]:S||C.length||j.length,["".concat(E,"-has-feedback")]:Z&&f,["".concat(E,"-has-success")]:"success"===Z,["".concat(E,"-has-warning")]:"warning"===Z,["".concat(E,"-has-error")]:"error"===Z,["".concat(E,"-is-validating")]:"validating"===Z,["".concat(E,"-hidden")]:g});return c.createElement("div",{className:F,style:o,ref:O},c.createElement(ed.Z,Object.assign({className:"".concat(E,"-row")},(0,es.Z)(w,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),c.createElement(ek,Object.assign({htmlFor:b},e,{requiredMark:k,required:null!=v?v:y,prefixCls:t})),c.createElement(ef,Object.assign({},e,p,{errors:C,warnings:j,prefixCls:t,status:Z,help:l,marginBottom:N,onErrorVisibleChanged:e=>{e||q(null)}}),c.createElement(s.qI.Provider,{value:x},c.createElement(eI,{prefixCls:t,meta:p,errors:p.errors,warnings:p.warnings,hasFeedback:f,validateStatus:Z},h)))),!!N&&c.createElement("div",{className:"".concat(E,"-margin-offset"),style:{marginBottom:-N}}))}let eZ=c.memo(e=>{let{children:t}=e;return t},(e,t)=>(function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],o=t[n];return r===o||"function"==typeof r||"function"==typeof o})})(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function eF(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let eR=function(e){let{name:t,noStyle:n,className:o,dependencies:l,prefixCls:i,shouldUpdate:d,rules:u,children:m,required:p,label:f,messageVariables:g,trigger:h="onChange",validateTrigger:b,hidden:v,help:y}=e,{getPrefixCls:x}=c.useContext(R.E_),{name:w}=c.useContext(s.q3),E=function(e){if("function"==typeof e)return e;let t=(0,eo.Z)(e);return t.length<=1?t[0]:t}(m),k="function"==typeof E,O=c.useContext(s.qI),{validateTrigger:C}=c.useContext(F.zb),j=void 0!==b?b:C,S=null!=t,N=x("form",i),q=(0,I.Z)(N),[Z,_,P]=M(N,q);(0,er.ln)("Form.Item");let T=c.useContext(F.ZM),L=c.useRef(),[W,H]=function(e){let[t,n]=c.useState(e),r=(0,c.useRef)(null),o=(0,c.useRef)([]),a=(0,c.useRef)(!1);return c.useEffect(()=>(a.current=!1,()=>{a.current=!0,el.Z.cancel(r.current),r.current=null}),[]),[t,function(e){a.current||(null===r.current&&(o.current=[],r.current=(0,el.Z)(()=>{r.current=null,n(e=>{let t=e;return o.current.forEach(e=>{t=e(t)}),t})})),o.current.push(e))}]}({}),[z,V]=(0,ee.Z)(()=>eF()),A=(e,t)=>{H(n=>{let o=Object.assign({},n),a=[].concat((0,r.Z)(e.name.slice(0,-1)),(0,r.Z)(t)).join("__SPLIT__");return e.destroy?delete o[a]:o[a]=e,o})},[D,B]=c.useMemo(()=>{let e=(0,r.Z)(z.errors),t=(0,r.Z)(z.warnings);return Object.values(W).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[W,z.errors,z.warnings]),U=function(){let{itemRef:e}=c.useContext(s.q3),t=c.useRef({});return function(n,r){let o=r&&"object"==typeof r&&r.ref,a=n.join("_");return(t.current.name!==a||t.current.originRef!==o)&&(t.current.name=a,t.current.originRef=o,t.current.ref=(0,et.sQ)(e(n),o)),t.current.ref}}();function $(t,r,l){return n&&!v?c.createElement(eI,{prefixCls:N,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:z,errors:D,warnings:B,noStyle:!0},t):c.createElement(eq,Object.assign({key:"row"},e,{className:a()(o,P,q,_),prefixCls:N,fieldId:r,isRequired:l,errors:D,warnings:B,meta:z,onSubItemMetaChange:A}),t)}if(!S&&!k&&!l)return Z($(E));let K={};return"string"==typeof f?K.label=f:t&&(K.label=String(t)),g&&(K=Object.assign(Object.assign({},K),g)),Z(c.createElement(F.gN,Object.assign({},e,{messageVariables:K,trigger:h,validateTrigger:j,onMetaChange:e=>{let t=null==T?void 0:T.getKey(e.name);if(V(e.destroy?eF():e,!0),n&&!1!==y&&O){let n=e.name;if(e.destroy)n=L.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),L.current=n}O(e,n)}}}),(n,o,a)=>{let i=X(t).length&&o?o.name:[],s=G(i,w),m=void 0!==p?p:!!(u&&u.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(a);return t&&t.required&&!t.warningOnly}return!1})),f=Object.assign({},n),g=null;if(Array.isArray(E)&&S)g=E;else if(k&&(!(d||l)||S));else if(!l||k||S){if((0,en.l$)(E)){let t=Object.assign(Object.assign({},E.props),f);if(t.id||(t.id=s),y||D.length>0||B.length>0||e.extra){let n=[];(y||D.length>0)&&n.push("".concat(s,"_help")),e.extra&&n.push("".concat(s,"_extra")),t["aria-describedby"]=n.join(" ")}D.length>0&&(t["aria-invalid"]="true"),m&&(t["aria-required"]="true"),(0,et.Yr)(E)&&(t.ref=U(i,E)),new Set([].concat((0,r.Z)(X(h)),(0,r.Z)(X(j)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),l=0;lt.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};Q.Item=eR,Q.List=e=>{var{prefixCls:t,children:n}=e,r=e_(e,["prefixCls","children"]);let{getPrefixCls:o}=c.useContext(R.E_),a=o("form",t),l=c.useMemo(()=>({prefixCls:a,status:"error"}),[a]);return c.createElement(F.aV,Object.assign({},r),(e,t,r)=>c.createElement(s.Rk.Provider,{value:l},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:r.errors,warnings:r.warnings})))},Q.ErrorList=Z,Q.useForm=K,Q.useFormInstance=function(){let{form:e}=(0,c.useContext)(s.q3);return e},Q.useWatch=F.qo,Q.Provider=s.RV,Q.create=()=>{};var eP=Q},24305:function(e,t,n){let r=(0,n(64090).createContext)({});t.Z=r},90791:function(e,t,n){var r=n(64090),o=n(16480),a=n.n(o),l=n(57499),c=n(24305),i=n(37148),s=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};let d=["xs","sm","md","lg","xl","xxl"],u=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(l.E_),{gutter:u,wrap:m}=r.useContext(c.Z),{prefixCls:p,span:f,order:g,offset:h,push:b,pull:v,className:y,children:x,flex:w,style:E}=e,k=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),O=n("col",p),[C,j,S]=(0,i.cG)(O),M={};d.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete k[t],M=Object.assign(Object.assign({},M),{["".concat(O,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(O,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(O,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(O,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(O,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(O,"-").concat(t,"-flex-").concat(n.flex)]:n.flex||"auto"===n.flex,["".concat(O,"-rtl")]:"rtl"===o})});let I=a()(O,{["".concat(O,"-").concat(f)]:void 0!==f,["".concat(O,"-order-").concat(g)]:g,["".concat(O,"-offset-").concat(h)]:h,["".concat(O,"-push-").concat(b)]:b,["".concat(O,"-pull-").concat(v)]:v},y,M,j,S),N={};if(u&&u[0]>0){let e=u[0]/2;N.paddingLeft=e,N.paddingRight=e}return w&&(N.flex="number"==typeof w?"".concat(w," ").concat(w," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(w)?"0 0 ".concat(w):w,!1!==m||N.minWidth||(N.minWidth=0)),C(r.createElement("div",Object.assign({},k,{style:Object.assign(Object.assign({},N),E),className:I,ref:t}),x))});t.Z=u},5056:function(e,t,n){n.d(t,{Z:function(){return g}});var r=n(64090),o=n(16480),a=n.n(o),l=n(24750);let c=["xxl","xl","lg","md","sm","xs"],i=e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}),s=e=>{let t=[].concat(c).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),l="screen".concat(o);if(!(e[a]<=e[l]))throw Error("".concat(a,"<=").concat(l," fails : !(").concat(e[a],"<=").concat(e[l],")"));if(rt.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};function f(e,t){let[n,o]=r.useState("string"==typeof e?e:""),a=()=>{if("string"==typeof e&&o(e),"object"==typeof e)for(let n=0;n{a()},[JSON.stringify(e),t]),n}var g=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:g,className:h,style:b,children:v,gutter:y=0,wrap:x}=e,w=p(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:E,direction:k}=r.useContext(d.E_),[O,C]=r.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[j,S]=r.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),M=f(g,j),I=f(o,j),N=r.useRef(y),q=function(){let[,e]=(0,l.ZP)(),t=i(s(e));return r.useMemo(()=>{let e=new Map,n=-1,r={};return{matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},unregister(){Object.keys(t).forEach(e=>{let n=t[e],r=this.matchHandlers[n];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),e.clear()},register(){Object.keys(t).forEach(e=>{let n=t[e],o=t=>{let{matches:n}=t;this.dispatch(Object.assign(Object.assign({},r),{[e]:n}))},a=window.matchMedia(n);a.addListener(o),this.matchHandlers[n]={mql:a,listener:o},o(a)})},responsiveMap:t}},[e])}();r.useEffect(()=>{let e=q.subscribe(e=>{S(e);let t=N.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&C(e)});return()=>q.unsubscribe(e)},[]);let Z=E("row",n),[F,R,_]=(0,m.VM)(Z),P=(()=>{let e=[void 0,void 0];return(Array.isArray(y)?y:[y,void 0]).forEach((t,n)=>{if("object"==typeof t)for(let r=0;r0?-(P[0]/2):void 0;W&&(L.marginLeft=W,L.marginRight=W),[,L.rowGap]=P;let[H,z]=P,V=r.useMemo(()=>({gutter:[H,z],wrap:x}),[H,z,x]);return F(r.createElement(u.Z.Provider,{value:V},r.createElement("div",Object.assign({},w,{className:T,style:Object.assign(Object.assign({},L),b),ref:t}),v)))})},37148:function(e,t,n){n.d(t,{VM:function(){return d},cG:function(){return u}});var r=n(8985),o=n(76585),a=n(80316);let l=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{componentCls:n,gridColumns:r}=e,o={};for(let e=r;e>=0;e--)0===e?(o["".concat(n).concat(t,"-").concat(e)]={display:"none"},o["".concat(n,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:0},o["".concat(n).concat(t,"-order-").concat(e)]={order:0}):(o["".concat(n).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/r*100,"%"),maxWidth:"".concat(e/r*100,"%")}],o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-order-").concat(e)]={order:e});return o},i=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},i(e,n))}),d=(0,o.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,o.I$)("Grid",e=>{let t=(0,a.TS)(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[l(t),i(t,""),i(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},46154:function(e,t){t.Z=e=>({[e.componentCls]:{["".concat(e.antCls,"-motion-collapse-legacy")]:{overflow:"hidden","&-active":{transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}},["".concat(e.antCls,"-motion-collapse")]:{overflow:"hidden",transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}}})},37963:function(e,t,n){n.d(t,{o:function(){return o}});class r extends Error{}function o(e,t){let n;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let o=!0===t.header?0:1,a=e.split(".")[o];if("string"!=typeof a)throw new r("Invalid token specified: missing part #".concat(o+1));try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var n;return n=t,decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return atob(t)}}(a)}catch(e){throw new r("Invalid token specified: invalid base64 for part #".concat(o+1," (").concat(e.message,")"))}try{return JSON.parse(n)}catch(e){throw new r("Invalid token specified: invalid json for part #".concat(o+1," (").concat(e.message,")"))}}r.prototype.name="InvalidTokenError"}}]);
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/chunks/684-bb2d2f93d92acb0b.js b/ui/litellm-dashboard/out/_next/static/chunks/684-bb2d2f93d92acb0b.js
new file mode 100644
index 000000000..4ee989c2b
--- /dev/null
+++ b/ui/litellm-dashboard/out/_next/static/chunks/684-bb2d2f93d92acb0b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[684],{52273:function(e,t,n){n.d(t,{Z:function(){return p}});var r=n(69703),o=n(64090),a=n(99250),l=n(65492);let c=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),o.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))},i=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),o.createElement("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"}))},s=e=>{var t=(0,r._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},t),o.createElement("path",{fillRule:"evenodd",d:"M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z",clipRule:"evenodd"}),o.createElement("path",{d:"M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z"}))};var d=n(91753);let u=o.forwardRef((e,t)=>{let{value:n,defaultValue:u,type:m,placeholder:p="Type...",icon:f,error:g=!1,errorMessage:h,disabled:b=!1,stepper:v,makeInputClassName:y,className:x,onChange:w,onValueChange:E,autoFocus:k}=e,O=(0,r._T)(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus"]),[C,j]=(0,o.useState)(k||!1),[S,M]=(0,o.useState)(!1),I=(0,o.useCallback)(()=>M(!S),[S,M]),N=(0,o.useRef)(null),Z=(0,d.Uh)(n||u);return o.useEffect(()=>{let e=()=>j(!0),t=()=>j(!1),n=N.current;return n&&(n.addEventListener("focus",e),n.addEventListener("blur",t),k&&n.focus()),()=>{n&&(n.removeEventListener("focus",e),n.removeEventListener("blur",t))}},[k]),o.createElement(o.Fragment,null,o.createElement("div",{className:(0,a.q)(y("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",(0,d.um)(Z,b,g),C&&(0,a.q)("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),x)},f?o.createElement(f,{className:(0,a.q)(y("icon"),"shrink-0 h-5 w-5 ml-2.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,o.createElement("input",Object.assign({ref:(0,l.lq)([N,t]),defaultValue:u,value:n,type:S?"text":m,className:(0,a.q)(y("input"),"w-full focus:outline-none focus:ring-0 border-none bg-transparent text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",f?"pl-2":"pl-3",g?"pr-3":"pr-4",b?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:p,disabled:b,"data-testid":"base-input",onChange:e=>{null==w||w(e),null==E||E(e.target.value)}},O)),"password"!==m||b?null:o.createElement("button",{className:(0,a.q)(y("toggleButton"),"mr-2"),type:"button",onClick:()=>I(),"aria-label":S?"Hide password":"Show Password"},S?o.createElement(s,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):o.createElement(i,{className:(0,a.q)("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),g?o.createElement(c,{className:(0,a.q)(y("errorIcon"),"text-red-500 shrink-0 w-5 h-5 mr-2.5")}):null,null!=v?v:null),g&&h?o.createElement("p",{className:(0,a.q)(y("errorMessage"),"text-sm text-red-500 mt-1")},h):null)});u.displayName="BaseInput";let m=(0,l.fn)("TextInput"),p=o.forwardRef((e,t)=>{let{type:n="text"}=e,a=(0,r._T)(e,["type"]);return o.createElement(u,Object.assign({ref:t,type:n,makeInputClassName:m},a))});p.displayName="TextInput"},91753:function(e,t,n){n.d(t,{Uh:function(){return s},n0:function(){return c},qg:function(){return a},sl:function(){return l},um:function(){return i}});var r=n(99250),o=n(64090);let a=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(a).join(""):"object"==typeof e&&e?a(e.props.children):void 0;function l(e){let t=new Map;return o.Children.map(e,e=>{var n;t.set(e.props.value,null!==(n=a(e))&&void 0!==n?n:e.props.value)}),t}function c(e,t){return o.Children.map(t,t=>{var n;if((null!==(n=a(t))&&void 0!==n?n:t.props.value).toLowerCase().includes(e.toLowerCase()))return t})}let i=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,r.q)(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",n&&"text-red-500",n?"border-red-500":"border-tremor-border dark:border-dark-tremor-border")};function s(e){return null!=e&&""!==e}},10384:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:n=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:d,children:u,className:m}=e,p=(0,r._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),(()=>{let e=f(n,c.PT),t=f(a,c.SP),r=f(s,c.VS),l=f(d,c._w);return(0,o.q)(e,t,r,l)})(),m)},p),u)});s.displayName="Col"},46453:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(69703),o=n(99250),a=n(65492),l=n(64090),c=n(50217);let i=(0,a.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=l.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:a,numItemsMd:d,numItemsLg:u,children:m,className:p}=e,f=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,c._m),h=s(a,c.LH),b=s(d,c.l5),v=s(u,c.N4),y=(0,o.q)(g,h,b,v);return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",y,p)},f),m)});d.displayName="Grid"},50217:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return l},PT:function(){return c},SP:function(){return i},VS:function(){return s},_m:function(){return r},_w:function(){return d},l5:function(){return a}});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"},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"},l={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"},c={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"}},18190:function(e,t,n){n.d(t,{Z:function(){return s}});var r=n(69703),o=n(64090),a=n(2898),l=n(99250),c=n(65492);let i=(0,c.fn)("Callout"),s=o.forwardRef((e,t)=>{let{title:n,icon:s,color:d,className:u,children:m}=e,p=(0,r._T)(e,["title","icon","color","className","children"]);return o.createElement("div",Object.assign({ref:t,className:(0,l.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,l.q)((0,c.bM)(d,a.K.background).bgColor,(0,c.bM)(d,a.K.darkBorder).borderColor,(0,c.bM)(d,a.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,l.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"),u)},p),o.createElement("div",{className:(0,l.q)(i("header"),"flex items-start")},s?o.createElement(s,{className:(0,l.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,o.createElement("h4",{className:(0,l.q)(i("title"),"font-semibold")},n)),o.createElement("p",{className:(0,l.q)(i("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout"},30367:function(e,t,n){var r=n(63787),o=n(16480),a=n.n(o),l=n(49367),c=n(64090),i=n(47387),s=n(47137),d=n(10677),u=n(77906),m=n(92935);let p=[];function f(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{key:"string"==typeof e?e:"".concat(t,"-").concat(r),error:e,errorStatus:n}}t.Z=e=>{let{help:t,helpStatus:n,errors:o=p,warnings:g=p,className:h,fieldId:b,onVisibleChanged:v}=e,{prefixCls:y}=c.useContext(s.Rk),x="".concat(y,"-item-explain"),w=(0,m.Z)(y),[E,k,O]=(0,u.ZP)(y,w),C=(0,c.useMemo)(()=>(0,i.Z)(y),[y]),j=(0,d.Z)(o),S=(0,d.Z)(g),M=c.useMemo(()=>null!=t?[f(t,"help",n)]:[].concat((0,r.Z)(j.map((e,t)=>f(e,"error","error",t))),(0,r.Z)(S.map((e,t)=>f(e,"warning","warning",t)))),[t,n,j,S]),I={};return b&&(I.id="".concat(b,"_help")),E(c.createElement(l.ZP,{motionDeadline:C.motionDeadline,motionName:"".concat(y,"-show-help"),visible:!!M.length,onVisibleChanged:v},e=>{let{className:t,style:n}=e;return c.createElement("div",Object.assign({},I,{className:a()(x,t,O,w,h,k),style:n,role:"alert"}),c.createElement(l.V4,Object.assign({keys:M},(0,i.Z)(y),{motionName:"".concat(y,"-show-help-item"),component:!1}),e=>{let{key:t,error:n,errorStatus:r,className:o,style:l}=e;return c.createElement("div",{key:t,className:a()(o,{["".concat(x,"-").concat(r)]:r}),style:l},n)}))}))}},84406:function(e,t,n){n.d(t,{Z:function(){return Y}});var r=n(63787),o=n(64090),a=n(16480),l=n.n(a),c=n(76570),i=n(89211),s=n(74084),d=n(65823),u=n(76564),m=n(57499),p=n(92935),f=n(47137),g=n(33054);let h=()=>{let{status:e,errors:t=[],warnings:n=[]}=(0,o.useContext)(f.aM);return{status:e,errors:t,warnings:n}};h.Context=f.aM;var b=n(19223),v=n(77906),y=n(47276),x=n(73193),w=n(24800),E=n(35704),k=n(5056),O=n(90791),C=n(30367),j=n(76585);let S=e=>{let{formItemCls:t}=e;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{["".concat(t,"-control")]:{display:"flex"}}}};var M=(0,j.bk)(["Form","item-item"],(e,t)=>{let{rootPrefixCls:n}=t;return[S((0,v.B4)(e,n))]}),I=e=>{let{prefixCls:t,status:n,wrapperCol:r,children:a,errors:c,warnings:i,_internalItemRender:s,extra:d,help:u,fieldId:m,marginBottom:p,onErrorVisibleChanged:g}=e,h="".concat(t,"-item"),b=o.useContext(f.q3),v=r||b.wrapperCol||{},y=l()("".concat(h,"-control"),v.className),x=o.useMemo(()=>Object.assign({},b),[b]);delete x.labelCol,delete x.wrapperCol;let w=o.createElement("div",{className:"".concat(h,"-control-input")},o.createElement("div",{className:"".concat(h,"-control-input-content")},a)),E=o.useMemo(()=>({prefixCls:t,status:n}),[t,n]),k=null!==p||c.length||i.length?o.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},o.createElement(f.Rk.Provider,{value:E},o.createElement(C.Z,{fieldId:m,errors:c,warnings:i,help:u,helpStatus:n,className:"".concat(h,"-explain-connected"),onVisibleChanged:g})),!!p&&o.createElement("div",{style:{width:0,height:p}})):null,j={};m&&(j.id="".concat(m,"_extra"));let S=d?o.createElement("div",Object.assign({},j,{className:"".concat(h,"-extra")}),d):null,I=s&&"pro_table_render"===s.mark&&s.render?s.render(e,{input:w,errorList:k,extra:S}):o.createElement(o.Fragment,null,w,k,S);return o.createElement(f.q3.Provider,{value:x},o.createElement(O.Z,Object.assign({},v,{className:y}),I),o.createElement(M,{prefixCls:t}))},N=n(14749),Z={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:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},q=n(60688),R=o.forwardRef(function(e,t){return o.createElement(q.Z,(0,N.Z)({},e,{ref:t,icon:Z}))}),F=n(79474),P=n(70595),_=n(6180),T=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},L=e=>{var t;let{prefixCls:n,label:r,htmlFor:a,labelCol:c,labelAlign:i,colon:s,required:d,requiredMark:u,tooltip:m}=e,[p]=(0,P.Z)("Form"),{vertical:g,labelAlign:h,labelCol:b,labelWrap:v,colon:y}=o.useContext(f.q3);if(!r)return null;let x=c||b||{},w="".concat(n,"-item-label"),E=l()(w,"left"===(i||h)&&"".concat(w,"-left"),x.className,{["".concat(w,"-wrap")]:!!v}),k=r,C=!0===s||!1!==y&&!1!==s;C&&!g&&"string"==typeof r&&""!==r.trim()&&(k=r.replace(/[:|:]\s*$/,""));let j=m?"object"!=typeof m||o.isValidElement(m)?{title:m}:m:null;if(j){let{icon:e=o.createElement(R,null)}=j,t=T(j,["icon"]),r=o.createElement(_.Z,Object.assign({},t),o.cloneElement(e,{className:"".concat(n,"-item-tooltip"),title:"",onClick:e=>{e.preventDefault()},tabIndex:null}));k=o.createElement(o.Fragment,null,k,r)}let S="optional"===u,M="function"==typeof u;M?k=u(k,{required:!!d}):S&&!d&&(k=o.createElement(o.Fragment,null,k,o.createElement("span",{className:"".concat(n,"-item-optional"),title:""},(null==p?void 0:p.optional)||(null===(t=F.Z.Form)||void 0===t?void 0:t.optional))));let I=l()({["".concat(n,"-item-required")]:d,["".concat(n,"-item-required-mark-optional")]:S||M,["".concat(n,"-item-no-colon")]:!C});return o.createElement(O.Z,Object.assign({},x,{className:E}),o.createElement("label",{htmlFor:a,className:I,title:"string"==typeof r?r:""},k))},W=n(10677),H=n(99537),z=n(77136),D=n(20653),V=n(66155);let A={success:H.Z,warning:D.Z,error:z.Z,validating:V.Z};function B(e){let{children:t,errors:n,warnings:r,hasFeedback:a,validateStatus:c,prefixCls:i,meta:s,noStyle:d}=e,u="".concat(i,"-item"),{feedbackIcons:m}=o.useContext(f.q3),p=(0,y.lR)(n,r,s,null,!!a,c),{isFormItemInput:g,status:h,hasFeedback:b,feedbackIcon:v}=o.useContext(f.aM),x=o.useMemo(()=>{var e;let t;if(a){let c=!0!==a&&a.icons||m,i=p&&(null===(e=null==c?void 0:c({status:p,errors:n,warnings:r}))||void 0===e?void 0:e[p]),s=p&&A[p];t=!1!==i&&s?o.createElement("span",{className:l()("".concat(u,"-feedback-icon"),"".concat(u,"-feedback-icon-").concat(p))},i||o.createElement(s,null)):null}let c={status:p||"",errors:n,warnings:r,hasFeedback:!!a,feedbackIcon:t,isFormItemInput:!0};return d&&(c.status=(null!=p?p:h)||"",c.isFormItemInput=g,c.hasFeedback=!!(null!=a?a:b),c.feedbackIcon=void 0!==a?c.feedbackIcon:v),c},[p,a,d,g,h]);return o.createElement(f.aM.Provider,{value:x},t)}var X=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};function G(e){let{prefixCls:t,className:n,rootClassName:r,style:a,help:c,errors:i,warnings:s,validateStatus:d,meta:u,hasFeedback:m,hidden:p,children:g,fieldId:h,required:b,isRequired:v,onSubItemMetaChange:O}=e,C=X(e,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),j="".concat(t,"-item"),{requiredMark:S}=o.useContext(f.q3),M=o.useRef(null),N=(0,W.Z)(i),Z=(0,W.Z)(s),q=null!=c,R=!!(q||i.length||s.length),F=!!M.current&&(0,x.Z)(M.current),[P,_]=o.useState(null);(0,w.Z)(()=>{R&&M.current&&_(parseInt(getComputedStyle(M.current).marginBottom,10))},[R,F]);let T=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=e?N:u.errors,n=e?Z:u.warnings;return(0,y.lR)(t,n,u,"",!!m,d)}(),H=l()(j,n,r,{["".concat(j,"-with-help")]:q||N.length||Z.length,["".concat(j,"-has-feedback")]:T&&m,["".concat(j,"-has-success")]:"success"===T,["".concat(j,"-has-warning")]:"warning"===T,["".concat(j,"-has-error")]:"error"===T,["".concat(j,"-is-validating")]:"validating"===T,["".concat(j,"-hidden")]:p});return o.createElement("div",{className:H,style:a,ref:M},o.createElement(k.Z,Object.assign({className:"".concat(j,"-row")},(0,E.Z)(C,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),o.createElement(L,Object.assign({htmlFor:h},e,{requiredMark:S,required:null!=b?b:v,prefixCls:t})),o.createElement(I,Object.assign({},e,u,{errors:N,warnings:Z,prefixCls:t,status:T,help:c,marginBottom:P,onErrorVisibleChanged:e=>{e||_(null)}}),o.createElement(f.qI.Provider,{value:O},o.createElement(B,{prefixCls:t,meta:u,errors:u.errors,warnings:u.warnings,hasFeedback:m,validateStatus:T},g)))),!!P&&o.createElement("div",{className:"".concat(j,"-margin-offset"),style:{marginBottom:-P}}))}let U=o.memo(e=>{let{children:t}=e;return t},(e,t)=>(function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],o=t[n];return r===o||"function"==typeof r||"function"==typeof o})})(e.control,t.control)&&e.update===t.update&&e.childProps.length===t.childProps.length&&e.childProps.every((e,n)=>e===t.childProps[n]));function $(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}let K=function(e){let{name:t,noStyle:n,className:a,dependencies:h,prefixCls:x,shouldUpdate:w,rules:E,children:k,required:O,label:C,messageVariables:j,trigger:S="onChange",validateTrigger:M,hidden:I,help:N}=e,{getPrefixCls:Z}=o.useContext(m.E_),{name:q}=o.useContext(f.q3),R=function(e){if("function"==typeof e)return e;let t=(0,g.Z)(e);return t.length<=1?t[0]:t}(k),F="function"==typeof R,P=o.useContext(f.qI),{validateTrigger:_}=o.useContext(c.zb),T=void 0!==M?M:_,L=null!=t,W=Z("form",x),H=(0,p.Z)(W),[z,D,V]=(0,v.ZP)(W,H);(0,u.ln)("Form.Item");let A=o.useContext(c.ZM),X=o.useRef(),[K,Y]=function(e){let[t,n]=o.useState(e),r=(0,o.useRef)(null),a=(0,o.useRef)([]),l=(0,o.useRef)(!1);return o.useEffect(()=>(l.current=!1,()=>{l.current=!0,b.Z.cancel(r.current),r.current=null}),[]),[t,function(e){l.current||(null===r.current&&(a.current=[],r.current=(0,b.Z)(()=>{r.current=null,n(e=>{let t=e;return a.current.forEach(e=>{t=e(t)}),t})})),a.current.push(e))}]}({}),[J,Q]=(0,i.Z)(()=>$()),ee=(e,t)=>{Y(n=>{let o=Object.assign({},n),a=[].concat((0,r.Z)(e.name.slice(0,-1)),(0,r.Z)(t)).join("__SPLIT__");return e.destroy?delete o[a]:o[a]=e,o})},[et,en]=o.useMemo(()=>{let e=(0,r.Z)(J.errors),t=(0,r.Z)(J.warnings);return Object.values(K).forEach(n=>{e.push.apply(e,(0,r.Z)(n.errors||[])),t.push.apply(t,(0,r.Z)(n.warnings||[]))}),[e,t]},[K,J.errors,J.warnings]),er=function(){let{itemRef:e}=o.useContext(f.q3),t=o.useRef({});return function(n,r){let o=r&&"object"==typeof r&&r.ref,a=n.join("_");return(t.current.name!==a||t.current.originRef!==o)&&(t.current.name=a,t.current.originRef=o,t.current.ref=(0,s.sQ)(e(n),o)),t.current.ref}}();function eo(t,r,c){return n&&!I?o.createElement(B,{prefixCls:W,hasFeedback:e.hasFeedback,validateStatus:e.validateStatus,meta:J,errors:et,warnings:en,noStyle:!0},t):o.createElement(G,Object.assign({key:"row"},e,{className:l()(a,V,H,D),prefixCls:W,fieldId:r,isRequired:c,errors:et,warnings:en,meta:J,onSubItemMetaChange:ee}),t)}if(!L&&!F&&!h)return z(eo(R));let ea={};return"string"==typeof C?ea.label=C:t&&(ea.label=String(t)),j&&(ea=Object.assign(Object.assign({},ea),j)),z(o.createElement(c.gN,Object.assign({},e,{messageVariables:ea,trigger:S,validateTrigger:T,onMetaChange:e=>{let t=null==A?void 0:A.getKey(e.name);if(Q(e.destroy?$():e,!0),n&&!1!==N&&P){let n=e.name;if(e.destroy)n=X.current||n;else if(void 0!==t){let[e,o]=t;n=[e].concat((0,r.Z)(o)),X.current=n}P(e,n)}}}),(n,a,l)=>{let c=(0,y.qo)(t).length&&a?a.name:[],i=(0,y.dD)(c,q),u=void 0!==O?O:!!(E&&E.some(e=>{if(e&&"object"==typeof e&&e.required&&!e.warningOnly)return!0;if("function"==typeof e){let t=e(l);return t&&t.required&&!t.warningOnly}return!1})),m=Object.assign({},n),p=null;if(Array.isArray(R)&&L)p=R;else if(F&&(!(w||h)||L));else if(!h||F||L){if((0,d.l$)(R)){let t=Object.assign(Object.assign({},R.props),m);if(t.id||(t.id=i),N||et.length>0||en.length>0||e.extra){let n=[];(N||et.length>0)&&n.push("".concat(i,"_help")),e.extra&&n.push("".concat(i,"_extra")),t["aria-describedby"]=n.join(" ")}et.length>0&&(t["aria-invalid"]="true"),u&&(t["aria-required"]="true"),(0,s.Yr)(R)&&(t.ref=er(c,R)),new Set([].concat((0,r.Z)((0,y.qo)(S)),(0,r.Z)((0,y.qo)(T)))).forEach(e=>{t[e]=function(){for(var t,n,r,o=arguments.length,a=Array(o),l=0;l{let t=setTimeout(()=>{n(e)},e.length?0:10);return()=>{clearTimeout(t)}},[e]),t}},60620:function(e,t,n){n.d(t,{Z:function(){return N}});var r=n(30367),o=n(64090),a=n(16480),l=n.n(a),c=n(76570),i=n(57499),s=n(17094),d=n(92935),u=n(10693),m=n(97303),p=n(47137);let f=e=>"object"==typeof e&&null!=e&&1===e.nodeType,g=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,h=(e,t)=>{if(e.clientHeight{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeightat||a>e&&l=t&&c>=n?a-e-r:l>t&&cn?l-t+o:0,v=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},y=(e,t)=>{var n,r,o,a;if("undefined"==typeof document)return[];let{scrollMode:l,block:c,inline:i,boundary:s,skipOverflowHiddenElements:d}=t,u="function"==typeof s?s:e=>e!==s;if(!f(e))throw TypeError("Invalid target");let m=document.scrollingElement||document.documentElement,p=[],g=e;for(;f(g)&&u(g);){if((g=v(g))===m){p.push(g);break}null!=g&&g===document.body&&h(g)&&!h(document.documentElement)||null!=g&&h(g,d)&&p.push(g)}let y=null!=(r=null==(n=window.visualViewport)?void 0:n.width)?r:innerWidth,x=null!=(a=null==(o=window.visualViewport)?void 0:o.height)?a:innerHeight,{scrollX:w,scrollY:E}=window,{height:k,width:O,top:C,right:j,bottom:S,left:M}=e.getBoundingClientRect(),{top:I,right:N,bottom:Z,left:q}=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e),R="start"===c||"nearest"===c?C-I:"end"===c?S+Z:C+k/2-I+Z,F="center"===i?M+O/2-q+N:"end"===i?j+N:M-q,P=[];for(let e=0;e=0&&M>=0&&S<=x&&j<=y&&C>=o&&S<=s&&M>=d&&j<=a)break;let u=getComputedStyle(t),f=parseInt(u.borderLeftWidth,10),g=parseInt(u.borderTopWidth,10),h=parseInt(u.borderRightWidth,10),v=parseInt(u.borderBottomWidth,10),I=0,N=0,Z="offsetWidth"in t?t.offsetWidth-t.clientWidth-f-h:0,q="offsetHeight"in t?t.offsetHeight-t.clientHeight-g-v:0,_="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,T="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(m===t)I="start"===c?R:"end"===c?R-x:"nearest"===c?b(E,E+x,x,g,v,E+R,E+R+k,k):R-x/2,N="start"===i?F:"center"===i?F-y/2:"end"===i?F-y:b(w,w+y,y,f,h,w+F,w+F+O,O),I=Math.max(0,I+E),N=Math.max(0,N+w);else{I="start"===c?R-o-g:"end"===c?R-s+v+q:"nearest"===c?b(o,s,n,g,v+q,R,R+k,k):R-(o+n/2)+q/2,N="start"===i?F-d-f:"center"===i?F-(d+r/2)+Z/2:"end"===i?F-a+h+Z:b(d,a,r,f,h+Z,F,F+O,O);let{scrollLeft:e,scrollTop:l}=t;I=0===T?0:Math.max(0,Math.min(l+I/T,t.scrollHeight-n/T+q)),N=0===_?0:Math.max(0,Math.min(e+N/_,t.scrollWidth-r/_+Z)),R+=l-I,F+=e-N}P.push({el:t,top:I,left:N})}return P},x=e=>!1===e?{block:"end",inline:"nearest"}:e===Object(e)&&0!==Object.keys(e).length?e:{block:"start",inline:"nearest"};var w=n(47276);function E(e){return(0,w.qo)(e).join("_")}function k(e){let[t]=(0,c.cI)(),n=o.useRef({}),r=o.useMemo(()=>null!=e?e:Object.assign(Object.assign({},t),{__INTERNAL__:{itemRef:e=>t=>{let r=E(e);t?n.current[r]=t:delete n.current[r]}},scrollToField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,w.qo)(e),o=(0,w.dD)(n,r.__INTERNAL__.name),a=o?document.getElementById(o):null;a&&function(e,t){if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let n=(e=>{let t=window.getComputedStyle(e);return{top:parseFloat(t.scrollMarginTop)||0,right:parseFloat(t.scrollMarginRight)||0,bottom:parseFloat(t.scrollMarginBottom)||0,left:parseFloat(t.scrollMarginLeft)||0}})(e);if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(y(e,t));let r="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:o,top:a,left:l}of y(e,x(t))){let e=a-n.top+n.bottom,t=l-n.left+n.right;o.scroll({top:e,left:t,behavior:r})}}(a,Object.assign({scrollMode:"if-needed",block:"nearest"},t))},getFieldInstance:e=>{let t=E(e);return n.current[t]}}),[e,t]);return[r]}var O=n(77906),C=n(12519),j=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};let S=o.forwardRef((e,t)=>{let n=o.useContext(s.Z),{getPrefixCls:r,direction:a,form:f}=o.useContext(i.E_),{prefixCls:g,className:h,rootClassName:b,size:v,disabled:y=n,form:x,colon:w,labelAlign:E,labelWrap:S,labelCol:M,wrapperCol:I,hideRequiredMark:N,layout:Z="horizontal",scrollToFirstError:q,requiredMark:R,onFinishFailed:F,name:P,style:_,feedbackIcons:T,variant:L}=e,W=j(e,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons","variant"]),H=(0,u.Z)(v),z=o.useContext(C.Z),D=(0,o.useMemo)(()=>void 0!==R?R:!N&&(!f||void 0===f.requiredMark||f.requiredMark),[N,R,f]),V=null!=w?w:null==f?void 0:f.colon,A=r("form",g),B=(0,d.Z)(A),[X,G,U]=(0,O.ZP)(A,B),$=l()(A,"".concat(A,"-").concat(Z),{["".concat(A,"-hide-required-mark")]:!1===D,["".concat(A,"-rtl")]:"rtl"===a,["".concat(A,"-").concat(H)]:H},U,B,G,null==f?void 0:f.className,h,b),[K]=k(x),{__INTERNAL__:Y}=K;Y.name=P;let J=(0,o.useMemo)(()=>({name:P,labelAlign:E,labelCol:M,labelWrap:S,wrapperCol:I,vertical:"vertical"===Z,colon:V,requiredMark:D,itemRef:Y.itemRef,form:K,feedbackIcons:T}),[P,E,M,I,Z,V,D,K,T]);o.useImperativeHandle(t,()=>K);let Q=(e,t)=>{if(e){let n={block:"nearest"};"object"==typeof e&&(n=e),K.scrollToField(t,n)}};return X(o.createElement(p.pg.Provider,{value:L},o.createElement(s.n,{disabled:y},o.createElement(m.Z.Provider,{value:H},o.createElement(p.RV,{validateMessages:z},o.createElement(p.q3.Provider,{value:J},o.createElement(c.ZP,Object.assign({id:P},W,{name:P,onFinishFailed:e=>{if(null==F||F(e),e.errorFields.length){let t=e.errorFields[0].name;if(void 0!==q){Q(q,t);return}f&&void 0!==f.scrollToFirstError&&Q(f.scrollToFirstError,t)}},form:K,style:Object.assign(Object.assign({},null==f?void 0:f.style),_),className:$}))))))))});var M=n(84406),I=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};S.Item=M.Z,S.List=e=>{var{prefixCls:t,children:n}=e,r=I(e,["prefixCls","children"]);let{getPrefixCls:a}=o.useContext(i.E_),l=a("form",t),s=o.useMemo(()=>({prefixCls:l,status:"error"}),[l]);return o.createElement(c.aV,Object.assign({},r),(e,t,r)=>o.createElement(p.Rk.Provider,{value:s},n(e.map(e=>Object.assign(Object.assign({},e),{fieldKey:e.key})),t,{errors:r.errors,warnings:r.warnings})))},S.ErrorList=r.Z,S.useForm=k,S.useFormInstance=function(){let{form:e}=(0,o.useContext)(p.q3);return e},S.useWatch=c.qo,S.Provider=p.RV,S.create=()=>{};var N=S},77906:function(e,t,n){n.d(t,{ZP:function(){return x},B4:function(){return y}});var r=n(8985),o=n(11303),a=n(58854),l=n(46154),c=n(80316),i=n(76585),s=e=>{let{componentCls:t}=e,n="".concat(t,"-show-help"),r="".concat(t,"-show-help-item");return{[n]:{transition:"opacity ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[r]:{overflow:"hidden",transition:"height ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,",\n transform ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut," !important"),["&".concat(r,"-appear, &").concat(r,"-enter")]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},["&".concat(r,"-leave-active")]:{transform:"translateY(-5px)"}}}}};let d=e=>({legend:{display:"block",width:"100%",marginBottom:e.marginLG,padding:0,color:e.colorTextDescription,fontSize:e.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:"".concat((0,r.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder)},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:"0 0 0 ".concat((0,r.bf)(e.controlOutlineWidth)," ").concat(e.controlOutline)},output:{display:"block",paddingTop:15,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight}}),u=(e,t)=>{let{formItemCls:n}=e;return{[n]:{["".concat(n,"-label > label")]:{height:t},["".concat(n,"-control-input")]:{minHeight:t}}}},m=e=>{let{componentCls:t}=e;return{[e.componentCls]:Object.assign(Object.assign(Object.assign({},(0,o.Wf)(e)),d(e)),{["".concat(t,"-text")]:{display:"inline-block",paddingInlineEnd:e.paddingSM},"&-small":Object.assign({},u(e,e.controlHeightSM)),"&-large":Object.assign({},u(e,e.controlHeightLG))})}},p=e=>{let{formItemCls:t,iconCls:n,componentCls:r,rootPrefixCls:l,labelRequiredMarkColor:c,labelColor:i,labelFontSize:s,labelHeight:d,labelColonMarginInlineStart:u,labelColonMarginInlineEnd:m,itemMarginBottom:p}=e;return{[t]:Object.assign(Object.assign({},(0,o.Wf)(e)),{marginBottom:p,verticalAlign:"top","&-with-help":{transition:"none"},["&-hidden,\n &-hidden.".concat(l,"-row")]:{display:"none"},"&-has-warning":{["".concat(t,"-split")]:{color:e.colorError}},"&-has-error":{["".concat(t,"-split")]:{color:e.colorWarning}},["".concat(t,"-label")]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:e.lineHeight,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:d,color:i,fontSize:s,["> ".concat(n)]:{fontSize:e.fontSize,verticalAlign:"top"},["&".concat(t,"-required:not(").concat(t,"-required-mark-optional)::before")]:{display:"inline-block",marginInlineEnd:e.marginXXS,color:c,fontSize:e.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-optional")]:{display:"inline-block",marginInlineStart:e.marginXXS,color:e.colorTextDescription,["".concat(r,"-hide-required-mark &")]:{display:"none"}},["".concat(t,"-tooltip")]:{color:e.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:e.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:u,marginInlineEnd:m},["&".concat(t,"-no-colon::after")]:{content:'"\\a0"'}}},["".concat(t,"-control")]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,["&:first-child:not([class^=\"'".concat(l,"-col-'\"]):not([class*=\"' ").concat(l,"-col-'\"])")]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:e.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[t]:{"&-explain, &-extra":{clear:"both",color:e.colorTextDescription,fontSize:e.fontSize,lineHeight:e.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:e.controlHeightSM,transition:"color ".concat(e.motionDurationMid," ").concat(e.motionEaseOut)},"&-explain":{"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning}}},["&-with-help ".concat(t,"-explain")]:{height:"auto",opacity:1},["".concat(t,"-feedback-icon")]:{fontSize:e.fontSize,textAlign:"center",visibility:"visible",animationName:a.kr,animationDuration:e.motionDurationMid,animationTimingFunction:e.motionEaseOutBack,pointerEvents:"none","&-success":{color:e.colorSuccess},"&-error":{color:e.colorError},"&-warning":{color:e.colorWarning},"&-validating":{color:e.colorPrimary}}})}},f=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-horizontal")]:{["".concat(n,"-label")]:{flexGrow:0},["".concat(n,"-control")]:{flex:"1 1 0",minWidth:0},["".concat(n,"-label[class$='-24'], ").concat(n,"-label[class*='-24 ']")]:{["& + ".concat(n,"-control")]:{minWidth:"unset"}}}}},g=e=>{let{componentCls:t,formItemCls:n}=e;return{["".concat(t,"-inline")]:{display:"flex",flexWrap:"wrap",[n]:{flex:"none",marginInlineEnd:e.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},["> ".concat(n,"-label,\n > ").concat(n,"-control")]:{display:"inline-block",verticalAlign:"top"},["> ".concat(n,"-label")]:{flex:"none"},["".concat(t,"-text")]:{display:"inline-block"},["".concat(n,"-has-feedback")]:{display:"inline-block"}}}}},h=e=>({padding:e.verticalLabelPadding,margin:e.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),b=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:r}=e;return{["".concat(n," ").concat(n,"-label")]:h(e),["".concat(t,":not(").concat(t,"-inline)")]:{[n]:{flexWrap:"wrap",["".concat(n,"-label, ").concat(n,"-control")]:{['&:not([class*=" '.concat(r,'-col-xs"])')]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},v=e=>{let{componentCls:t,formItemCls:n,rootPrefixCls:o}=e;return{["".concat(t,"-vertical")]:{[n]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},["".concat(t,"-item-control")]:{width:"100%"}}},["".concat(t,"-vertical ").concat(n,"-label,\n .").concat(o,"-col-24").concat(n,"-label,\n .").concat(o,"-col-xl-24").concat(n,"-label")]:h(e),["@media (max-width: ".concat((0,r.bf)(e.screenXSMax),")")]:[b(e),{[t]:{[".".concat(o,"-col-xs-24").concat(n,"-label")]:h(e)}}],["@media (max-width: ".concat((0,r.bf)(e.screenSMMax),")")]:{[t]:{[".".concat(o,"-col-sm-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenMDMax),")")]:{[t]:{[".".concat(o,"-col-md-24").concat(n,"-label")]:h(e)}},["@media (max-width: ".concat((0,r.bf)(e.screenLGMax),")")]:{[t]:{[".".concat(o,"-col-lg-24").concat(n,"-label")]:h(e)}}}},y=(e,t)=>(0,c.TS)(e,{formItemCls:"".concat(e.componentCls,"-item"),rootPrefixCls:t});var x=(0,i.I$)("Form",(e,t)=>{let{rootPrefixCls:n}=t,r=y(e,n);return[m(r),p(r),s(r),f(r),g(r),v(r),(0,l.Z)(r),a.kr]},e=>({labelRequiredMarkColor:e.colorError,labelColor:e.colorTextHeading,labelFontSize:e.fontSize,labelHeight:e.controlHeight,labelColonMarginInlineStart:e.marginXXS/2,labelColonMarginInlineEnd:e.marginXS,itemMarginBottom:e.marginLG,verticalLabelPadding:"0 0 ".concat(e.paddingXS,"px"),verticalLabelMargin:0}),{order:-1e3})},47276:function(e,t,n){n.d(t,{dD:function(){return a},lR:function(){return l},qo:function(){return o}});let r=["parentNode"];function o(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function a(e,t){if(!e.length)return;let n=e.join("_");return t?"".concat(t,"_").concat(n):r.includes(n)?"".concat("form_item","_").concat(n):n}function l(e,t,n,r,o,a){let l=r;return void 0!==a?l=a:n.validating?l="validating":e.length?l="error":t.length?l="warning":(n.touched||o&&n.validated)&&(l="success"),l}},24305:function(e,t,n){let r=(0,n(64090).createContext)({});t.Z=r},90791:function(e,t,n){var r=n(64090),o=n(16480),a=n.n(o),l=n(57499),c=n(24305),i=n(37148),s=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};let d=["xs","sm","md","lg","xl","xxl"],u=r.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o}=r.useContext(l.E_),{gutter:u,wrap:m}=r.useContext(c.Z),{prefixCls:p,span:f,order:g,offset:h,push:b,pull:v,className:y,children:x,flex:w,style:E}=e,k=s(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),O=n("col",p),[C,j,S]=(0,i.cG)(O),M={};d.forEach(t=>{let n={},r=e[t];"number"==typeof r?n.span=r:"object"==typeof r&&(n=r||{}),delete k[t],M=Object.assign(Object.assign({},M),{["".concat(O,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(O,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(O,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(O,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(O,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(O,"-").concat(t,"-flex-").concat(n.flex)]:n.flex||"auto"===n.flex,["".concat(O,"-rtl")]:"rtl"===o})});let I=a()(O,{["".concat(O,"-").concat(f)]:void 0!==f,["".concat(O,"-order-").concat(g)]:g,["".concat(O,"-offset-").concat(h)]:h,["".concat(O,"-push-").concat(b)]:b,["".concat(O,"-pull-").concat(v)]:v},y,M,j,S),N={};if(u&&u[0]>0){let e=u[0]/2;N.paddingLeft=e,N.paddingRight=e}return w&&(N.flex="number"==typeof w?"".concat(w," ").concat(w," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(w)?"0 0 ".concat(w):w,!1!==m||N.minWidth||(N.minWidth=0)),C(r.createElement("div",Object.assign({},k,{style:Object.assign(Object.assign({},N),E),className:I,ref:t}),x))});t.Z=u},5056:function(e,t,n){n.d(t,{Z:function(){return g}});var r=n(64090),o=n(16480),a=n.n(o),l=n(24750);let c=["xxl","xl","lg","md","sm","xs"],i=e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}),s=e=>{let t=[].concat(c).reverse();return t.forEach((n,r)=>{let o=n.toUpperCase(),a="screen".concat(o,"Min"),l="screen".concat(o);if(!(e[a]<=e[l]))throw Error("".concat(a,"<=").concat(l," fails : !(").concat(e[a],"<=").concat(e[l],")"));if(rt.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};function f(e,t){let[n,o]=r.useState("string"==typeof e?e:""),a=()=>{if("string"==typeof e&&o(e),"object"==typeof e)for(let n=0;n{a()},[JSON.stringify(e),t]),n}var g=r.forwardRef((e,t)=>{let{prefixCls:n,justify:o,align:g,className:h,style:b,children:v,gutter:y=0,wrap:x}=e,w=p(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:E,direction:k}=r.useContext(d.E_),[O,C]=r.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[j,S]=r.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),M=f(g,j),I=f(o,j),N=r.useRef(y),Z=function(){let[,e]=(0,l.ZP)(),t=i(s(e));return r.useMemo(()=>{let e=new Map,n=-1,r={};return{matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},unregister(){Object.keys(t).forEach(e=>{let n=t[e],r=this.matchHandlers[n];null==r||r.mql.removeListener(null==r?void 0:r.listener)}),e.clear()},register(){Object.keys(t).forEach(e=>{let n=t[e],o=t=>{let{matches:n}=t;this.dispatch(Object.assign(Object.assign({},r),{[e]:n}))},a=window.matchMedia(n);a.addListener(o),this.matchHandlers[n]={mql:a,listener:o},o(a)})},responsiveMap:t}},[e])}();r.useEffect(()=>{let e=Z.subscribe(e=>{S(e);let t=N.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&C(e)});return()=>Z.unsubscribe(e)},[]);let q=E("row",n),[R,F,P]=(0,m.VM)(q),_=(()=>{let e=[void 0,void 0];return(Array.isArray(y)?y:[y,void 0]).forEach((t,n)=>{if("object"==typeof t)for(let r=0;r0?-(_[0]/2):void 0;W&&(L.marginLeft=W,L.marginRight=W),[,L.rowGap]=_;let[H,z]=_,D=r.useMemo(()=>({gutter:[H,z],wrap:x}),[H,z,x]);return R(r.createElement(u.Z.Provider,{value:D},r.createElement("div",Object.assign({},w,{className:T,style:Object.assign(Object.assign({},L),b),ref:t}),v)))})},37148:function(e,t,n){n.d(t,{VM:function(){return d},cG:function(){return u}});var r=n(8985),o=n(76585),a=n(80316);let l=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},c=(e,t)=>{let{componentCls:n,gridColumns:r}=e,o={};for(let e=r;e>=0;e--)0===e?(o["".concat(n).concat(t,"-").concat(e)]={display:"none"},o["".concat(n,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"auto"},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"auto"},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:0},o["".concat(n).concat(t,"-order-").concat(e)]={order:0}):(o["".concat(n).concat(t,"-").concat(e)]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:"0 0 ".concat(e/r*100,"%"),maxWidth:"".concat(e/r*100,"%")}],o["".concat(n).concat(t,"-push-").concat(e)]={insetInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-pull-").concat(e)]={insetInlineEnd:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-offset-").concat(e)]={marginInlineStart:"".concat(e/r*100,"%")},o["".concat(n).concat(t,"-order-").concat(e)]={order:e});return o},i=(e,t)=>c(e,t),s=(e,t,n)=>({["@media (min-width: ".concat((0,r.bf)(t),")")]:Object.assign({},i(e,n))}),d=(0,o.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,o.I$)("Grid",e=>{let t=(0,a.TS)(e,{gridColumns:24}),n={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[l(t),i(t,""),i(t,"-xs"),Object.keys(n).map(e=>s(t,n[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},46154:function(e,t){t.Z=e=>({[e.componentCls]:{["".concat(e.antCls,"-motion-collapse-legacy")]:{overflow:"hidden","&-active":{transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}},["".concat(e.antCls,"-motion-collapse")]:{overflow:"hidden",transition:"height ".concat(e.motionDurationMid," ").concat(e.motionEaseInOut,",\n opacity ").concat(e.motionDurationMid," ").concat(e.motionEaseInOut," !important")}}})},37963:function(e,t,n){n.d(t,{o:function(){return o}});class r extends Error{}function o(e,t){let n;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let o=!0===t.header?0:1,a=e.split(".")[o];if("string"!=typeof a)throw new r("Invalid token specified: missing part #".concat(o+1));try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var n;return n=t,decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return atob(t)}}(a)}catch(e){throw new r("Invalid token specified: invalid base64 for part #".concat(o+1," (").concat(e.message,")"))}try{return JSON.parse(n)}catch(e){throw new r("Invalid token specified: invalid json for part #".concat(o+1," (").concat(e.message,")"))}}r.prototype.name="InvalidTokenError"}}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js b/ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
similarity index 95%
rename from litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js
rename to ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
index f2cde7c99..491420a5f 100644
--- a/litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js
+++ b/ui/litellm-dashboard/out/_next/static/chunks/app/onboarding/page-3c7091570f67cd10.js
@@ -1 +1 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{61994:function(e,s,l){Promise.resolve().then(l.bind(l,667))},667:function(e,s,l){"use strict";l.r(s),l.d(s,{default:function(){return Z}});var t=l(3827),a=l(64090),r=l(47907),n=l(16450),i=l(18190),o=l(13810),u=l(10384),c=l(46453),d=l(71801),m=l(52273),h=l(42440),x=l(30953),f=l(777),j=l(37963),p=l(81583),g=l(1861);function Z(){let[e]=p.Z.useForm(),s=(0,r.useSearchParams)();s.get("token");let l=s.get("id"),[Z,_]=(0,a.useState)(null),[b,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(""),[S,y]=(0,a.useState)(""),[v,E]=(0,a.useState)("");return(0,a.useEffect)(()=>{l&&(0,f.W_)(l).then(e=>{let s=e.login_url;console.log("login_url:",s),y(s);let l=e.token,t=(0,j.o)(l);E(l),console.log("decoded:",t),_(t.key),console.log("decoded user email:",t.user_email),k(t.user_email)})},[l]),(0,t.jsx)("div",{className:"mx-auto max-w-md mt-10",children:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(h.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,t.jsx)(h.Z,{className:"text-xl",children:"Sign up"}),(0,t.jsx)(d.Z,{children:"Claim your user account to login to Admin UI."}),(0,t.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,t.jsxs)(c.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,t.jsx)(u.Z,{children:"SSO is under the Enterprise Tirer."}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,t.jsxs)(p.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",Z,"token:",v,"formValues:",e),Z&&v&&(e.user_email=N,(0,f.pf)(Z,e,null).then(e=>{var s;let l="/ui/";console.log("redirecting to:",l+="?userID="+((null===(s=e.data)||void 0===s?void 0:s.user_id)||e.user_id)+"&token="+v),window.location.href=l}))},children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(m.Z,{type:"email",disabled:!0,value:N,defaultValue:N,className:"max-w-md"})}),(0,t.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"Create a password for your account",children:(0,t.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Sign Up"})})]})]})})}}},function(e){e.O(0,[665,294,235,777,971,69,744],function(){return e(e.s=61994)}),_N_E=e.O()}]);
\ No newline at end of file
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{61994:function(e,s,l){Promise.resolve().then(l.bind(l,667))},667:function(e,s,l){"use strict";l.r(s),l.d(s,{default:function(){return Z}});var t=l(3827),a=l(64090),r=l(47907),n=l(16450),i=l(18190),o=l(13810),u=l(10384),c=l(46453),d=l(71801),m=l(52273),h=l(42440),x=l(30953),f=l(777),j=l(37963),p=l(60620),g=l(1861);function Z(){let[e]=p.Z.useForm(),s=(0,r.useSearchParams)();s.get("token");let l=s.get("id"),[Z,_]=(0,a.useState)(null),[b,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(""),[S,y]=(0,a.useState)(""),[v,E]=(0,a.useState)("");return(0,a.useEffect)(()=>{l&&(0,f.W_)(l).then(e=>{let s=e.login_url;console.log("login_url:",s),y(s);let l=e.token,t=(0,j.o)(l);E(l),console.log("decoded:",t),_(t.key),console.log("decoded user email:",t.user_email),k(t.user_email)})},[l]),(0,t.jsx)("div",{className:"mx-auto max-w-md mt-10",children:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(h.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,t.jsx)(h.Z,{className:"text-xl",children:"Sign up"}),(0,t.jsx)(d.Z,{children:"Claim your user account to login to Admin UI."}),(0,t.jsx)(i.Z,{className:"mt-4",title:"SSO",icon:x.GH$,color:"sky",children:(0,t.jsxs)(c.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,t.jsx)(u.Z,{children:"SSO is under the Enterprise Tirer."}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(n.Z,{variant:"primary",className:"mb-2",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,t.jsxs)(p.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",Z,"token:",v,"formValues:",e),Z&&v&&(e.user_email=N,(0,f.pf)(Z,e,null).then(e=>{var s;let l="/ui/";console.log("redirecting to:",l+="?userID="+((null===(s=e.data)||void 0===s?void 0:s.user_id)||e.user_id)+"&token="+v),window.location.href=l}))},children:[(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z.Item,{label:"Email Address",name:"user_email",children:(0,t.jsx)(m.Z,{type:"email",disabled:!0,value:N,defaultValue:N,className:"max-w-md"})}),(0,t.jsx)(p.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"Create a password for your account",children:(0,t.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,t.jsx)("div",{className:"mt-10",children:(0,t.jsx)(g.ZP,{htmlType:"submit",children:"Sign Up"})})]})]})})}}},function(e){e.O(0,[665,294,684,777,971,69,744],function(){return e(e.s=61994)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/chunks/app/page-42570e92ea8bcf56.js b/ui/litellm-dashboard/out/_next/static/chunks/app/page-42570e92ea8bcf56.js
deleted file mode 100644
index 1341da953..000000000
--- a/ui/litellm-dashboard/out/_next/static/chunks/app/page-42570e92ea8bcf56.js
+++ /dev/null
@@ -1 +0,0 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{20661:function(e,l,s){Promise.resolve().then(s.bind(s,30217))},30217:function(e,l,s){"use strict";s.r(l),s.d(l,{default:function(){return le}});var t,n,a=s(3827),r=s(64090),i=s(47907),o=s(8792),d=s(40491),c=s(65270),m=e=>{let{userID:l,userRole:s,userEmail:t,showSSOBanner:n,premiumUser:r}=e;console.log("User ID:",l),console.log("userEmail:",t),console.log("showSSOBanner:",n),console.log("premiumUser:",r);let i=[{key:"1",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:["Role: ",s]}),(0,a.jsxs)("p",{children:["ID: ",l]}),(0,a.jsxs)("p",{children:["Premium User: ",String(r)]})]})},{key:"2",label:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("p",{children:"Logout"})})}];return(0,a.jsxs)("nav",{className:"left-0 right-0 top-0 flex justify-between items-center h-12 mb-4",children:[(0,a.jsx)("div",{className:"text-left my-2 absolute top-0 left-0",children:(0,a.jsx)("div",{className:"flex flex-col items-center",children:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("button",{className:"text-gray-800 rounded text-center",children:(0,a.jsx)("img",{src:"/get_image",width:160,height:160,alt:"LiteLLM Brand",className:"mr-2"})})})})}),(0,a.jsxs)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0 flex items-center justify-end space-x-2",children:[n?(0,a.jsx)("div",{style:{padding:"6px",borderRadius:"8px"},children:(0,a.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",style:{fontSize:"14px",textDecoration:"underline"},children:"Get enterpise license"})}):null,(0,a.jsx)("div",{style:{border:"1px solid #391085",padding:"6px",borderRadius:"8px"},children:(0,a.jsx)(d.Z,{menu:{items:i},children:(0,a.jsx)(c.Z,{children:t})})})]})]})},u=s(777),h=s(10384),x=s(46453),p=s(16450),j=s(52273),g=s(26780),Z=s(15595),_=s(6698),f=s(71801),y=s(42440),b=s(42308),v=s(50670),S=s(81583),k=s(80588),w=s(99129),N=s(44839),A=s(88707),I=s(1861);let{Option:C}=v.default;var E=e=>{let{userID:l,team:s,userRole:t,accessToken:n,data:i,setData:o}=e,[d]=S.Z.useForm(),[c,m]=(0,r.useState)(!1),[E,P]=(0,r.useState)(null),[T,O]=(0,r.useState)(null),[F,R]=(0,r.useState)([]),[M,L]=(0,r.useState)([]),U=()=>{m(!1),d.resetFields()},D=()=>{m(!1),P(null),d.resetFields()};(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===t)return;if(null!==n){let e=(await (0,u.So)(n,l,t)).data.map(e=>e.id);console.log("available_model_names:",e),R(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,t]);let K=async e=>{try{var s,t,a;let r=null!==(s=null==e?void 0:e.key_alias)&&void 0!==s?s:"",c=null!==(t=null==e?void 0:e.team_id)&&void 0!==t?t:null;if((null!==(a=null==i?void 0:i.filter(e=>e.team_id===c).map(e=>e.key_alias))&&void 0!==a?a:[]).includes(r))throw Error("Key alias ".concat(r," already exists for team with ID ").concat(c,", please provide another key alias"));k.ZP.info("Making API Call"),m(!0);let h=await (0,u.wX)(n,l,e);console.log("key create Response:",h),o(e=>e?[...e,h]:[h]),P(h.key),O(h.soft_budget),k.ZP.success("API Key Created"),d.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,r.useEffect)(()=>{L(s&&s.models.length>0?s.models.includes("all-proxy-models")?F:s.models:F)},[s,F]),(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>m(!0),children:"+ Create New Key"}),(0,a.jsx)(w.Z,{title:"Create Key",visible:c,width:800,footer:null,onOk:U,onCancel:D,children:(0,a.jsxs)(S.Z,{form:d,onFinish:K,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",hidden:!0,initialValue:s?s.team_id:null,valuePropName:"team_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s?s.team_alias:"",disabled:!0})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},onChange:e=>{e.includes("all-team-models")&&d.setFieldsValue({models:["all-team-models"]})},children:[(0,a.jsx)(C,{value:"all-team-models",children:"All Team Models"},"all-team-models"),M.map(e=>(0,a.jsx)(C,{value:e,children:e},e))]})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(_.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==s?void 0:s.max_budget)!==null&&(null==s?void 0:s.max_budget)!==void 0?null==s?void 0:s.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.max_budget&&l>s.max_budget)throw Error("Budget cannot exceed team max budget: $".concat(s.max_budget))}}],children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",help:"Team Reset Budget: ".concat((null==s?void 0:s.budget_duration)!==null&&(null==s?void 0:s.budget_duration)!==void 0?null==s?void 0:s.budget_duration:"None"),children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Tokens per minute Limit (TPM)",name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==s?void 0:s.tpm_limit)!==null&&(null==s?void 0:s.tpm_limit)!==void 0?null==s?void 0:s.tpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.tpm_limit&&l>s.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(s.tpm_limit))}}],children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Requests per minute Limit (RPM)",name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==s?void 0:s.rpm_limit)!==null&&(null==s?void 0:s.rpm_limit)!==void 0?null==s?void 0:s.rpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.rpm_limit&&l>s.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(s.rpm_limit))}}],children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Expire Key (eg: 30s, 30h, 30d)",name:"duration",className:"mt-8",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",className:"mt-8",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Key"})})]})}),E&&(0,a.jsx)(w.Z,{visible:c,onOk:U,onCancel:D,footer:null,children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Save your Key"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons, ",(0,a.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,a.jsx)(h.Z,{numColSpan:1,children:null!=E?(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mt-3",children:"API Key:"}),(0,a.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,a.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:E})}),(0,a.jsx)(b.CopyToClipboard,{text:E,onCopy:()=>{k.ZP.success("API Key copied to clipboard")},children:(0,a.jsx)(p.Z,{className:"mt-3",children:"Copy API Key"})})]}):(0,a.jsx)(f.Z,{children:"Key being created, this might take 30s"})})]})})]})},P=s(9454),T=s(98941),O=s(33393),F=s(5),R=s(13810),M=s(61244),L=s(10827),U=s(3851),D=s(2044),K=s(64167),q=s(74480),B=s(7178),V=s(95093),z=s(27166);let{Option:W}=v.default;var G=e=>{let{userID:l,userRole:s,accessToken:t,selectedTeam:n,data:i,setData:o,teams:d}=e,[c,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(!1),[j,g]=(0,r.useState)(null),[Z,_]=(0,r.useState)(null),[b,C]=(0,r.useState)(null),[E,G]=(0,r.useState)(""),[H,Y]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),[$,Q]=(0,r.useState)(null),[ee,el]=(0,r.useState)([]),es=new Set,[et,en]=(0,r.useState)(es);(0,r.useEffect)(()=>{(async()=>{try{if(null===l)return;if(null!==t&&null!==s){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),el(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[t,l,s]),(0,r.useEffect)(()=>{if(d){let e=new Set;d.forEach((l,s)=>{let t=l.team_id;e.add(t)}),en(e)}},[d]);let ea=e=>{console.log("handleEditClick:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),Q(e),Y(!0)},er=async e=>{if(null==t)return;let l=e.token;e.key=l,console.log("handleEditSubmit:",e);let s=await (0,u.Nc)(t,e);console.log("handleEditSubmit: newKeyValues",s),i&&o(i.map(e=>e.token===l?s:e)),k.ZP.success("Key updated successfully"),Y(!1),Q(null)},ei=async e=>{console.log("handleDelete:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),null!=i&&(g(e.token),localStorage.removeItem("userData"+l),x(!0))},eo=async()=>{if(null!=j&&null!=i){try{await (0,u.I1)(t,j);let e=i.filter(e=>e.token!==j);o(e)}catch(e){console.error("Error deleting the key:",e)}x(!1),g(null)}};if(null!=i)return console.log("RERENDER TRIGGERED"),(0,a.jsxs)("div",{children:[(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4 mt-2",children:[(0,a.jsxs)(L.Z,{className:"mt-5 max-h-[300px] min-h-[300px]",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Key Alias"}),(0,a.jsx)(q.Z,{children:"Secret Key"}),(0,a.jsx)(q.Z,{children:"Spend (USD)"}),(0,a.jsx)(q.Z,{children:"Budget (USD)"}),(0,a.jsx)(q.Z,{children:"Models"}),(0,a.jsx)(q.Z,{children:"TPM / RPM Limits"})]})}),(0,a.jsx)(U.Z,{children:i.map(e=>{if(console.log(e),"litellm-dashboard"===e.team_id)return null;if(n){if(console.log("item team id: ".concat(e.team_id,", knownTeamIDs.has(item.team_id): ").concat(et.has(e.team_id),", selectedTeam id: ").concat(n.team_id)),(null!=n.team_id||null===e.team_id||et.has(e.team_id))&&e.team_id!=n.team_id)return null;console.log("item team id: ".concat(e.team_id,", is returned"))}return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{style:{maxWidth:"2px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!=e.key_alias?(0,a.jsx)(f.Z,{children:e.key_alias}):(0,a.jsx)(f.Z,{children:"Not Set"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:e.key_name})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:(()=>{try{return parseFloat(e.spend).toFixed(4)}catch(l){return e.spend}})()})}),(0,a.jsx)(D.Z,{children:null!=e.max_budget?(0,a.jsx)(f.Z,{children:e.max_budget}):(0,a.jsx)(f.Z,{children:"Unlimited"})}),(0,a.jsx)(D.Z,{children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(a.Fragment,{children:n&&n.models&&n.models.length>0?n.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l)):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:"all-proxy-models"})})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(D.Z,{children:(0,a.jsxs)(f.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{})," RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{onClick:()=>{Q(e),X(!0)},icon:P.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:J,onCancel:()=>{X(!1),Q(null)},footer:null,width:800,children:$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-8",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Spend"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:(()=>{try{return parseFloat($.spend).toFixed(4)}catch(e){return $.spend}})()})})]}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Budget"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.max_budget?(0,a.jsx)(a.Fragment,{children:$.max_budget}):(0,a.jsx)(a.Fragment,{children:"Unlimited"})})})]},e.name),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Expires"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor-default font-small text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.expires?(0,a.jsx)(a.Fragment,{children:new Date($.expires).toLocaleString(void 0,{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}):(0,a.jsx)(a.Fragment,{children:"Never"})})})]},e.name)]}),(0,a.jsxs)(R.Z,{className:"my-4",children:[(0,a.jsx)(y.Z,{children:"Token Name"}),(0,a.jsx)(f.Z,{className:"my-1",children:$.key_alias?$.key_alias:$.key_name}),(0,a.jsx)(y.Z,{children:"Token ID"}),(0,a.jsx)(f.Z,{className:"my-1 text-[12px]",children:$.token}),(0,a.jsx)(y.Z,{children:"Metadata"}),(0,a.jsx)(f.Z,{className:"my-1",children:(0,a.jsxs)("pre",{children:[JSON.stringify($.metadata)," "]})})]}),(0,a.jsx)(p.Z,{className:"mx-auto flex items-center",onClick:()=>{X(!1),Q(null)},children:"Close"})]})}),(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>ea(e)}),(0,a.jsx)(M.Z,{onClick:()=>ei(e),icon:O.Z,size:"sm"})]})]},e.token)})})]}),h&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Key"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this key ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:eo,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{x(!1),g(null)},children:"Cancel"})]})]})]})})]}),$&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,token:t,onSubmit:i}=e,[o]=S.Z.useForm(),[c,m]=(0,r.useState)(n),[u,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1);return(0,a.jsx)(w.Z,{title:"Edit Key",visible:l,width:800,footer:null,onOk:()=>{o.validateFields().then(e=>{o.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:o,onFinish:er,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{validator:(e,l)=>{let s=l.filter(e=>!c.models.includes(e)&&"all-team-models"!==e&&"all-proxy-models"!==e&&!c.models.includes("all-proxy-models"));return(console.log("errorModels: ".concat(s)),s.length>0)?Promise.reject("Some models are not part of the new team's models - ".concat(s,"Team models: ").concat(c.models)):Promise.resolve()}}],children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(W,{value:"all-team-models",children:"All Team Models"},"all-team-models"),c&&c.models?c.models.includes("all-proxy-models")?ee.filter(e=>"all-proxy-models"!==e).map(e=>(0,a.jsx)(W,{value:e,children:e},e)):c.models.map(e=>(0,a.jsx)(W,{value:e,children:e},e)):ee.map(e=>(0,a.jsx)(W,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: ".concat((null==c?void 0:c.max_budget)!==null&&(null==c?void 0:c.max_budget)!==void 0?null==c?void 0:c.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&c&&null!==c.max_budget&&l>c.max_budget)throw console.log("keyTeam.max_budget: ".concat(c.max_budget)),Error("Budget cannot exceed team max budget: $".concat(c.max_budget))}}],children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"token",name:"token",hidden:!0}),(0,a.jsx)(S.Z.Item,{label:"Team",name:"team_id",help:"the team this key belongs to",children:(0,a.jsx)(V.Z,{value:t.team_alias,children:null==d?void 0:d.map((e,l)=>(0,a.jsx)(z.Z,{value:e.team_id,onClick:()=>m(e),children:e.team_alias},l))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Edit Key"})})]})})},{visible:H,onCancel:()=>{Y(!1),Q(null)},token:$,onSubmit:er})]})},H=e=>{let{userID:l,userRole:s,accessToken:t,userSpend:n,selectedTeam:i}=e;console.log("userSpend: ".concat(n));let[o,d]=(0,r.useState)(null!==n?n:0),[c,m]=(0,r.useState)(0),[h,x]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(t&&l&&s&&"Admin"===s&&null==n)try{let e=await (0,u.Qy)(t);e&&(e.spend?d(e.spend):d(0),e.max_budget?m(e.max_budget):m(0))}catch(e){console.error("Error fetching global spend data:",e)}};(async()=>{try{if(null===l||null===s)return;if(null!==t){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),x(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[s,t,l]),(0,r.useEffect)(()=>{null!==n&&d(n)},[n]);let p=[];i&&i.models&&(p=i.models),p&&p.includes("all-proxy-models")?(console.log("user models:",h),p=h):p&&p.includes("all-team-models")?p=i.models:p&&0===p.length&&(p=h);let j=void 0!==o?o.toFixed(4):null;return console.log("spend in view user spend: ".concat(o)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("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:["$",j]})]})})},Y=e=>{let{userID:l,userRole:s,selectedTeam:t,accessToken:n}=e,[i,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===s)return;if(null!==n){let e=(await (0,u.So)(n,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),o(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,s]);let d=[];return t&&t.models&&(d=t.models),d&&d.includes("all-proxy-models")&&(console.log("user models:",i),d=i),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"mb-5",children:(0,a.jsx)("p",{className:"text-3xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:null==t?void 0:t.team_alias})})})},J=e=>{let l,{teams:s,setSelectedTeam:t,userRole:n}=e,i={models:[],team_id:null,team_alias:"Default Team"},[o,d]=(0,r.useState)(i);return(l="App User"===n?s:s?[...s,i]:[i],"App User"===n)?null:(0,a.jsxs)("div",{className:"mt-5 mb-5",children:[(0,a.jsx)(y.Z,{children:"Select Team"}),(0,a.jsx)(f.Z,{children:"If you belong to multiple teams, this setting controls which team is used by default when creating new API Keys."}),(0,a.jsxs)(f.Z,{className:"mt-3 mb-3",children:[(0,a.jsx)("b",{children:"Default Team:"})," If no team_id is set for a key, it will be grouped under here."]}),l&&l.length>0?(0,a.jsx)(V.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(z.Z,{value:String(l),onClick:()=>t(e),children:e.team_alias},l))}):(0,a.jsxs)(f.Z,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]})},X=s(37963),$=s(97482);console.log("isLocal:",!1);var Q=e=>{let{userID:l,userRole:s,teams:t,keys:n,setUserRole:o,userEmail:d,setUserEmail:c,setTeams:m,setKeys:p}=e,[j,g]=(0,r.useState)(null),Z=(0,i.useSearchParams)();Z.get("viewSpend"),(0,i.useRouter)();let _=Z.get("token"),[f,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[S,k]=(0,r.useState)([]),w={models:[],team_alias:"Default Team",team_id:null},[N,A]=(0,r.useState)(t?t[0]:w);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,r.useEffect)(()=>{if(_){let e=(0,X.o)(_);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),y(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),o(l)}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e))}}if(l&&f&&s&&!n&&!j){let e=sessionStorage.getItem("userModels"+l);e?k(JSON.parse(e)):(async()=>{try{let e=await (0,u.Br)(f,l,s,!1,null,null);if(console.log("received teams in user dashboard: ".concat(Object.keys(e),"; team values: ").concat(Object.entries(e.teams))),"Admin"==s){let e=await (0,u.Qy)(f);g(e),console.log("globalSpend:",e)}else g(e.user_info);p(e.keys),m(e.teams);let t=[...e.teams];t.length>0?(console.log("response['teams']: ".concat(t)),A(t[0])):A(w),sessionStorage.setItem("userData"+l,JSON.stringify(e.keys)),sessionStorage.setItem("userSpendData"+l,JSON.stringify(e.user_info));let n=(await (0,u.So)(f,l,s)).data.map(e=>e.id);console.log("available_model_names:",n),k(n),console.log("userModels:",S),sessionStorage.setItem("userModels"+l,JSON.stringify(n))}catch(e){console.error("There was an error fetching the data",e)}})()}},[l,_,f,n,s]),(0,r.useEffect)(()=>{if(null!==n&&null!=N&&null!==N.team_id){let e=0;for(let l of n)N.hasOwnProperty("team_id")&&null!==l.team_id&&l.team_id===N.team_id&&(e+=l.spend);v(e)}else if(null!==n){let e=0;for(let l of n)e+=l.spend;v(e)}},[N]),null==l||null==_){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}if(null==f)return null;if(null==s&&o("App Owner"),s&&"Admin Viewer"==s){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",N),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(Y,{userID:l,userRole:s,selectedTeam:N||null,accessToken:f}),(0,a.jsx)(H,{userID:l,userRole:s,accessToken:f,userSpend:b,selectedTeam:N||null}),(0,a.jsx)(G,{userID:l,userRole:s,accessToken:f,selectedTeam:N||null,data:n,setData:p,teams:t}),(0,a.jsx)(E,{userID:l,team:N||null,userRole:s,accessToken:f,data:n,setData:p},N?N.team_id:null),(0,a.jsx)(J,{teams:t,setSelectedTeam:A,userRole:s})]})})})},ee=s(49167),el=s(35087),es=s(92836),et=s(26734),en=s(41608),ea=s(32126),er=s(23682),ei=s(47047),eo=s(76628),ed=s(25707),ec=s(44041),em=s(6180),eu=s(28683),eh=s(38302),ex=s(66242),ep=s(78578),ej=s(63954),eg=s(34658),eZ=e=>{let{modelID:l,accessToken:s}=e,[t,n]=(0,r.useState)(!1),i=async()=>{try{k.ZP.info("Making API Call"),n(!0);let e=await (0,u.Og)(s,l);console.log("model delete Response:",e),k.ZP.success("Model ".concat(l," deleted successfully")),n(!1)}catch(e){console.error("Error deleting the model:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(M.Z,{onClick:()=>n(!0),icon:O.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:t,onOk:i,okType:"danger",onCancel:()=>n(!1),children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Delete Model"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)("p",{children:"Are you sure you want to delete this model? This action is irreversible."})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Model ID: ",(0,a.jsx)("b",{children:l})]})})]})})]})},e_=s(97766),ef=s(46495),ey=s(18190),eb=s(91118),ev=e=>{let{modelMetrics:l,modelMetricsCategories:s,customTooltip:t,premiumUser:n}=e;return n?(0,a.jsx)(eb.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:s,colors:["indigo","rose"],connectNulls:!0,customTooltip:t}):(0,a.jsxs)("div",{children:[(0,a.jsx)(ey.Z,{title:"✨ Enterprise Feature",color:"teal",className:"mt-2 mb-4",children:"Enterprise features are available for users with a specific license, please contact LiteLLM to unlock this limitation."}),(0,a.jsx)(p.Z,{variant:"primary",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get in touch"})})]})},eS=e=>{let{fields:l,selectedProvider:s}=e;return 0===l.length?null:(0,a.jsx)(a.Fragment,{children:l.map(e=>(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:e.field_name.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),name:e.field_name,tooltip:e.field_description,className:"mb-2",children:(0,a.jsx)(j.Z,{placeholder:e.field_value,type:"password"})},e.field_name))})},ek=s(67951);let{Title:ew,Link:eN}=$.default;(t=n||(n={})).OpenAI="OpenAI",t.Azure="Azure",t.Anthropic="Anthropic",t.Google_AI_Studio="Google AI Studio",t.Bedrock="Amazon Bedrock",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.Databricks="Databricks";let eA={OpenAI:"openai",Azure:"azure",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",OpenAI_Compatible:"openai",Vertex_AI:"vertex_ai",Databricks:"databricks"},eI={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"},eC=async(e,l,s)=>{try{let t=Array.isArray(e.model)?e.model:[e.model];console.log("received deployments: ".concat(t)),console.log("received type of deployments: ".concat(typeof t)),t.forEach(async s=>{console.log("litellm_model: ".concat(s));let t={},n={};t.model=s;let a="";for(let[l,s]of(console.log("formValues add deployment:",e),Object.entries(e)))if(""!==s){if("model_name"==l)a+=s;else if("custom_llm_provider"==l)continue;else if("model"==l)continue;else if("base_model"===l)n[l]=s;else if("litellm_extra_params"==l){console.log("litellm_extra_params:",s);let e={};if(s&&void 0!=s){try{e=JSON.parse(s)}catch(e){throw k.ZP.error("Failed to parse LiteLLM Extra Params: "+e,10),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,s]of Object.entries(e))t[l]=s}}else t[l]=s}let r={model_name:a,litellm_params:t,model_info:n},i=await (0,u.kK)(l,r);console.log("response for model create call: ".concat(i.data))}),s.resetFields()}catch(e){k.ZP.error("Failed to create model: "+e,10)}};var eE=e=>{var l,s,t;let i,{accessToken:o,token:d,userRole:c,userID:m,modelData:h={data:[]},keys:g,setModelData:Z,premiumUser:_}=e,[b,v]=(0,r.useState)([]),[N]=S.Z.useForm(),[C,E]=(0,r.useState)(null),[O,W]=(0,r.useState)(""),[G,H]=(0,r.useState)([]),Y=Object.values(n).filter(e=>isNaN(Number(e))),[J,X]=(0,r.useState)([]),[Q,ey]=(0,r.useState)("OpenAI"),[eb,eE]=(0,r.useState)(""),[eP,eT]=(0,r.useState)(!1),[eO,eF]=(0,r.useState)(!1),[eR,eM]=(0,r.useState)(null),[eL,eU]=(0,r.useState)([]),[eD,eK]=(0,r.useState)(null),[eq,eB]=(0,r.useState)([]),[eV,ez]=(0,r.useState)([]),[eW,eG]=(0,r.useState)([]),[eH,eY]=(0,r.useState)([]),[eJ,eX]=(0,r.useState)([]),[e$,eQ]=(0,r.useState)([]),[e0,e1]=(0,r.useState)([]),[e2,e4]=(0,r.useState)([]),[e5,e8]=(0,r.useState)([]),[e3,e6]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[e9,e7]=(0,r.useState)(null),[le,ll]=(0,r.useState)(0),[ls,lt]=(0,r.useState)({}),[ln,la]=(0,r.useState)([]),[lr,li]=(0,r.useState)(!1),[lo,ld]=(0,r.useState)(null),[lc,lm]=(0,r.useState)(null),[lu,lh]=(0,r.useState)([]);(0,r.useEffect)(()=>{lb(eD,e3.from,e3.to)},[lo,lc]);let lx=e=>{eM(e),eT(!0)},lp=e=>{eM(e),eF(!0)},lj=async e=>{if(console.log("handleEditSubmit:",e),null==o)return;let l={},s=null;for(let[t,n]of Object.entries(e))"model_id"!==t?l[t]=n:s=n;let t={litellm_params:l,model_info:{id:s}};console.log("handleEditSubmit payload:",t);try{await (0,u.um)(o,t),k.ZP.success("Model updated successfully, restart server to see updates"),eT(!1),eM(null)}catch(e){console.log("Error occurred")}},lg=()=>{W(new Date().toLocaleString())},lZ=async()=>{if(!o){console.error("Access token is missing");return}console.log("new modelGroupRetryPolicy:",e9);try{await (0,u.K_)(o,{router_settings:{model_group_retry_policy:e9}}),k.ZP.success("Retry settings saved successfully")}catch(e){console.error("Failed to save retry settings:",e),k.ZP.error("Failed to save retry settings")}};if((0,r.useEffect)(()=>{if(!o||!d||!c||!m)return;let e=async()=>{try{var e,l,s,t,n,a,r,i,d,h,x,p;let j=await (0,u.hy)(o);X(j);let g=await (0,u.AZ)(o,m,c);console.log("Model data response:",g.data),Z(g);let _=new Set;for(let e=0;e0&&(y=f[f.length-1],console.log("_initial_model_group:",y),eK(y)),console.log("selectedModelGroup:",eD);let b=await (0,u.o6)(o,m,c,y,null===(e=e3.from)||void 0===e?void 0:e.toISOString(),null===(l=e3.to)||void 0===l?void 0:l.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model metrics response:",b),ez(b.data),eG(b.all_api_bases);let v=await (0,u.Rg)(o,y,null===(s=e3.from)||void 0===s?void 0:s.toISOString(),null===(t=e3.to)||void 0===t?void 0:t.toISOString());eY(v.data),eX(v.all_api_bases);let S=await (0,u.N8)(o,m,c,y,null===(n=e3.from)||void 0===n?void 0:n.toISOString(),null===(a=e3.to)||void 0===a?void 0:a.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model exceptions response:",S),eQ(S.data),e1(S.exception_types);let k=await (0,u.fP)(o,m,c,y,null===(r=e3.from)||void 0===r?void 0:r.toISOString(),null===(i=e3.to)||void 0===i?void 0:i.toISOString(),null==lo?void 0:lo.token,lc),w=await (0,u.n$)(o,null===(d=e3.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(h=e3.to)||void 0===h?void 0:h.toISOString().split("T")[0],y);lt(w);let N=await (0,u.v9)(o,null===(x=e3.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=e3.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);la(N),console.log("dailyExceptions:",w),console.log("dailyExceptionsPerDeplyment:",N),console.log("slowResponses:",k),e8(k);let A=await (0,u.j2)(o);lh(null==A?void 0:A.end_users);let I=(await (0,u.BL)(o,m,c)).router_settings;console.log("routerSettingsInfo:",I);let C=I.model_group_retry_policy,E=I.num_retries;console.log("model_group_retry_policy:",C),console.log("default_retries:",E),e7(C),ll(E)}catch(e){console.error("There was an error fetching the model data",e)}};o&&d&&c&&m&&e();let l=async()=>{let e=await (0,u.qm)();console.log("received model cost map data: ".concat(Object.keys(e))),E(e)};null==C&&l(),lg()},[o,d,c,m,C,O]),!h||!o||!d||!c||!m)return(0,a.jsx)("div",{children:"Loading..."});let l_=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(C)),null!=C&&"object"==typeof C&&e in C)?C[e].litellm_provider:"openai";if(n){let e=n.split("/"),l=e[0];r=1===e.length?u(n):l}else r="openai";a&&(i=null==a?void 0:a.input_cost_per_token,o=null==a?void 0:a.output_cost_per_token,d=null==a?void 0:a.max_tokens,c=null==a?void 0:a.max_input_tokens),(null==t?void 0:t.litellm_params)&&(m=Object.fromEntries(Object.entries(null==t?void 0:t.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),h.data[e].provider=r,h.data[e].input_cost=i,h.data[e].output_cost=o,h.data[e].input_cost&&(h.data[e].input_cost=(1e6*Number(h.data[e].input_cost)).toFixed(2)),h.data[e].output_cost&&(h.data[e].output_cost=(1e6*Number(h.data[e].output_cost)).toFixed(2)),h.data[e].max_tokens=d,h.data[e].max_input_tokens=c,h.data[e].api_base=null==t?void 0:null===(s=t.litellm_params)||void 0===s?void 0:s.api_base,h.data[e].cleanedLitellmParams=m,l_.push(t.model_name),console.log(h.data[e])}if(c&&"Admin Viewer"==c){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let lf=e=>{console.log("received provider string: ".concat(e));let l=Object.keys(n).find(l=>n[l]===e);if(l){let e=eA[l];console.log("mappingResult: ".concat(e));let s=[];"object"==typeof C&&Object.entries(C).forEach(l=>{let[t,n]=l;null!==n&&"object"==typeof n&&"litellm_provider"in n&&(n.litellm_provider===e||n.litellm_provider.includes(e))&&s.push(t)}),H(s),console.log("providerModels: ".concat(G))}},ly=async()=>{try{k.ZP.info("Running health check..."),eE("");let e=await (0,u.EY)(o);eE(e)}catch(e){console.error("Error running health check:",e),eE("Error running health check")}},lb=async(e,l,s)=>{if(console.log("Updating model metrics for group:",e),!o||!m||!c||!l||!s)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",s),eK(e);let t=null==lo?void 0:lo.token;void 0===t&&(t=null);let n=lc;void 0===n&&(n=null),l.setHours(0),l.setMinutes(0),l.setSeconds(0),s.setHours(23),s.setMinutes(59),s.setSeconds(59);try{let a=await (0,u.o6)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model metrics response:",a),ez(a.data),eG(a.all_api_bases);let r=await (0,u.Rg)(o,e,l.toISOString(),s.toISOString());eY(r.data),eX(r.all_api_bases);let i=await (0,u.N8)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model exceptions response:",i),eQ(i.data),e1(i.exception_types);let d=await (0,u.fP)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);if(console.log("slowResponses:",d),e8(d),e){let t=await (0,u.n$)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);lt(t);let n=await (0,u.v9)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);la(n)}}catch(e){console.error("Failed to fetch model metrics",e)}},lv=(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mb-1",children:"Select API Key Name"}),_?(0,a.jsxs)("div",{children:[(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{ld(e)},children:e.key_alias},l):null)]}),(0,a.jsx)(f.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(V.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(z.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>{lm(e)},children:e},l))]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsxs)(z.Z,{value:String(l),disabled:!0,onClick:()=>{ld(e)},children:["✨ ",e.key_alias," (Enterpise only Feature)"]},l):null)]}),(0,a.jsx)(f.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(V.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(z.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsxs)(z.Z,{value:e,disabled:!0,onClick:()=>{lm(e)},children:["✨ ",e," (Enterpise only Feature)"]},l))]})]})]}),lS=e=>{var l,s;let{payload:t,active:n}=e;if(!n||!t)return null;let r=null===(s=t[0])||void 0===s?void 0:null===(l=s.payload)||void 0===l?void 0:l.date,i=t.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:t.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,a.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[r&&(0,a.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",r]}),i.map((e,l)=>{let s=parseFloat(e.value.toFixed(5)),t=0===s&&e.value>0?"<0.00001":s.toFixed(5);return(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,a.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:t})]},l)})]})};console.log("selectedProvider: ".concat(Q)),console.log("providerModels.length: ".concat(G.length));let lk=Object.keys(n).find(e=>n[e]===Q);return lk&&(i=J.find(e=>e.name===eA[lk])),(0,a.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(es.Z,{children:"All Models"}),(0,a.jsx)(es.Z,{children:"Add Model"}),(0,a.jsx)(es.Z,{children:(0,a.jsx)("pre",{children:"/health Models"})}),(0,a.jsx)(es.Z,{children:"Model Analytics"}),(0,a.jsx)(es.Z,{children:"Model Retry Settings"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[O&&(0,a.jsxs)(f.Z,{children:["Last Refreshed: ",O]}),(0,a.jsx)(M.Z,{icon:ej.Z,variant:"shadow",size:"xs",className:"self-center",onClick:lg})]})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(f.Z,{children:"Filter by Public Model Name"}),(0,a.jsxs)(V.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eD||eL[0],onValueChange:e=>eK("all"===e?"all":e),value:eD||eL[0],children:[(0,a.jsx)(z.Z,{value:"all",children:"All Models"}),eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>eK(e),children:e},l))]})]}),(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{style:{maxWidth:"1500px",width:"100%"},children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Public Model Name"}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Provider"}),"Admin"===c&&(0,a.jsx)(q.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"API Base"}),(0,a.jsxs)(q.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Input Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsxs)(q.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Output Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:_?"Created At":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created At"]})}),(0,a.jsx)(q.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:_?"Created By":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created By"]})}),(0,a.jsx)(q.Z,{style:{maxWidth:"50px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Status"}),(0,a.jsx)(q.Z,{})]})}),(0,a.jsx)(U.Z,{children:h.data.filter(e=>"all"===eD||e.model_name===eD||null==eD||""===eD).map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{style:{maxHeight:"1px",minHeight:"1px"},children:[(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.model_name||"-"})}),(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.provider||"-"})}),"Admin"===c&&(0,a.jsx)(D.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)(em.Z,{title:e&&e.api_base,children:(0,a.jsx)("pre",{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},className:"text-xs",title:e&&e.api_base?e.api_base:"",children:e&&e.api_base?e.api_base.slice(0,20):"-"})})}),(0,a.jsx)(D.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.input_cost?e.input_cost:e.litellm_params.input_cost_per_token?(1e6*Number(e.litellm_params.input_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(D.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.output_cost?e.output_cost:e.litellm_params.output_cost_per_token?(1e6*Number(e.litellm_params.output_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:_&&((s=e.model_info.created_at)?new Date(s).toLocaleDateString("en-US"):null)||"-"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:_&&e.model_info.created_by||"-"})}),(0,a.jsx)(D.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:e.model_info.db_model?(0,a.jsx)(F.Z,{size:"xs",className:"text-white",children:(0,a.jsx)("p",{className:"text-xs",children:"DB Model"})}):(0,a.jsx)(F.Z,{size:"xs",className:"text-black",children:(0,a.jsx)("p",{className:"text-xs",children:"Config Model"})})}),(0,a.jsx)(D.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsxs)(x.Z,{numItems:3,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{icon:P.Z,size:"sm",onClick:()=>lp(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>lx(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(eZ,{modelID:e.model_info.id,accessToken:o})})]})})]},l)})})]})})]}),(0,a.jsx)(e=>{let{visible:l,onCancel:s,model:t,onSubmit:n}=e,[r]=S.Z.useForm(),i={},o="",d="";if(t){i=t.litellm_params,o=t.model_name;let e=t.model_info;e&&(d=e.id,console.log("model_id: ".concat(d)),i.model_id=d)}return(0,a.jsx)(w.Z,{title:"Edit Model "+o,visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n(e),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:lj,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"api_base",name:"api_base",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"tpm",name:"tpm",tooltip:"int (optional) - Tokens limit for this deployment: in tokens per minute (tpm). Find this information on your model/providers website",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"rpm",name:"rpm",tooltip:"int (optional) - Rate limit for this deployment: in requests per minute (rpm). Find this information on your model/providers website",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"max_retries",name:"max_retries",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"timeout",name:"timeout",tooltip:"int (optional) - Timeout in seconds for LLM requests (Defaults to 600 seconds)",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"stream_timeout",name:"stream_timeout",tooltip:"int (optional) - Timeout for stream requests (seconds)",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"input_cost_per_token",name:"input_cost_per_token",tooltip:"float (optional) - Input cost per token",children:(0,a.jsx)(A.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"output_cost_per_token",name:"output_cost_per_token",tooltip:"float (optional) - Output cost per token",children:(0,a.jsx)(A.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"model_id",name:"model_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})},{visible:eP,onCancel:()=>{eT(!1),eM(null)},model:eR,onSubmit:lj}),(0,a.jsxs)(w.Z,{title:eR&&eR.model_name,visible:eO,width:800,footer:null,onCancel:()=>{eF(!1),eM(null)},children:[(0,a.jsx)(y.Z,{children:"Model Info"}),(0,a.jsx)(ek.Z,{language:"json",children:eR&&JSON.stringify(eR,null,2)})]})]}),(0,a.jsxs)(ea.Z,{className:"h-full",children:[(0,a.jsx)(ew,{level:2,children:"Add new model"}),(0,a.jsx)(R.Z,{children:(0,a.jsxs)(S.Z,{form:N,onFinish:()=>{N.validateFields().then(e=>{eC(e,o,N)}).catch(e=>{console.error("Validation failed:",e)})},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(V.Z,{value:Q.toString(),children:Y.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>{lf(e),ey(e)},children:e},l))})}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Public Model Name",name:"model_name",tooltip:"Model name your users will pass in. Also used for load-balancing, LiteLLM will load balance between all models with this public name.",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"Vertex AI (Anthropic, Gemini, etc.)"===(t=Q.toString())?"gemini-pro":"Anthropic"==t?"claude-3-opus":"Amazon Bedrock"==t?"claude-3-opus":"Google AI Studio"==t?"gemini-pro":"gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(f.Z,{className:"mb-3 mt-1",children:"Model name your users will pass in."})})]}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"LiteLLM Model Name(s)",name:"model",tooltip:"Actual model name used for making litellm.completion() call.",className:"mb-0",children:"Azure"===Q?(0,a.jsx)(j.Z,{placeholder:"Enter model name"}):G.length>0?(0,a.jsx)(ei.Z,{value:G,children:G.map((e,l)=>(0,a.jsx)(eo.Z,{value:e,children:e},l))}):(0,a.jsx)(j.Z,{placeholder:"gpt-3.5-turbo-0125"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-3 mt-1",children:["Actual model name used for making"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/providers",target:"_blank",children:"litellm.completion() call"}),". We'll"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/proxy/reliability#step-1---set-deployments-on-config",target:"_blank",children:"loadbalance"})," ","models with the same 'public name'"]})})]}),void 0!==i&&i.fields.length>0&&(0,a.jsx)(eS,{fields:i.fields,selectedProvider:i.name}),"Amazon Bedrock"!=Q&&"Vertex AI (Anthropic, Gemini, etc.)"!=Q&&(void 0===i||0==i.fields.length)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Key",name:"api_key",children:(0,a.jsx)(j.Z,{placeholder:"sk-",type:"password"})}),"OpenAI"==Q&&(0,a.jsx)(S.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,a.jsx)(j.Z,{placeholder:"[OPTIONAL] my-unique-org"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Project",name:"vertex_project",children:(0,a.jsx)(j.Z,{placeholder:"adroit-cadet-1234.."})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Location",name:"vertex_location",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Credentials",name:"vertex_credentials",className:"mb-0",children:(0,a.jsx)(ef.Z,{name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;N.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?k.ZP.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&k.ZP.error("".concat(e.file.name," file upload failed."))},children:(0,a.jsx)(I.ZP,{icon:(0,a.jsx)(e_.Z,{}),children:"Click to Upload"})})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(f.Z,{className:"mb-3 mt-1",children:"Give litellm a gcp service account(.json file), so it can make the relevant calls"})})]}),("Azure"==Q||"OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)"==Q)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Base",name:"api_base",children:(0,a.jsx)(j.Z,{placeholder:"https://..."})}),"Azure"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Version",name:"api_version",children:(0,a.jsx)(j.Z,{placeholder:"2023-07-01-preview"})}),"Azure"==Q&&(0,a.jsxs)("div",{children:[(0,a.jsx)(S.Z.Item,{label:"Base Model",name:"base_model",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"azure/gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,a.jsx)(eN,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Access Key ID",name:"aws_access_key_id",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Secret Access Key",name:"aws_secret_access_key",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Region Name",name:"aws_region_name",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),(0,a.jsx)(S.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-0",children:(0,a.jsx)(ep.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(f.Z,{className:"mb-3 mt-1",children:["Pass JSON of litellm supported params"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]})]}),(0,a.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add Model"})}),(0,a.jsx)(em.Z,{title:"Get help on our github",children:(0,a.jsx)($.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})})]})})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(f.Z,{children:"`/health` will run a very small request through your models configured on litellm"}),(0,a.jsx)(p.Z,{onClick:ly,children:"Run `/health`"}),eb&&(0,a.jsx)("pre",{children:JSON.stringify(eb,null,2)})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:e3,className:"mr-2",onValueChange:e=>{e6(e),lb(eD,e.from,e.to)}})]}),(0,a.jsxs)(eu.Z,{className:"ml-2",children:[(0,a.jsx)(f.Z,{children:"Select Model Group"}),(0,a.jsx)(V.Z,{defaultValue:eD||eL[0],value:eD||eL[0],children:eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>lb(e,e3.from,e3.to),children:e},l))})]}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(ex.Z,{trigger:"click",content:lv,overlayStyle:{width:"20vw"},children:(0,a.jsx)(p.Z,{icon:eg.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>li(!0)})})})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Avg. Latency per Token"}),(0,a.jsx)(es.Z,{value:"2",children:"✨ Time to first token"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,a.jsx)(f.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),eV&&eW&&(0,a.jsx)(ed.Z,{title:"Model Latency",className:"h-72",data:eV,showLegend:!1,index:"date",categories:eW,connectNulls:!0,customTooltip:lS})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ev,{modelMetrics:eH,modelMetricsCategories:eJ,customTooltip:lS,premiumUser:_})})]})]})})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Deployment"}),(0,a.jsx)(q.Z,{children:"Success Responses"}),(0,a.jsxs)(q.Z,{children:["Slow Responses ",(0,a.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,a.jsx)(U.Z,{children:e5.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.api_base}),(0,a.jsx)(D.Z,{children:e.total_count}),(0,a.jsx)(D.Z,{children:e.slow_count})]},l))})]})})})]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(y.Z,{children:["All Up Rate Limit Errors (429) for ",eD]}),(0,a.jsxs)(x.Z,{numItems:1,children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",ls.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:ls.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,a.jsx)(eu.Z,{})]})]}),_?(0,a.jsx)(a.Fragment,{children:ln.map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,a.jsx)(a.Fragment,{children:ln&&ln.length>0&&ln.slice(0,1).map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(f.Z,{children:"Filter by Public Model Name"}),(0,a.jsx)(V.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eD||eL[0],value:eD||eL[0],onValueChange:e=>eK(e),children:eL.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>eK(e),children:e},l))})]}),(0,a.jsxs)(y.Z,{children:["Retry Policy for ",eD]}),(0,a.jsx)(f.Z,{className:"mb-6",children:"How many retries should be attempted based on the Exception"}),eI&&(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Object.entries(eI).map((e,l)=>{var s;let[t,n]=e,r=null==e9?void 0:null===(s=e9[eD])||void 0===s?void 0:s[n];return null==r&&(r=le),(0,a.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("td",{children:(0,a.jsx)(f.Z,{children:t})}),(0,a.jsx)("td",{children:(0,a.jsx)(A.Z,{className:"ml-5",value:r,min:0,step:1,onChange:e=>{e7(l=>{var s;let t=null!==(s=null==l?void 0:l[eD])&&void 0!==s?s:{};return{...null!=l?l:{},[eD]:{...t,[n]:e}}})}})})]},l)})})}),(0,a.jsx)(p.Z,{className:"mt-6 mr-8",onClick:lZ,children:"Save"})]})]})]})})};let{Option:eP}=v.default;var eT=e=>{let{userID:l,accessToken:s,teams:t}=e,[n]=S.Z.useForm(),[i,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[m,h]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{let e=await (0,u.So)(s,l,"any"),t=[];for(let l=0;l{o(!1),n.resetFields()},g=()=>{o(!1),c(null),n.resetFields()},Z=async e=>{try{k.ZP.info("Making API Call"),o(!0),console.log("formValues in create user:",e);let t=await (0,u.Ov)(s,null,e);console.log("user create Response:",t),c(t.key),k.ZP.success("API user Created"),n.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the user:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-0",onClick:()=>o(!0),children:"+ Invite User"}),(0,a.jsxs)(w.Z,{title:"Invite User",visible:i,width:800,footer:null,onOk:x,onCancel:g,children:[(0,a.jsx)(f.Z,{className:"mb-1",children:"Invite a user to login to the Admin UI and create Keys"}),(0,a.jsx)(f.Z,{className:"mb-6",children:(0,a.jsx)("b",{children:"Note: SSO Setup Required for this"})}),(0,a.jsxs)(S.Z,{form:n,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(S.Z.Item,{label:"User Email",name:"user_email",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(v.default,{placeholder:"Select Team ID",style:{width:"100%"},children:t?t.map(e=>(0,a.jsx)(eP,{value:e.team_id,children:e.team_alias},e.team_id)):(0,a.jsx)(eP,{value:null,children:"Default Team"},"default")})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create User"})})]})]}),d&&(0,a.jsxs)(w.Z,{title:"User Created Successfully",visible:i,onOk:x,onCancel:g,footer:null,children:[(0,a.jsx)("p",{children:"User has been created to access your proxy. Please Ask them to Log In."}),(0,a.jsx)("br",{}),(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:"Note: This Feature is only supported through SSO on the Admin UI"})})]})]})},eO=e=>{let{visible:l,possibleUIRoles:s,onCancel:t,user:n,onSubmit:i}=e,[o,d]=(0,r.useState)(n),[c]=S.Z.useForm();(0,r.useEffect)(()=>{c.resetFields()},[n]);let m=async()=>{c.resetFields(),t()},u=async e=>{i(e),c.resetFields(),t()};return n?(0,a.jsx)(w.Z,{visible:l,onCancel:m,footer:null,title:"Edit User "+n.user_id,width:1e3,children:(0,a.jsx)(S.Z,{form:c,onFinish:u,initialValues:n,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"User Role",name:"user_role",children:(0,a.jsx)(v.default,{children:s&&Object.entries(s).map(e=>{let[l,{ui_label:s,description:t}]=e;return(0,a.jsx)(z.Z,{value:l,title:s,children:(0,a.jsxs)("div",{className:"flex",children:[s," ",(0,a.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:t})]})},l)})})}),(0,a.jsx)(S.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",children:(0,a.jsx)(A.Z,{min:0,step:1})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},eF=e=>{let{accessToken:l,token:s,keys:t,userRole:n,userID:i,teams:o,setKeys:d}=e,[c,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(0),[Z,_]=r.useState(null),[f,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),[N,A]=(0,r.useState)({}),I=async()=>{w(null),v(!1)},C=async e=>{if(console.log("inside handleEditSubmit:",e),l&&s&&n&&i){try{await (0,u.pf)(l,e,null),k.ZP.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}c&&m(c.map(l=>l.user_id===e.user_id?e:l)),w(null),v(!1)}};return((0,r.useEffect)(()=>{if(!l||!s||!n||!i)return;let e=async()=>{try{let e=await (0,u.Br)(l,null,n,!0,j,25);console.log("user data response:",e),m(e);let s=await (0,u.lg)(l);A(s)}catch(e){console.error("There was an error fetching the model data",e)}};l&&s&&n&&i&&e()},[l,s,n,i,j]),c&&l&&s&&n&&i)?(0,a.jsx)("div",{style:{width:"100%"},children:(0,a.jsxs)(x.Z,{className:"gap-2 p-2 h-[90vh] w-full mt-8",children:[(0,a.jsx)(eT,{userID:i,accessToken:l,teams:o}),(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[90vh] mb-4",children:[(0,a.jsx)("div",{className:"mb-4 mt-1"}),(0,a.jsx)(et.Z,{children:(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(L.Z,{className:"mt-5",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"User ID"}),(0,a.jsx)(q.Z,{children:"User Email"}),(0,a.jsx)(q.Z,{children:"Role"}),(0,a.jsx)(q.Z,{children:"User Spend ($ USD)"}),(0,a.jsx)(q.Z,{children:"User Max Budget ($ USD)"}),(0,a.jsx)(q.Z,{children:"API Keys"}),(0,a.jsx)(q.Z,{})]})}),(0,a.jsx)(U.Z,{children:c.map(e=>{var l,s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_id||"-"}),(0,a.jsx)(D.Z,{children:e.user_email||"-"}),(0,a.jsx)(D.Z,{children:(null==N?void 0:null===(l=N[null==e?void 0:e.user_role])||void 0===l?void 0:l.ui_label)||"-"}),(0,a.jsx)(D.Z,{children:e.spend?null===(s=e.spend)||void 0===s?void 0:s.toFixed(2):"-"}),(0,a.jsx)(D.Z,{children:e.max_budget?e.max_budget:"Unlimited"}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(x.Z,{numItems:2,children:e&&e.key_aliases&&e.key_aliases.filter(e=>null!==e).length>0?(0,a.jsxs)(F.Z,{size:"xs",color:"indigo",children:[e.key_aliases.filter(e=>null!==e).length,"\xa0Keys"]}):(0,a.jsx)(F.Z,{size:"xs",color:"gray",children:"No Keys"})})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:T.Z,onClick:()=>{w(e),v(!0)},children:"View Keys"})})]},e.user_id)})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("div",{className:"flex-1 flex justify-between items-center"})]})})]})}),(0,a.jsx)(eO,{visible:b,possibleUIRoles:N,onCancel:I,user:S,onSubmit:C})]}),function(){if(!c)return null;let e=Math.ceil(c.length/25);return(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)("div",{children:["Showing Page ",j+1," of ",e]}),(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none",disabled:0===j,onClick:()=>g(j-1),children:"← Prev"}),(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r focus:outline-none",onClick:()=>{g(j+1)},children:"Next →"})]})]})}()]})}):(0,a.jsx)("div",{children:"Loading..."})},eR=e=>{let{teams:l,searchParams:s,accessToken:t,setTeams:n,userID:i,userRole:o}=e,[d]=S.Z.useForm(),[c]=S.Z.useForm(),{Title:m,Paragraph:g}=$.default,[Z,_]=(0,r.useState)(""),[y,b]=(0,r.useState)(!1),[C,E]=(0,r.useState)(l?l[0]:null),[P,W]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[Y,J]=(0,r.useState)([]),[X,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)({}),en=e=>{E(e),b(!0)},ea=async e=>{let s=e.team_id;if(console.log("handleEditSubmit:",e),null==t)return;let a=await (0,u.Gh)(t,e);l&&n(l.map(e=>e.team_id===s?a.data:e)),k.ZP.success("Team updated successfully"),b(!1),E(null)},er=async e=>{el(e),Q(!0)},ei=async()=>{if(null!=ee&&null!=l&&null!=t){try{await (0,u.rs)(t,ee);let e=l.filter(e=>e.team_id!==ee);n(e)}catch(e){console.error("Error deleting the team:",e)}Q(!1),el(null)}};(0,r.useEffect)(()=>{let e=async()=>{try{if(null===i||null===o||null===t||null===l)return;console.log("fetching team info:");let e={};for(let s=0;s<(null==l?void 0:l.length);s++){let n=l[s].team_id,a=await (0,u.Xm)(t,n);console.log("teamInfo response:",a),null!==a&&(e={...e,[n]:a})}et(e)}catch(e){console.error("Error fetching team info:",e)}};(async()=>{try{if(null===i||null===o)return;if(null!==t){let e=(await (0,u.So)(t,i,o)).data.map(e=>e.id);console.log("available_model_names:",e),J(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[t,i,o,l]);let eo=async e=>{try{if(null!=t){var s;let a=null==e?void 0:e.team_alias;if((null!==(s=null==l?void 0:l.map(e=>e.team_alias))&&void 0!==s?s:[]).includes(a))throw Error("Team alias ".concat(a," already exists, please pick another alias"));k.ZP.info("Creating Team");let r=await (0,u.hT)(t,e);null!==l?n([...l,r]):n([r]),console.log("response for team create call: ".concat(r)),k.ZP.success("Team created"),W(!1)}}catch(e){console.error("Error creating the team:",e),k.ZP.error("Error creating the team: "+e,20)}},ed=async e=>{try{if(null!=t&&null!=l){k.ZP.info("Adding Member");let s={role:"user",user_email:e.user_email,user_id:e.user_id},a=await (0,u.cu)(t,C.team_id,s);console.log("response for team create call: ".concat(a.data));let r=l.findIndex(e=>(console.log("team.team_id=".concat(e.team_id,"; response.data.team_id=").concat(a.data.team_id)),e.team_id===a.data.team_id));if(console.log("foundIndex: ".concat(r)),-1!==r){let e=[...l];e[r]=a.data,n(e),E(a.data)}H(!1)}}catch(e){console.error("Error creating the team:",e)}};return console.log("received teams ".concat(JSON.stringify(l))),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"All Teams"}),(0,a.jsxs)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Team Name"}),(0,a.jsx)(q.Z,{children:"Spend (USD)"}),(0,a.jsx)(q.Z,{children:"Budget (USD)"}),(0,a.jsx)(q.Z,{children:"Models"}),(0,a.jsx)(q.Z,{children:"TPM / RPM Limits"}),(0,a.jsx)(q.Z,{children:"Info"})]})}),(0,a.jsx)(U.Z,{children:l&&l.length>0?l.map(e=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.spend}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.max_budget?e.max_budget:"No limit"}),(0,a.jsx)(D.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(f.Z,{children:"All Proxy Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(f.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(D.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,a.jsxs)(f.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{}),"RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsxs)(f.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].keys&&es[e.team_id].keys.length," ","Keys"]}),(0,a.jsxs)(f.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].team_info&&es[e.team_id].team_info.members_with_roles&&es[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>en(e)}),(0,a.jsx)(M.Z,{onClick:()=>er(e.team_id),icon:O.Z,size:"sm"})]})]},e.team_id)):null})]}),X&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Team"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this team ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:ei,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{Q(!1),el(null)},children:"Cancel"})]})]})]})})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>W(!0),children:"+ Create New Team"}),(0,a.jsx)(w.Z,{title:"Create Team",visible:P,width:800,footer:null,onOk:()=>{W(!1),d.resetFields()},onCancel:()=>{W(!1),d.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:eo,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),Y.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"Team Members"}),(0,a.jsx)(g,{children:"If you belong to multiple teams, this setting controls which teams members you see."}),l&&l.length>0?(0,a.jsx)(V.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{E(e)},children:e.team_alias},l))}):(0,a.jsxs)(g,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Member Name"}),(0,a.jsx)(q.Z,{children:"Role"})]})}),(0,a.jsx)(U.Z,{children:C?C.members_with_roles.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsx)(D.Z,{children:e.role})]},l)):null})]})}),C&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,team:t,onSubmit:n}=e,[r]=S.Z.useForm();return(0,a.jsx)(w.Z,{title:"Edit Team",visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n({...e,team_id:t.team_id}),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:ea,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),Y&&Y.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(A.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"team_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Edit Team"})})]})})},{visible:y,onCancel:()=>{b(!1),E(null)},team:C,onSubmit:ea})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-5",onClick:()=>H(!0),children:"+ Add member"}),(0,a.jsx)(w.Z,{title:"Add member",visible:G,width:800,footer:null,onOk:()=>{H(!1),c.resetFields()},onCancel:()=>{H(!1),c.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:ed,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,a.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,a.jsx)(S.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eM=e=>{let l,{searchParams:s,accessToken:t,showSSOBanner:n}=e,[o]=S.Z.useForm(),[d]=S.Z.useForm(),{Title:c,Paragraph:m}=$.default,[j,g]=(0,r.useState)(""),[Z,_]=(0,r.useState)(null),[y,v]=(0,r.useState)(null),[A,C]=(0,r.useState)(!1),[E,P]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[W,G]=(0,r.useState)(!1),[H,Y]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),Q=(0,i.useRouter)(),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)("");try{l=window.location.origin}catch(e){l=""}l+="/fallback/login";let en=()=>{X(!1)},ea=["proxy_admin","proxy_admin_viewer"];(0,r.useEffect)(()=>{if(Q){let{protocol:e,host:l}=window.location;et("".concat(e,"//").concat(l))}},[Q]),(0,r.useEffect)(()=>{(async()=>{if(null!=t){let e=[],l=await (0,u.Xd)(t,"proxy_admin_viewer");l.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy viewers: ".concat(l));let s=await (0,u.Xd)(t,"proxy_admin");s.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy admins: ".concat(s)),console.log("combinedList: ".concat(e)),_(e),el(await (0,u.lg)(t))}})()},[t]);let er=()=>{G(!1),d.resetFields(),o.resetFields()},ei=()=>{F(!1),d.resetFields(),o.resetFields()},eo=()=>{F(!1),C(!1),d.resetFields(),o.resetFields()},ed=()=>{G(!1),d.resetFields(),o.resetFields()},ec=e=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-8 mt-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},className:"mt-4",children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add member"})})]}),em=(e,l,s)=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"User Role",name:"user_role",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(V.Z,{value:l,children:ea.map((e,l)=>(0,a.jsx)(z.Z,{value:e,children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"user_id",hidden:!0,initialValue:s,valuePropName:"user_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s,disabled:!0})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Update role"})})]}),eu=async e=>{try{if(null!=t&&null!=Z){k.ZP.info("Making API Call");let l=await (0,u.pf)(t,e,null);console.log("response for team create call: ".concat(l));let s=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(l.user_id)),e.user_id===l.user_id));console.log("foundIndex: ".concat(s)),-1==s&&(console.log("updates admin with new user"),Z.push(l),_(Z)),k.ZP.success("Refresh tab to see updated user role"),G(!1)}}catch(e){console.error("Error creating the key:",e)}},eh=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call");let s=await (0,u.pf)(t,e,"proxy_admin_viewer");console.log("response for team create call: ".concat(s));let n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)});let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(s.user_id)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),_(Z)),o.resetFields(),P(!1)}}catch(e){console.error("Error creating the key:",e)}},ex=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call"),e.user_email,e.user_id;let s=await (0,u.pf)(t,e,"proxy_admin"),n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)}),console.log("response for team create call: ".concat(s));let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(n)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),_(Z)),o.resetFields(),F(!1)}}catch(e){console.error("Error creating the key:",e)}},ep=async e=>{if(null==t)return;let l={environment_variables:{PROXY_BASE_URL:e.proxy_base_url,GOOGLE_CLIENT_ID:e.google_client_id,GOOGLE_CLIENT_SECRET:e.google_client_secret}};(0,u.K_)(t,l)};return console.log("admins: ".concat(null==Z?void 0:Z.length)),(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsx)(c,{level:4,children:"Admin Access "}),(0,a.jsxs)(m,{children:[n&&(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#restrict-ui-access",children:"Requires SSO Setup"}),(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin: "})," Can create keys, teams, users, add models, etc."," ",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin Viewer: "}),"Can just view spend. They cannot create keys, teams or grant users access to new models."," "]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-2 w-full",children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(R.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Member Name"}),(0,a.jsx)(q.Z,{children:"Role"})]})}),(0,a.jsx)(U.Z,{children:Z?Z.map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsxs)(D.Z,{children:[" ",(null==ee?void 0:null===(s=ee[null==e?void 0:e.user_role])||void 0===s?void 0:s.ui_label)||"-"]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(M.Z,{icon:T.Z,size:"sm",onClick:()=>G(!0)}),(0,a.jsx)(w.Z,{title:"Update role",visible:W,width:800,footer:null,onOk:er,onCancel:ed,children:em(eu,e.user_role,e.user_id)})]})]},l)}):null})]})})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("div",{className:"flex justify-start",children:[(0,a.jsx)(p.Z,{className:"mr-4 mb-5",onClick:()=>F(!0),children:"+ Add admin"}),(0,a.jsx)(w.Z,{title:"Add admin",visible:O,width:800,footer:null,onOk:ei,onCancel:eo,children:ec(ex)}),(0,a.jsxs)(w.Z,{title:"Invitation Link",visible:A,width:800,footer:null,onOk:ei,onCancel:eo,children:[(0,a.jsx)(m,{children:"Copy and send the generated link to onboard this user to the proxy."}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(f.Z,{className:"text-base",children:"User ID"}),(0,a.jsx)(f.Z,{children:null==y?void 0:y.user_id})]}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(f.Z,{children:"Invitation Link"}),(0,a.jsxs)(f.Z,{children:[es,"/ui/onboarding?id=",null==y?void 0:y.id]})]}),(0,a.jsxs)("div",{className:"flex justify-end mt-5",children:[(0,a.jsx)("div",{}),(0,a.jsx)(b.CopyToClipboard,{text:"".concat(es,"/ui/onboarding?id=").concat(null==y?void 0:y.id),onCopy:()=>k.ZP.success("Copied!"),children:(0,a.jsx)(p.Z,{variant:"primary",children:"Copy invitation link"})})]})]}),(0,a.jsx)(p.Z,{className:"mb-5",onClick:()=>P(!0),children:"+ Add viewer"}),(0,a.jsx)(w.Z,{title:"Add viewer",visible:E,width:800,footer:null,onOk:()=>{P(!1),d.resetFields(),o.resetFields()},onCancel:()=>{P(!1),d.resetFields(),o.resetFields()},children:ec(eh)})]})})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(c,{level:4,children:"Add SSO"}),(0,a.jsxs)("div",{className:"flex justify-start mb-4",children:[(0,a.jsx)(p.Z,{onClick:()=>Y(!0),children:"Add SSO"}),(0,a.jsx)(w.Z,{title:"Add SSO",visible:H,width:800,footer:null,onOk:()=>{Y(!1),o.resetFields()},onCancel:()=>{Y(!1),o.resetFields()},children:(0,a.jsxs)(S.Z,{form:o,onFinish:e=>{ex(e),ep(e),Y(!1),X(!0)},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"PROXY BASE URL",name:"proxy_base_url",rules:[{required:!0,message:"Please enter the proxy base url"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT ID",name:"google_client_id",rules:[{required:!0,message:"Please enter the google client id"}],children:(0,a.jsx)(N.Z.Password,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT SECRET",name:"google_client_secret",rules:[{required:!0,message:"Please enter the google client secret"}],children:(0,a.jsx)(N.Z.Password,{})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})}),(0,a.jsxs)(w.Z,{title:"SSO Setup Instructions",visible:J,width:800,footer:null,onOk:en,onCancel:()=>{X(!1)},children:[(0,a.jsx)("p",{children:"Follow these steps to complete the SSO setup:"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"1. DO NOT Exit this TAB"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"2. Open a new tab, visit your proxy base url"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"3. Confirm your SSO is configured correctly and you can login on the new Tab"}),(0,a.jsx)(f.Z,{className:"mt-2",children:"4. If Step 3 is successful, you can close this tab"}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{onClick:en,children:"Done"})})]})]}),(0,a.jsxs)(ey.Z,{title:"Login without SSO",color:"teal",children:["If you need to login without sso, you can access"," ",(0,a.jsxs)("a",{href:l,target:"_blank",children:[(0,a.jsx)("b",{children:l})," "]})]})]})]})},eL=s(42556),eU=s(90252),eD=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:t,handleSubmit:n,premiumUser:r}=e,[i]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:i,onFinish:()=>{let e=i.getFieldsValue();Object.values(e).some(e=>""===e||null==e)?console.log("Some form fields are empty."):n(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{align:"center",children:[(0,a.jsx)(f.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),e.premium_field?r?(0,a.jsx)(S.Z.Item,{name:e.field_name,children:(0,a.jsx)(D.Z,{children:"Integer"===e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(D.Z,{children:(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})})}):(0,a.jsx)(S.Z.Item,{name:e.field_name,className:"mb-0",children:(0,a.jsx)(D.Z,{children:"Integer"===e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(D.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eU.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:O.Z,color:"red",onClick:()=>t(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Update Settings"})})]})},eK=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,r.useState)([]);return console.log("INSIDE ALERTING SETTINGS"),(0,r.useEffect)(()=>{l&&(0,u.RQ)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(eD,{alertingSettings:t,handleInputChange:(e,l)=>{n(t.map(s=>s.field_name===e?{...s,field_value:l}:s))},handleResetField:(e,s)=>{if(l)try{let l=t.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:l.field_default_value}:l);console.log("INSIDE HANDLE RESET FIELD"),n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||null==e||void 0==e)return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let n={...e,...s};try{(0,u.jA)(l,"alerting_args",n),k.ZP.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})};let eq=[{name:"slack",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}},{name:"langfuse",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}},{name:"openmeter",variables:{LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null,SLACK_WEBHOOK_URL:null}}];var eB=e=>{let{accessToken:l,userRole:s,userID:t,premiumUser:n}=e,[i,o]=(0,r.useState)(eq),[d,c]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[g]=S.Z.useForm(),[Z,_]=(0,r.useState)(null),[b,N]=(0,r.useState)([]),[A,C]=(0,r.useState)(""),[E,P]=(0,r.useState)({}),[T,O]=(0,r.useState)([]),M=e=>{T.includes(e)?O(T.filter(l=>l!==e)):O([...T,e])},V={llm_exceptions:"LLM Exceptions",llm_too_slow:"LLM Responses Too Slow",llm_requests_hanging:"LLM Requests Hanging",budget_alerts:"Budget Alerts (API Keys, Users)",db_exceptions:"Database Exceptions (Read/Write)",daily_reports:"Weekly/Monthly Spend Reports",outage_alerts:"Outage Alerts",region_outage_alerts:"Region Outage Alerts"};(0,r.useEffect)(()=>{l&&s&&t&&(0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e);let l=eq;o(l=l.map(l=>{let s=e.callbacks.find(e=>e.name===l.name);return s?{...l,variables:{...l.variables,...s.variables}}:l}));let s=e.alerts;if(console.log("alerts_data",s),s&&s.length>0){let e=s[0];console.log("_alert_info",e);let l=e.variables.SLACK_WEBHOOK_URL;console.log("catch_all_webhook",l),O(e.active_alerts),C(l),P(e.alerts_to_webhook)}c(s)})},[l,s,t]);let z=e=>T&&T.includes(e),W=()=>{if(!l)return;let e={};d.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));n&&n.value&&(e[s]=null==n?void 0:n.value)})}),console.log("updatedVariables",e);try{(0,u.K_)(l,{general_settings:{alerting:["email"]},environment_variables:e})}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Email settings updated successfully")},G=e=>{if(!l)return;let s=Object.fromEntries(Object.entries(e.variables).map(e=>{var l;let[s,t]=e;return[s,(null===(l=document.querySelector('input[name="'.concat(s,'"]')))||void 0===l?void 0:l.value)||t]}));console.log("updatedVariables",s),console.log("updateAlertTypes",b);let t={environment_variables:s,litellm_settings:{success_callback:[e.name]}};try{(0,u.K_)(l,t)}catch(e){k.ZP.error("Failed to update callback: "+e,20)}k.ZP.success("Callback updated successfully")},H=()=>{l&&g.validateFields().then(e=>{let s;if(console.log("Form values:",e),"langfuse"===e.callback){s={environment_variables:{LANGFUSE_PUBLIC_KEY:e.langfusePublicKey,LANGFUSE_SECRET_KEY:e.langfusePrivateKey},litellm_settings:{success_callback:[e.callback]}},(0,u.K_)(l,s);let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:null,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:e.langfusePublicKey,LANGFUSE_SECRET_KEY:e.langfusePrivateKey,OPENMETER_API_KEY:null}};o(i?[...i,t]:[t])}else if("slack"===e.callback){console.log("values.slackWebhookUrl: ".concat(e.slackWebhookUrl)),s={general_settings:{alerting:["slack"],alerting_threshold:300},environment_variables:{SLACK_WEBHOOK_URL:e.slackWebhookUrl}},(0,u.K_)(l,s),console.log("values.callback: ".concat(e.callback));let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:e.slackWebhookUrl,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:null}};o(i?[...i,t]:[t])}else if("openmeter"==e.callback){console.log("values.openMeterApiKey: ".concat(e.openMeterApiKey)),s={environment_variables:{OPENMETER_API_KEY:e.openMeterApiKey},litellm_settings:{success_callback:[e.callback]}},(0,u.K_)(l,s);let t={name:e.callback,variables:{SLACK_WEBHOOK_URL:null,LANGFUSE_HOST:null,LANGFUSE_PUBLIC_KEY:null,LANGFUSE_SECRET_KEY:null,OPENMETER_API_KEY:e.openMeterAPIKey}};o(i?[...i,t]:[t])}else s={error:"Invalid callback value"};h(!1),g.resetFields(),_(null)})};return l?(console.log("callbacks: ".concat(i)),(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(ey.Z,{title:"[UI] Presidio PII + Guardrails Coming Soon. https://docs.litellm.ai/docs/proxy/pii_masking",color:"sky"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(es.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(es.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(es.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Callback"}),(0,a.jsx)(q.Z,{children:"Callback Env Vars"})]})}),(0,a.jsx)(U.Z,{children:i.filter(e=>"slack"!==e.name).map((e,s)=>{var t;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:(0,a.jsx)(F.Z,{color:"emerald",children:e.name})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)("ul",{children:Object.entries(null!==(t=e.variables)&&void 0!==t?t:{}).filter(l=>{let[s,t]=l;return s.toLowerCase().includes(e.name)}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{children:[(0,a.jsx)(f.Z,{className:"mt-2",children:l}),"LANGFUSE_HOST"===l?(0,a.jsx)("p",{children:"default value=https://cloud.langfuse.com"}):(0,a.jsx)("div",{}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password"})]},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>G(e),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,e.name),className:"mx-2",children:"Test Callback"})]})]},s)})})]})})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(f.Z,{className:"my-2",children:["Alerts are only supported for Slack Webhook URLs. Get your webhook urls from"," ",(0,a.jsx)("a",{href:"https://api.slack.com/messaging/webhooks",target:"_blank",style:{color:"blue"},children:"here"})]}),(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{}),(0,a.jsx)(q.Z,{}),(0,a.jsx)(q.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(V).map((e,l)=>{let[s,t]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:"region_outage_alerts"==s?n?(0,a.jsx)(eL.Z,{id:"switch",name:"switch",checked:z(s),onChange:()=>M(s)}):(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})}):(0,a.jsx)(eL.Z,{id:"switch",name:"switch",checked:z(s),onChange:()=>M(s)})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(f.Z,{children:t})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(j.Z,{name:s,type:"password",defaultValue:E&&E[s]?E[s]:A})})]},l)})})]}),(0,a.jsx)(p.Z,{size:"xs",className:"mt-2",onClick:()=>{if(!l)return;let e={};Object.entries(V).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));console.log("key",s),console.log("webhookInput",n);let a=(null==n?void 0:n.value)||"";console.log("newWebhookValue",a),e[s]=a}),console.log("updatedAlertToWebhooks",e);let s={general_settings:{alert_to_webhook_url:e,alert_types:T}};console.log("payload",s);try{(0,u.K_)(l,s)}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Alerts updated successfully")},children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"slack"),className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(eK,{accessToken:l,premiumUser:n})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Email Settings"}),(0,a.jsxs)(f.Z,{children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: email alerts"})," ",(0,a.jsx)("br",{})]}),(0,a.jsx)("div",{className:"flex w-full",children:d.filter(e=>"email"===e.name).map((e,l)=>{var s;return(0,a.jsx)(D.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(x.Z,{numItems:2,children:Object.entries(null!==(s=e.variables)&&void 0!==s?s:{}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=n&&("EMAIL_LOGO_URL"===l||"EMAIL_SUPPORT_CONTACT"===l)?(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:(0,a.jsxs)(f.Z,{className:"mt-2",children:[" ","✨ ",l]})}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(f.Z,{className:"mt-2",children:l}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",style:{width:"400px"}})]}),(0,a.jsxs)("p",{style:{fontSize:"small",fontStyle:"italic"},children:["SMTP_HOST"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP host address, e.g. `smtp.resend.com`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PORT"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP port number, e.g. `587`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_USERNAME"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP username, e.g. `username`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PASSWORD"===l&&(0,a.jsx)("span",{style:{color:"red"},children:" Required * "}),"SMTP_SENDER_EMAIL"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the sender email address, e.g. `sender@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"TEST_EMAIL_ADDRESS"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Email Address to send `Test Email Alert` to. example: `info@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"EMAIL_LOGO_URL"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the Logo that appears in the email, pass a url to your logo"}),"EMAIL_SUPPORT_CONTACT"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the support email address that appears in the email. Default is support@berri.ai"})]})]},l)})})})},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>W(),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"email"),className:"mx-2",children:"Test Email Alerts"})]})})]})]})]}),(0,a.jsx)(w.Z,{title:"Add Callback",visible:m,onOk:H,width:800,onCancel:()=>{h(!1),g.resetFields(),_(null)},footer:null,children:(0,a.jsxs)(S.Z,{form:g,layout:"vertical",onFinish:H,children:[(0,a.jsx)(S.Z.Item,{label:"Callback",name:"callback",rules:[{required:!0,message:"Please select a callback"}],children:(0,a.jsxs)(v.default,{onChange:e=>{_(e)},children:[(0,a.jsx)(v.default.Option,{value:"langfuse",children:"langfuse"}),(0,a.jsx)(v.default.Option,{value:"openmeter",children:"openmeter"})]})}),"langfuse"===Z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"LANGFUSE_PUBLIC_KEY",name:"langfusePublicKey",rules:[{required:!0,message:"Please enter the public key"}],children:(0,a.jsx)(j.Z,{type:"password"})}),(0,a.jsx)(S.Z.Item,{label:"LANGFUSE_PRIVATE_KEY",name:"langfusePrivateKey",rules:[{required:!0,message:"Please enter the private key"}],children:(0,a.jsx)(j.Z,{type:"password"})})]}),"openmeter"==Z&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"OPENMETER_API_KEY",name:"openMeterApiKey",rules:[{required:!0,message:"Please enter the openmeter api key"}],children:(0,a.jsx)(j.Z,{type:"password"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Save"})})]})})]})):null};let{Option:eV}=v.default;var ez=e=>{let{models:l,accessToken:s,routerSettings:t,setRouterSettings:n}=e,[i]=S.Z.useForm(),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)("");return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>d(!0),children:"+ Add Fallbacks"}),(0,a.jsx)(w.Z,{title:"Add Fallbacks",visible:o,width:800,footer:null,onOk:()=>{d(!1),i.resetFields()},onCancel:()=>{d(!1),i.resetFields()},children:(0,a.jsxs)(S.Z,{form:i,onFinish:e=>{console.log(e);let{model_name:l,models:a}=e,r=[...t.fallbacks||[],{[l]:a}],o={...t,fallbacks:r};console.log(o);try{(0,u.K_)(s,{router_settings:o}),n(o)}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully"),d(!1),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Public Model Name",name:"model_name",rules:[{required:!0,message:"Set the model to fallback for"}],help:"required",children:(0,a.jsx)(V.Z,{defaultValue:c,children:l&&l.map((e,l)=>(0,a.jsx)(z.Z,{value:e,onClick:()=>m(e),children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Fallback Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsx)(ei.Z,{value:l,children:l&&l.filter(e=>e!=c).map(e=>(0,a.jsx)(eo.Z,{value:e,children:e},e))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Add Fallbacks"})})]})})]})},eW=s(12968);async function eG(e,l){console.log("isLocal:",!1);let s=window.location.origin,t=new eW.ZP.OpenAI({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0});try{let l=await t.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});k.ZP.success((0,a.jsxs)("span",{children:["Test model=",(0,a.jsx)("strong",{children:e}),", received model=",(0,a.jsx)("strong",{children:l.model}),". See"," ",(0,a.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}let eH={ttl:3600,lowest_latency_buffer:0},eY=e=>{let{selectedStrategy:l,strategyArgs:s,paramExplanation:t}=e;return(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(_.Z,{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Routing Strategy Specific Args"}),(0,a.jsx)(Z.Z,{children:"latency-based-routing"==l?(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(s).map(e=>{let[l,s]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:t[l]})]}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]})}):(0,a.jsx)(f.Z,{children:"No specific settings"})})]})};var eJ=e=>{let{accessToken:l,userRole:s,userID:t,modelData:n}=e,[i,o]=(0,r.useState)({}),[d,c]=(0,r.useState)({}),[m,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)(!1),[b]=S.Z.useForm(),[v,w]=(0,r.useState)(null),[N,I]=(0,r.useState)(null),[C,E]=(0,r.useState)(null),P={routing_strategy_args:"(dict) Arguments to pass to the routing strategy",routing_strategy:"(string) Routing strategy to use",allowed_fails:"(int) Number of times a deployment can fail before being added to cooldown",cooldown_time:"(int) time in seconds to cooldown a deployment after failure",num_retries:"(int) Number of retries for failed requests. Defaults to 0.",timeout:"(float) Timeout for requests. Defaults to None.",retry_after:"(int) Minimum time to wait before retrying a failed request",ttl:"(int) Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"(float) Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};(0,r.useEffect)(()=>{l&&s&&t&&((0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.router_settings)}),(0,u.YU)(l).then(e=>{g(e)}))},[l,s,t]);let T=async e=>{if(l){console.log("received key: ".concat(e)),console.log("routerSettings['fallbacks']: ".concat(i.fallbacks)),i.fallbacks.map(l=>(e in l&&delete l[e],l));try{await (0,u.K_)(l,{router_settings:i}),o({...i}),I(i.routing_strategy),k.ZP.success("Router settings updated successfully")}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}}},W=(e,l)=>{g(m.map(s=>s.field_name===e?{...s,field_value:l}:s))},G=(e,s)=>{if(!l)return;let t=m[s].field_value;if(null!=t&&void 0!=t)try{(0,u.jA)(l,e,t);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:!0}:l);g(s)}catch(e){}},H=(e,s)=>{if(l)try{(0,u.ao)(l,e);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:null}:l);g(s)}catch(e){}},Y=e=>{if(!l)return;console.log("router_settings",e);let s=Object.fromEntries(Object.entries(e).map(e=>{let[l,s]=e;if("routing_strategy_args"!==l&&"routing_strategy"!==l){var t;return[l,(null===(t=document.querySelector('input[name="'.concat(l,'"]')))||void 0===t?void 0:t.value)||s]}if("routing_strategy"==l)return[l,N];if("routing_strategy_args"==l&&"latency-based-routing"==N){let e={},l=document.querySelector('input[name="lowest_latency_buffer"]'),s=document.querySelector('input[name="ttl"]');return(null==l?void 0:l.value)&&(e.lowest_latency_buffer=Number(l.value)),(null==s?void 0:s.value)&&(e.ttl=Number(s.value)),console.log("setRoutingStrategyArgs: ".concat(e)),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,u.K_)(l,{router_settings:s})}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully")};return l?(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Loadbalancing"}),(0,a.jsx)(es.Z,{value:"2",children:"Fallbacks"}),(0,a.jsx)(es.Z,{value:"3",children:"General"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(y.Z,{children:"Router Settings"}),(0,a.jsxs)(R.Z,{children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"})]})}),(0,a.jsx)(U.Z,{children:Object.entries(i).filter(e=>{let[l,s]=e;return"fallbacks"!=l&&"context_window_fallbacks"!=l&&"routing_strategy_args"!=l}).map(e=>{let[l,s]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:P[l]})]}),(0,a.jsx)(D.Z,{children:"routing_strategy"==l?(0,a.jsxs)(V.Z,{defaultValue:s,className:"w-full max-w-md",onValueChange:I,children:[(0,a.jsx)(z.Z,{value:"usage-based-routing",children:"usage-based-routing"}),(0,a.jsx)(z.Z,{value:"latency-based-routing",children:"latency-based-routing"}),(0,a.jsx)(z.Z,{value:"simple-shuffle",children:"simple-shuffle"})]}):(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]}),(0,a.jsx)(eY,{selectedStrategy:N,strategyArgs:i&&i.routing_strategy_args&&Object.keys(i.routing_strategy_args).length>0?i.routing_strategy_args:eH,paramExplanation:P})]}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>Y(i),children:"Save Changes"})})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Model Name"}),(0,a.jsx)(q.Z,{children:"Fallbacks"})]})}),(0,a.jsx)(U.Z,{children:i.fallbacks&&i.fallbacks.map((e,s)=>Object.entries(e).map(e=>{let[t,n]=e;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:t}),(0,a.jsx)(D.Z,{children:Array.isArray(n)?n.join(", "):n}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(p.Z,{onClick:()=>eG(t,l),children:"Test Fallback"})}),(0,a.jsx)(D.Z,{children:(0,a.jsx)(M.Z,{icon:O.Z,size:"sm",onClick:()=>T(t)})})]},s.toString()+t)}))})]}),(0,a.jsx)(ez,{models:(null==n?void 0:n.data)?n.data.map(e=>e.model_name):[],accessToken:l,routerSettings:i,setRouterSettings:o})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Setting"}),(0,a.jsx)(q.Z,{children:"Value"}),(0,a.jsx)(q.Z,{children:"Status"}),(0,a.jsx)(q.Z,{children:"Action"})]})}),(0,a.jsx)(U.Z,{children:m.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(f.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),(0,a.jsx)(D.Z,{children:"Integer"==e.field_type?(0,a.jsx)(A.Z,{step:1,value:e.field_value,onChange:l=>W(e.field_name,l)}):null}),(0,a.jsx)(D.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eU.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(p.Z,{onClick:()=>G(e.field_name,l),children:"Update"}),(0,a.jsx)(M.Z,{icon:O.Z,color:"red",onClick:()=>H(e.field_name,l),children:"Reset"})]})]},l))})]})})})]})]})}):null},eX=e=>{let{isModalVisible:l,accessToken:s,setIsModalVisible:t,setBudgetList:n}=e,[r]=S.Z.useForm(),i=async e=>{if(null!=s&&void 0!=s)try{k.ZP.info("Making API Call");let l=await (0,u.Zr)(s,e);console.log("key create Response:",l),n(e=>e?[...e,l]:[l]),k.ZP.success("API Key Created"),r.resetFields()}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,a.jsx)(w.Z,{title:"Create Budget",visible:l,width:800,footer:null,onOk:()=>{t(!1),r.resetFields()},onCancel:()=>{t(!1),r.resetFields()},children:(0,a.jsxs)(S.Z,{form:r,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,a.jsx)(A.Z,{step:1,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,a.jsx)(A.Z,{step:1,precision:2,width:200})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(_.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(A.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(I.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},e$=e=>{let{accessToken:l}=e,[s,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&(0,u.O3)(l).then(e=>{i(e)})},[l]);let o=async(e,s)=>{if(null==l)return;k.ZP.info("Request made"),await (0,u.NV)(l,e);let t=[...n];t.splice(s,1),i(t),k.ZP.success("Budget Deleted.")};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsx)(p.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>t(!0),children:"+ Create Budget"}),(0,a.jsx)(eX,{accessToken:l,isModalVisible:s,setIsModalVisible:t,setBudgetList:i}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(f.Z,{children:"Create a budget to assign to customers."}),(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Budget ID"}),(0,a.jsx)(q.Z,{children:"Max Budget"}),(0,a.jsx)(q.Z,{children:"TPM"}),(0,a.jsx)(q.Z,{children:"RPM"})]})}),(0,a.jsx)(U.Z,{children:n.map((e,l)=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.budget_id}),(0,a.jsx)(D.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,a.jsx)(D.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,a.jsx)(D.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,a.jsx)(M.Z,{icon:O.Z,size:"sm",onClick:()=>o(e.budget_id,l)})]},l))})]})]}),(0,a.jsxs)("div",{className:"mt-5",children:[(0,a.jsx)(f.Z,{className:"text-base",children:"How to use budget id"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"Assign Budget to Customer"}),(0,a.jsx)(es.Z,{children:"Test it (Curl)"}),(0,a.jsx)(es.Z,{children:"Test it (OpenAI SDK)"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="{let{}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,a.jsx)(f.Z,{className:"mt-2 mb-2",children:"LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below "}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"OpenAI Python SDK"}),(0,a.jsx)(es.Z,{children:"LlamaIndex"}),(0,a.jsx)(es.Z,{children:"Langchain Py"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n '})})]})]})]})})})};async function e1(e,l,s,t){console.log("isLocal:",!1);let n=window.location.origin,a=new eW.ZP.OpenAI({apiKey:t,baseURL:n,dangerouslyAllowBrowser:!0});try{for await(let t of(await a.chat.completions.create({model:s,stream:!0,messages:[{role:"user",content:e}]})))console.log(t),t.choices[0].delta.content&&l(t.choices[0].delta.content)}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}var e2=e=>{let{accessToken:l,token:s,userRole:t,userID:n}=e,[i,o]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)(void 0),[y,b]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{let e=await (0,u.So)(l,n,t);if(console.log("model_info:",e),(null==e?void 0:e.data.length)>0){let l=e.data.map(e=>({value:e.id,label:e.id}));console.log(l),b(l),_(e.data[0].id)}}catch(e){console.error("Error fetching model info:",e)}})()},[l,n,t]);let S=(e,l)=>{g(s=>{let t=s[s.length-1];return t&&t.role===e?[...s.slice(0,s.length-1),{role:e,content:t.content+l}]:[...s,{role:e,content:l}]})},k=async()=>{if(""!==d.trim()&&i&&s&&t&&n){g(e=>[...e,{role:"user",content:d}]);try{Z&&await e1(d,e=>S("assistant",e),Z,i)}catch(e){console.error("Error fetching model response",e),S("assistant","Error fetching model response")}c("")}};if(t&&"Admin Viewer"==t){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to test models"})]})}return(0,a.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsx)(R.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsx)(en.Z,{children:(0,a.jsx)(es.Z,{children:"Chat"})}),(0,a.jsx)(er.Z,{children:(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("div",{className:"sm:max-w-2xl",children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"API Key"}),(0,a.jsx)(j.Z,{placeholder:"Type API Key here",type:"password",onValueChange:o,value:i})]}),(0,a.jsxs)(h.Z,{className:"mx-2",children:[(0,a.jsx)(f.Z,{children:"Select Model:"}),(0,a.jsx)(v.default,{placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),_(e)},options:y,style:{width:"200px"}})]})]})}),(0,a.jsxs)(L.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,a.jsx)(K.Z,{children:(0,a.jsx)(B.Z,{children:(0,a.jsx)(D.Z,{})})}),(0,a.jsx)(U.Z,{children:m.map((e,l)=>(0,a.jsx)(B.Z,{children:(0,a.jsx)(D.Z,{children:"".concat(e.role,": ").concat(e.content)})},l))})]}),(0,a.jsx)("div",{className:"mt-3",style:{position:"absolute",bottom:5,width:"95%"},children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(j.Z,{type:"text",value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&k()},placeholder:"Type your message..."}),(0,a.jsx)(p.Z,{onClick:k,className:"ml-2",children:"Send"})]})})]})})]})})})})},e4=s(33509),e5=s(95781);let{Sider:e8}=e4.default;var e3=e=>{let{setPage:l,userRole:s,defaultSelectedKey:t}=e;return"Admin Viewer"==s?(0,a.jsx)(e4.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,a.jsx)(e8,{width:120,children:(0,a.jsx)(e5.Z,{mode:"inline",defaultSelectedKeys:t||["4"],style:{height:"100%",borderRight:0},children:(0,a.jsx)(e5.Z.Item,{onClick:()=>l("usage"),children:"Usage"},"1")})})}):(0,a.jsx)(e4.default,{style:{minHeight:"100vh",maxWidth:"145px"},children:(0,a.jsx)(e8,{width:145,children:(0,a.jsxs)(e5.Z,{mode:"inline",defaultSelectedKeys:t||["1"],style:{height:"100%",borderRight:0},children:[(0,a.jsx)(e5.Z.Item,{onClick:()=>l("api-keys"),children:(0,a.jsx)(f.Z,{children:"API Keys"})},"1"),(0,a.jsx)(e5.Z.Item,{onClick:()=>l("llm-playground"),children:(0,a.jsx)(f.Z,{children:"Test Key"})},"3"),"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("models"),children:(0,a.jsx)(f.Z,{children:"Models"})},"2"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("usage"),children:(0,a.jsx)(f.Z,{children:"Usage"})},"4"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("teams"),children:(0,a.jsx)(f.Z,{children:"Teams"})},"6"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("users"),children:(0,a.jsx)(f.Z,{children:"Internal Users"})},"5"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("settings"),children:(0,a.jsx)(f.Z,{children:"Logging & Alerts"})},"8"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("budgets"),children:(0,a.jsx)(f.Z,{children:"Budgets"})},"9"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("general-settings"),children:(0,a.jsx)(f.Z,{children:"Router Settings"})},"10"):null,"Admin"==s?(0,a.jsx)(e5.Z.Item,{onClick:()=>l("admin-panel"),children:(0,a.jsx)(f.Z,{children:"Admin"})},"11"):null,(0,a.jsx)(e5.Z.Item,{onClick:()=>l("api_ref"),children:(0,a.jsx)(f.Z,{children:"API Reference"})},"12"),(0,a.jsx)(e5.Z.Item,{onClick:()=>l("model-hub"),children:(0,a.jsx)(f.Z,{children:"Model Hub"})},"14")]})})})},e6=s(67989),e9=s(52703),e7=e=>{let{accessToken:l,token:s,userRole:t,userID:n,keys:i,premiumUser:o}=e,d=new Date,[c,m]=(0,r.useState)([]),[j,g]=(0,r.useState)([]),[Z,_]=(0,r.useState)([]),[b,v]=(0,r.useState)([]),[S,k]=(0,r.useState)([]),[w,N]=(0,r.useState)([]),[A,I]=(0,r.useState)([]),[C,E]=(0,r.useState)([]),[P,T]=(0,r.useState)([]),[O,F]=(0,r.useState)([]),[M,W]=(0,r.useState)({}),[G,Y]=(0,r.useState)([]),[J,X]=(0,r.useState)(""),[$,Q]=(0,r.useState)(["all-tags"]),[em,eu]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),eh=new Date(d.getFullYear(),d.getMonth(),1),ex=new Date(d.getFullYear(),d.getMonth()+1,0),ep=ef(eh),ej=ef(ex);function eg(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",i),console.log("premium user in usage",o),(0,r.useEffect)(()=>{e_(em.from,em.to)},[em,$]);let eZ=async(e,s,t)=>{if(!e||!s||!l)return;s.setHours(23,59,59,999),e.setHours(0,0,0,0),console.log("uiSelectedKey",t);let n=await (0,u.b1)(l,t,e.toISOString(),s.toISOString());console.log("End user data updated successfully",n),v(n)},e_=async(e,s)=>{e&&s&&l&&(s.setHours(23,59,59,999),e.setHours(0,0,0,0),N((await (0,u.J$)(l,e.toISOString(),s.toISOString(),0===$.length?void 0:$)).spend_per_tag),console.log("Tag spend data updated successfully"))};function ef(e){let l=e.getFullYear(),s=e.getMonth()+1,t=e.getDate();return"".concat(l,"-").concat(s<10?"0"+s:s,"-").concat(t<10?"0"+t:t)}return console.log("Start date is ".concat(ep)),console.log("End date is ".concat(ej)),(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{if(console.log("user role: ".concat(t)),"Admin"==t||"Admin Viewer"==t){var e,a;let t=await (0,u.FC)(l);m(t);let n=await (0,u.OU)(l,s,ep,ej);console.log("provider_spend",n),F(n);let r=(await (0,u.tN)(l)).map(e=>({key:(e.key_alias||e.key_name||e.api_key).substring(0,10),spend:e.total_spend}));g(r);let i=(await (0,u.Au)(l)).map(e=>({key:e.model,spend:e.total_spend}));_(i);let o=await (0,u.mR)(l);console.log("teamSpend",o),k(o.daily_spend),E(o.teams);let d=o.total_spend_per_team;d=d.map(e=>(e.name=e.team_id||"",e.value=e.total_spend||0,e.value=e.value.toFixed(2),e)),T(d);let c=await (0,u.X)(l);I(c.tag_names);let h=await (0,u.J$)(l,null===(e=em.from)||void 0===e?void 0:e.toISOString(),null===(a=em.to)||void 0===a?void 0:a.toISOString(),void 0);N(h.spend_per_tag);let x=await (0,u.b1)(l,null,void 0,void 0);v(x),console.log("spend/user result",x);let p=await (0,u.wd)(l,ep,ej);W(p);let j=await (0,u.xA)(l,ep,ej);console.log("global activity per model",j),Y(j)}else"App Owner"==t&&await (0,u.HK)(l,s,t,n,ep,ej).then(async e=>{if(console.log("result from spend logs call",e),"daily_spend"in e){let l=e.daily_spend;console.log("daily spend",l),m(l);let s=e.top_api_keys;g(s)}else{let s=(await (0,u.e2)(l,function(e){let l=[];e.forEach(e=>{Object.entries(e).forEach(e=>{let[s,t]=e;"spend"!==s&&"startTime"!==s&&"models"!==s&&"users"!==s&&l.push({key:s,spend:t})})}),l.sort((e,l)=>Number(l.spend)-Number(e.spend));let s=l.slice(0,5).map(e=>e.key);return console.log("topKeys: ".concat(Object.keys(s[0]))),s}(e))).info.map(e=>({key:(e.key_name||e.key_alias).substring(0,10),spend:e.spend}));g(s),m(e)}})}catch(e){console.error("There was an error fetching the data",e)}})()},[l,s,t,n,ep,ej]),(0,a.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{className:"mt-2",children:[(0,a.jsx)(es.Z,{children:"All Up"}),(0,a.jsx)(es.Z,{children:"Team Based Usage"}),(0,a.jsx)(es.Z,{children:"Customer Usage"}),(0,a.jsx)(es.Z,{children:"Tag Based Usage"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(es.Z,{children:"Cost"}),(0,a.jsx)(es.Z,{children:"Activity"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,a.jsx)(H,{userID:n,userRole:t,accessToken:l,userSpend:null,selectedTeam:null}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Monthly Spend"}),(0,a.jsx)(ec.Z,{data:c,index:"date",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Top API Keys"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:j,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:80,tickGap:5,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Top Models"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:Z,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"✨ Spend by Provider"}),o?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(e9.Z,{className:"mt-4 h-40",variant:"pie",data:O,index:"provider",category:"spend"})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(L.Z,{children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Provider"}),(0,a.jsx)(q.Z,{children:"Spend"})]})}),(0,a.jsx)(U.Z,{children:O.map(e=>(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.provider}),(0,a.jsx)(D.Z,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":e.spend.toFixed(2)})]},e.provider))})]})})]})}):(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})]})]})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"All Up"}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(M.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:M.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(M.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:M.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),o?(0,a.jsx)(a.Fragment,{children:G.map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:eg,onValueChange:e=>console.log(e)})]})]})]},l))}):(0,a.jsx)(a.Fragment,{children:G&&G.length>0&&G.slice(0,1).map((e,l)=>(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Activity by Model"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see analytics for all models"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],valueFormatter:eg,categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]})]},l))})]})})]})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(h.Z,{numColSpan:2,children:[(0,a.jsxs)(R.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"Total Spend Per Team"}),(0,a.jsx)(e6.Z,{data:P})]}),(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Daily Spend Per Team"}),(0,a.jsx)(ec.Z,{className:"h-72",data:S,showLegend:!0,index:"date",categories:C,yAxisWidth:80,colors:["blue","green","yellow","red","purple"],stack:!0})]})]}),(0,a.jsx)(h.Z,{numColSpan:2})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:em,onValueChange:e=>{eu(e),eZ(e.from,e.to,null)}})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(f.Z,{children:"Select Key"}),(0,a.jsxs)(V.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(z.Z,{value:"all-keys",onClick:()=>{eZ(em.from,em.to,null)},children:"All Keys"},"all-keys"),null==i?void 0:i.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(z.Z,{value:String(l),onClick:()=>{eZ(em.from,em.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,a.jsx)(R.Z,{className:"mt-4",children:(0,a.jsxs)(L.Z,{className:"max-h-[70vh] min-h-[500px]",children:[(0,a.jsx)(K.Z,{children:(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(q.Z,{children:"Customer"}),(0,a.jsx)(q.Z,{children:"Spend"}),(0,a.jsx)(q.Z,{children:"Total Events"})]})}),(0,a.jsx)(U.Z,{children:null==b?void 0:b.map((e,l)=>{var s;return(0,a.jsxs)(B.Z,{children:[(0,a.jsx)(D.Z,{children:e.end_user}),(0,a.jsx)(D.Z,{children:null===(s=e.total_spend)||void 0===s?void 0:s.toFixed(4)}),(0,a.jsx)(D.Z,{children:e.total_count})]},l)})})]})})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(el.Z,{className:"mb-4",enableSelect:!0,value:em,onValueChange:e=>{eu(e),e_(e.from,e.to)}})}),(0,a.jsx)(h.Z,{children:o?(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),A&&A.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsx)(eo.Z,{value:String(e),children:e},e))]})}):(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),A&&A.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsxs)(z.Z,{value:String(e),disabled:!0,children:["✨ ",e," (Enterpise only Feature)"]},e))]})})})]}),(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(R.Z,{children:[(0,a.jsx)(y.Z,{children:"Spend Per Tag"}),(0,a.jsxs)(f.Z,{children:["Get Started Tracking cost per tag ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,a.jsx)(ec.Z,{className:"h-72",data:w,index:"name",categories:["spend"],colors:["blue"]})]})}),(0,a.jsx)(h.Z,{numColSpan:2})]})]})]})]})})},le=()=>{let{Title:e,Paragraph:l}=$.default,[s,t]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[u,h]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(!0),Z=(0,i.useSearchParams)(),[_,f]=(0,r.useState)({data:[]}),y=Z.get("userID"),b=Z.get("token"),[v,S]=(0,r.useState)("api-keys"),[k,w]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(b){let e=(0,X.o)(b);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),w(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e.toLowerCase())),console.log("Received user role length: ".concat(e.toLowerCase().length)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),t(l),"Admin Viewer"==l&&S("usage")}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e)),e.login_method?g("username_password"==e.login_method):console.log("User Email is not set ".concat(e)),e.premium_user&&o(e.premium_user)}}},[b]),(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{children:"Loading..."}),children:(0,a.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,a.jsx)(m,{userID:y,userRole:s,userEmail:d,showSSOBanner:j,premiumUser:n}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,a.jsx)("div",{className:"mt-8",children:(0,a.jsx)(e3,{setPage:S,userRole:s,defaultSelectedKey:null})}),"api-keys"==v?(0,a.jsx)(Q,{userID:y,userRole:s,teams:u,keys:x,setUserRole:t,userEmail:d,setUserEmail:c,setTeams:h,setKeys:p}):"models"==v?(0,a.jsx)(eE,{userID:y,userRole:s,token:b,keys:x,accessToken:k,modelData:_,setModelData:f,premiumUser:n}):"llm-playground"==v?(0,a.jsx)(e2,{userID:y,userRole:s,token:b,accessToken:k}):"users"==v?(0,a.jsx)(eF,{userID:y,userRole:s,token:b,keys:x,teams:u,accessToken:k,setKeys:p}):"teams"==v?(0,a.jsx)(eR,{teams:u,setTeams:h,searchParams:Z,accessToken:k,userID:y,userRole:s}):"admin-panel"==v?(0,a.jsx)(eM,{setTeams:h,searchParams:Z,accessToken:k,showSSOBanner:j}):"api_ref"==v?(0,a.jsx)(e0,{}):"settings"==v?(0,a.jsx)(eB,{userID:y,userRole:s,accessToken:k,premiumUser:n}):"budgets"==v?(0,a.jsx)(e$,{accessToken:k}):"general-settings"==v?(0,a.jsx)(eJ,{userID:y,userRole:s,accessToken:k,modelData:_}):"model-hub"==v?(0,a.jsx)(eQ.Z,{accessToken:k,publicPage:!1,premiumUser:n}):(0,a.jsx)(e7,{userID:y,userRole:s,token:b,accessToken:k,keys:x,premiumUser:n})]})]})})}},41134:function(e,l,s){"use strict";s.d(l,{Z:function(){return y}});var t=s(3827),n=s(64090),a=s(47907),r=s(777),i=s(16450),o=s(13810),d=s(92836),c=s(26734),m=s(41608),u=s(32126),h=s(23682),x=s(71801),p=s(42440),j=s(84174),g=s(50459),Z=s(6180),_=s(99129),f=s(67951),y=e=>{var l;let{accessToken:s,publicPage:y,premiumUser:b}=e,[v,S]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,A]=(0,n.useState)(!1),[I,C]=(0,n.useState)(!1),[E,P]=(0,n.useState)(null),T=(0,a.useRouter)();(0,n.useEffect)(()=>{s&&(async()=>{try{let e=await (0,r.kn)(s);console.log("ModelHubData:",e),w(e.data),(0,r.E9)(s,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&S(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}})()},[s,y]);let O=e=>{P(e),A(!0)},F=async()=>{s&&(0,r.jA)(s,"enable_public_model_hub",!0).then(e=>{C(!0)})},R=()=>{A(!1),C(!1),P(null)},M=()=>{A(!1),C(!1),P(null)},L=e=>{navigator.clipboard.writeText(e)};return(0,t.jsxs)("div",{children:[y&&v||!1==y?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsx)("div",{className:"relative w-full"}),(0,t.jsxs)("div",{className:"flex ".concat(y?"justify-between":"items-center"),children:[(0,t.jsx)(p.Z,{className:"ml-8 text-center ",children:"Model Hub"}),!1==y?b?(0,t.jsx)(i.Z,{className:"ml-4",onClick:()=>F(),children:"✨ Make Public"}):(0,t.jsx)(i.Z,{className:"ml-4",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Make Public"})}):(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("p",{children:"Filter by key:"}),(0,t.jsx)(x.Z,{className:"bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center",children:"/ui/model_hub?key="})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-6 sm:grid-cols-3 lg:grid-cols-4 pr-8",children:k&&k.map(e=>(0,t.jsxs)(o.Z,{className:"mt-5 mx-8",children:[(0,t.jsxs)("pre",{className:"flex justify-between",children:[(0,t.jsx)(p.Z,{children:e.model_group}),(0,t.jsx)(Z.Z,{title:e.model_group,children:(0,t.jsx)(j.Z,{onClick:()=>L(e.model_group),style:{cursor:"pointer",marginRight:"10px"}})})]}),(0,t.jsxs)("div",{className:"my-5",children:[(0,t.jsxs)(x.Z,{children:["Mode: ",e.mode]}),(0,t.jsxs)(x.Z,{children:["Supports Function Calling:"," ",(null==e?void 0:e.supports_function_calling)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Supports Vision:"," ",(null==e?void 0:e.supports_vision)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Max Input Tokens:"," ",(null==e?void 0:e.max_input_tokens)?null==e?void 0:e.max_input_tokens:"N/A"]}),(0,t.jsxs)(x.Z,{children:["Max Output Tokens:"," ",(null==e?void 0:e.max_output_tokens)?null==e?void 0:e.max_output_tokens:"N/A"]})]}),(0,t.jsx)("div",{style:{marginTop:"auto",textAlign:"right"},children:(0,t.jsxs)("a",{href:"#",onClick:()=>O(e),style:{color:"#1890ff",fontSize:"smaller"},children:["View more ",(0,t.jsx)(g.Z,{})]})})]},e.model_group))})]}):(0,t.jsxs)(o.Z,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(x.Z,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(_.Z,{title:"Public Model Hub",width:600,visible:I,footer:null,onOk:R,onCancel:M,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(x.Z,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(x.Z,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"/ui/model_hub?key="})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Z,{onClick:()=>{T.replace("/model_hub?key=".concat(s))},children:"See Page"})})]})}),(0,t.jsx)(_.Z,{title:E&&E.model_group?E.model_group:"Unknown Model",width:800,visible:N,footer:null,onOk:R,onCancel:M,children:E&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-4",children:(0,t.jsx)("strong",{children:"Model Information & Usage"})}),(0,t.jsxs)(c.Z,{children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:"OpenAI Python SDK"}),(0,t.jsx)(d.Z,{children:"Supported OpenAI Params"}),(0,t.jsx)(d.Z,{children:"LlamaIndex"}),(0,t.jsx)(d.Z,{children:"Langchain Py"})]}),(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(E.model_group,'", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:"".concat(null===(l=E.supported_openai_params)||void 0===l?void 0:l.map(e=>"".concat(e,"\n")).join(""))})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="'.concat(E.model_group,'", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(f.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "'.concat(E.model_group,'",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n ')})})]})]})]})})]})}}},function(e){e.O(0,[936,294,131,235,759,777,971,69,744],function(){return e(e.s=20661)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/chunks/app/page-7788673d99ee79d9.js b/ui/litellm-dashboard/out/_next/static/chunks/app/page-7788673d99ee79d9.js
new file mode 100644
index 000000000..15b2ad673
--- /dev/null
+++ b/ui/litellm-dashboard/out/_next/static/chunks/app/page-7788673d99ee79d9.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{20661:function(e,l,s){Promise.resolve().then(s.bind(s,31034))},31034:function(e,l,s){"use strict";s.r(l),s.d(l,{default:function(){return ls}});var t,n,a=s(3827),r=s(64090),i=s(47907),o=s(8792),d=s(40491),c=s(65270),m=e=>{let{userID:l,userRole:s,userEmail:t,showSSOBanner:n,premiumUser:r}=e;console.log("User ID:",l),console.log("userEmail:",t),console.log("showSSOBanner:",n),console.log("premiumUser:",r);let i=[{key:"1",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:["Role: ",s]}),(0,a.jsxs)("p",{children:["ID: ",l]}),(0,a.jsxs)("p",{children:["Premium User: ",String(r)]})]})},{key:"2",label:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("p",{children:"Logout"})})}];return(0,a.jsxs)("nav",{className:"left-0 right-0 top-0 flex justify-between items-center h-12 mb-4",children:[(0,a.jsx)("div",{className:"text-left my-2 absolute top-0 left-0",children:(0,a.jsx)("div",{className:"flex flex-col items-center",children:(0,a.jsx)(o.default,{href:"/",children:(0,a.jsx)("button",{className:"text-gray-800 rounded text-center",children:(0,a.jsx)("img",{src:"/get_image",width:160,height:160,alt:"LiteLLM Brand",className:"mr-2"})})})})}),(0,a.jsxs)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0 flex items-center justify-end space-x-2",children:[n?(0,a.jsx)("div",{style:{padding:"6px",borderRadius:"8px"},children:(0,a.jsx)("a",{href:"https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat",target:"_blank",style:{fontSize:"14px",textDecoration:"underline"},children:"Get enterpise license"})}):null,(0,a.jsx)("div",{style:{border:"1px solid #391085",padding:"6px",borderRadius:"8px"},children:(0,a.jsx)(d.Z,{menu:{items:i},children:(0,a.jsx)(c.Z,{children:t})})})]})]})},u=s(777),h=s(10384),x=s(46453),p=s(16450),j=s(52273),g=s(26780),Z=s(15595),f=s(6698),_=s(71801),y=s(42440),b=s(42308),v=s(50670),S=s(60620),k=s(80588),w=s(99129),N=s(44839),I=s(88707),A=s(1861);let{Option:C}=v.default;var P=e=>{let{userID:l,team:s,userRole:t,accessToken:n,data:i,setData:o}=e,[d]=S.Z.useForm(),[c,m]=(0,r.useState)(!1),[P,T]=(0,r.useState)(null),[E,O]=(0,r.useState)(null),[F,M]=(0,r.useState)([]),[R,D]=(0,r.useState)([]),L=()=>{m(!1),d.resetFields()},U=()=>{m(!1),T(null),d.resetFields()};(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===t)return;if(null!==n){let e=(await (0,u.So)(n,l,t)).data.map(e=>e.id);console.log("available_model_names:",e),M(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,t]);let q=async e=>{try{var s,t,a;let r=null!==(s=null==e?void 0:e.key_alias)&&void 0!==s?s:"",c=null!==(t=null==e?void 0:e.team_id)&&void 0!==t?t:null;if((null!==(a=null==i?void 0:i.filter(e=>e.team_id===c).map(e=>e.key_alias))&&void 0!==a?a:[]).includes(r))throw Error("Key alias ".concat(r," already exists for team with ID ").concat(c,", please provide another key alias"));k.ZP.info("Making API Call"),m(!0);let h=await (0,u.wX)(n,l,e);console.log("key create Response:",h),o(e=>e?[...e,h]:[h]),T(h.key),O(h.soft_budget),k.ZP.success("API Key Created"),d.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,r.useEffect)(()=>{D(s&&s.models.length>0?s.models.includes("all-proxy-models")?F:s.models:F)},[s,F]),(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>m(!0),children:"+ Create New Key"}),(0,a.jsx)(w.Z,{title:"Create Key",visible:c,width:800,footer:null,onOk:L,onCancel:U,children:(0,a.jsxs)(S.Z,{form:d,onFinish:q,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",hidden:!0,initialValue:s?s.team_id:null,valuePropName:"team_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s?s.team_alias:"",disabled:!0})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},onChange:e=>{e.includes("all-team-models")&&d.setFieldsValue({models:["all-team-models"]})},children:[(0,a.jsx)(C,{value:"all-team-models",children:"All Team Models"},"all-team-models"),R.map(e=>(0,a.jsx)(C,{value:e,children:e},e))]})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(f.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==s?void 0:s.max_budget)!==null&&(null==s?void 0:s.max_budget)!==void 0?null==s?void 0:s.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.max_budget&&l>s.max_budget)throw Error("Budget cannot exceed team max budget: $".concat(s.max_budget))}}],children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",help:"Team Reset Budget: ".concat((null==s?void 0:s.budget_duration)!==null&&(null==s?void 0:s.budget_duration)!==void 0?null==s?void 0:s.budget_duration:"None"),children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Tokens per minute Limit (TPM)",name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==s?void 0:s.tpm_limit)!==null&&(null==s?void 0:s.tpm_limit)!==void 0?null==s?void 0:s.tpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.tpm_limit&&l>s.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(s.tpm_limit))}}],children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Requests per minute Limit (RPM)",name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==s?void 0:s.rpm_limit)!==null&&(null==s?void 0:s.rpm_limit)!==void 0?null==s?void 0:s.rpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&s&&null!==s.rpm_limit&&l>s.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(s.rpm_limit))}}],children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Expire Key (eg: 30s, 30h, 30d)",name:"duration",className:"mt-8",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",className:"mt-8",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Key"})})]})}),P&&(0,a.jsx)(w.Z,{visible:c,onOk:L,onCancel:U,footer:null,children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Save your Key"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons, ",(0,a.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,a.jsx)(h.Z,{numColSpan:1,children:null!=P?(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mt-3",children:"API Key:"}),(0,a.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,a.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:P})}),(0,a.jsx)(b.CopyToClipboard,{text:P,onCopy:()=>{k.ZP.success("API Key copied to clipboard")},children:(0,a.jsx)(p.Z,{className:"mt-3",children:"Copy API Key"})})]}):(0,a.jsx)(_.Z,{children:"Key being created, this might take 30s"})})]})})]})},T=s(9454),E=s(98941),O=s(33393),F=s(5),M=s(13810),R=s(61244),D=s(10827),L=s(3851),U=s(2044),q=s(64167),V=s(74480),z=s(7178),B=s(95093),K=s(27166);let{Option:W}=v.default;var H=e=>{let{userID:l,userRole:s,accessToken:t,selectedTeam:n,data:i,setData:o,teams:d}=e,[c,m]=(0,r.useState)(!1),[h,x]=(0,r.useState)(!1),[j,g]=(0,r.useState)(null),[Z,f]=(0,r.useState)(null),[b,C]=(0,r.useState)(null),[P,H]=(0,r.useState)(""),[G,J]=(0,r.useState)(!1),[Y,X]=(0,r.useState)(!1),[$,Q]=(0,r.useState)(null),[ee,el]=(0,r.useState)([]),es=new Set,[et,en]=(0,r.useState)(es);(0,r.useEffect)(()=>{(async()=>{try{if(null===l)return;if(null!==t&&null!==s){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),el(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[t,l,s]),(0,r.useEffect)(()=>{if(d){let e=new Set;d.forEach((l,s)=>{let t=l.team_id;e.add(t)}),en(e)}},[d]);let ea=e=>{console.log("handleEditClick:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),Q(e),J(!0)},er=async e=>{if(null==t)return;let l=e.token;e.key=l,console.log("handleEditSubmit:",e);let s=await (0,u.Nc)(t,e);console.log("handleEditSubmit: newKeyValues",s),i&&o(i.map(e=>e.token===l?s:e)),k.ZP.success("Key updated successfully"),J(!1),Q(null)},ei=async e=>{console.log("handleDelete:",e),null==e.token&&null!==e.token_id&&(e.token=e.token_id),null!=i&&(g(e.token),localStorage.removeItem("userData"+l),x(!0))},eo=async()=>{if(null!=j&&null!=i){try{await (0,u.I1)(t,j);let e=i.filter(e=>e.token!==j);o(e)}catch(e){console.error("Error deleting the key:",e)}x(!1),g(null)}};if(null!=i)return console.log("RERENDER TRIGGERED"),(0,a.jsxs)("div",{children:[(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4 mt-2",children:[(0,a.jsxs)(D.Z,{className:"mt-5 max-h-[300px] min-h-[300px]",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Key Alias"}),(0,a.jsx)(V.Z,{children:"Secret Key"}),(0,a.jsx)(V.Z,{children:"Spend (USD)"}),(0,a.jsx)(V.Z,{children:"Budget (USD)"}),(0,a.jsx)(V.Z,{children:"Models"}),(0,a.jsx)(V.Z,{children:"TPM / RPM Limits"})]})}),(0,a.jsx)(L.Z,{children:i.map(e=>{if(console.log(e),"litellm-dashboard"===e.team_id)return null;if(n){if(console.log("item team id: ".concat(e.team_id,", knownTeamIDs.has(item.team_id): ").concat(et.has(e.team_id),", selectedTeam id: ").concat(n.team_id)),(null!=n.team_id||null===e.team_id||et.has(e.team_id))&&e.team_id!=n.team_id)return null;console.log("item team id: ".concat(e.team_id,", is returned"))}return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{style:{maxWidth:"2px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!=e.key_alias?(0,a.jsx)(_.Z,{children:e.key_alias}):(0,a.jsx)(_.Z,{children:"Not Set"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:e.key_name})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:(()=>{try{return parseFloat(e.spend).toFixed(4)}catch(l){return e.spend}})()})}),(0,a.jsx)(U.Z,{children:null!=e.max_budget?(0,a.jsx)(_.Z,{children:e.max_budget}):(0,a.jsx)(_.Z,{children:"Unlimited"})}),(0,a.jsx)(U.Z,{children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(a.Fragment,{children:n&&n.models&&n.models.length>0?n.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l)):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:"all-proxy-models"})})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):"all-team-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Team Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(U.Z,{children:(0,a.jsxs)(_.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{})," RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{onClick:()=>{Q(e),X(!0)},icon:T.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:Y,onCancel:()=>{X(!1),Q(null)},footer:null,width:800,children:$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 mt-8",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Spend"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:(()=>{try{return parseFloat($.spend).toFixed(4)}catch(e){return $.spend}})()})})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Budget"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.max_budget?(0,a.jsx)(a.Fragment,{children:$.max_budget}):(0,a.jsx)(a.Fragment,{children:"Unlimited"})})})]},e.name),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)("p",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:"Expires"}),(0,a.jsx)("div",{className:"mt-2 flex items-baseline space-x-2.5",children:(0,a.jsx)("p",{className:"text-tremor-default font-small text-tremor-content-strong dark:text-dark-tremor-content-strong",children:null!=$.expires?(0,a.jsx)(a.Fragment,{children:new Date($.expires).toLocaleString(void 0,{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}):(0,a.jsx)(a.Fragment,{children:"Never"})})})]},e.name)]}),(0,a.jsxs)(M.Z,{className:"my-4",children:[(0,a.jsx)(y.Z,{children:"Token Name"}),(0,a.jsx)(_.Z,{className:"my-1",children:$.key_alias?$.key_alias:$.key_name}),(0,a.jsx)(y.Z,{children:"Token ID"}),(0,a.jsx)(_.Z,{className:"my-1 text-[12px]",children:$.token}),(0,a.jsx)(y.Z,{children:"Metadata"}),(0,a.jsx)(_.Z,{className:"my-1",children:(0,a.jsxs)("pre",{children:[JSON.stringify($.metadata)," "]})})]}),(0,a.jsx)(p.Z,{className:"mx-auto flex items-center",onClick:()=>{X(!1),Q(null)},children:"Close"})]})}),(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>ea(e)}),(0,a.jsx)(R.Z,{onClick:()=>ei(e),icon:O.Z,size:"sm"})]})]},e.token)})})]}),h&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Key"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this key ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:eo,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{x(!1),g(null)},children:"Cancel"})]})]})]})})]}),$&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,token:t,onSubmit:i}=e,[o]=S.Z.useForm(),[c,m]=(0,r.useState)(n),[u,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1);return(0,a.jsx)(w.Z,{title:"Edit Key",visible:l,width:800,footer:null,onOk:()=>{o.validateFields().then(e=>{o.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:o,onFinish:er,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Key Name",name:"key_alias",rules:[{required:!0,message:"Please input a key name"}],help:"required",children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",rules:[{validator:(e,l)=>{let s=l.filter(e=>!c.models.includes(e)&&"all-team-models"!==e&&"all-proxy-models"!==e&&!c.models.includes("all-proxy-models"));return(console.log("errorModels: ".concat(s)),s.length>0)?Promise.reject("Some models are not part of the new team's models - ".concat(s,"Team models: ").concat(c.models)):Promise.resolve()}}],children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(W,{value:"all-team-models",children:"All Team Models"},"all-team-models"),c&&c.models?c.models.includes("all-proxy-models")?ee.filter(e=>"all-proxy-models"!==e).map(e=>(0,a.jsx)(W,{value:e,children:e},e)):c.models.map(e=>(0,a.jsx)(W,{value:e,children:e},e)):ee.map(e=>(0,a.jsx)(W,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Max Budget (USD)",name:"max_budget",help:"Budget cannot exceed team max budget: ".concat((null==c?void 0:c.max_budget)!==null&&(null==c?void 0:c.max_budget)!==void 0?null==c?void 0:c.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&c&&null!==c.max_budget&&l>c.max_budget)throw console.log("keyTeam.max_budget: ".concat(c.max_budget)),Error("Budget cannot exceed team max budget: $".concat(c.max_budget))}}],children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"token",name:"token",hidden:!0}),(0,a.jsx)(S.Z.Item,{label:"Team",name:"team_id",help:"the team this key belongs to",children:(0,a.jsx)(B.Z,{value:t.team_alias,children:null==d?void 0:d.map((e,l)=>(0,a.jsx)(K.Z,{value:e.team_id,onClick:()=>m(e),children:e.team_alias},l))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Edit Key"})})]})})},{visible:G,onCancel:()=>{J(!1),Q(null)},token:$,onSubmit:er})]})},G=e=>{let{userID:l,userRole:s,accessToken:t,userSpend:n,selectedTeam:i}=e;console.log("userSpend: ".concat(n));let[o,d]=(0,r.useState)(null!==n?n:0),[c,m]=(0,r.useState)(0),[h,x]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(t&&l&&s&&"Admin"===s&&null==n)try{let e=await (0,u.Qy)(t);e&&(e.spend?d(e.spend):d(0),e.max_budget?m(e.max_budget):m(0))}catch(e){console.error("Error fetching global spend data:",e)}};(async()=>{try{if(null===l||null===s)return;if(null!==t){let e=(await (0,u.So)(t,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),x(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[s,t,l]),(0,r.useEffect)(()=>{null!==n&&d(n)},[n]);let p=[];i&&i.models&&(p=i.models),p&&p.includes("all-proxy-models")?(console.log("user models:",h),p=h):p&&p.includes("all-team-models")?p=i.models:p&&0===p.length&&(p=h);let j=void 0!==o?o.toFixed(4):null;return console.log("spend in view user spend: ".concat(o)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("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:["$",j]})]})})},J=e=>{let{userID:l,userRole:s,selectedTeam:t,accessToken:n}=e,[i,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{if(null===l||null===s)return;if(null!==n){let e=(await (0,u.So)(n,l,s)).data.map(e=>e.id);console.log("available_model_names:",e),o(e)}}catch(e){console.error("Error fetching user models:",e)}})()},[n,l,s]);let d=[];return t&&t.models&&(d=t.models),d&&d.includes("all-proxy-models")&&(console.log("user models:",i),d=i),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"mb-5",children:(0,a.jsx)("p",{className:"text-3xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:null==t?void 0:t.team_alias})})})},Y=e=>{let l,{teams:s,setSelectedTeam:t,userRole:n}=e,i={models:[],team_id:null,team_alias:"Default Team"},[o,d]=(0,r.useState)(i);return(l="App User"===n?s:s?[...s,i]:[i],"App User"===n)?null:(0,a.jsxs)("div",{className:"mt-5 mb-5",children:[(0,a.jsx)(y.Z,{children:"Select Team"}),(0,a.jsx)(_.Z,{children:"If you belong to multiple teams, this setting controls which team is used by default when creating new API Keys."}),(0,a.jsxs)(_.Z,{className:"mt-3 mb-3",children:[(0,a.jsx)("b",{children:"Default Team:"})," If no team_id is set for a key, it will be grouped under here."]}),l&&l.length>0?(0,a.jsx)(B.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(K.Z,{value:String(l),onClick:()=>t(e),children:e.team_alias},l))}):(0,a.jsxs)(_.Z,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]})},X=s(37963),$=s(97482);console.log("isLocal:",!1);var Q=e=>{let{userID:l,userRole:s,teams:t,keys:n,setUserRole:o,userEmail:d,setUserEmail:c,setTeams:m,setKeys:p}=e,[j,g]=(0,r.useState)(null),Z=(0,i.useSearchParams)();Z.get("viewSpend"),(0,i.useRouter)();let f=Z.get("token"),[_,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[S,k]=(0,r.useState)([]),w={models:[],team_alias:"Default Team",team_id:null},[N,I]=(0,r.useState)(t?t[0]:w);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,r.useEffect)(()=>{if(f){let e=(0,X.o)(f);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),y(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";case"internal_user":return"Internal User";case"internal_viewer":return"Internal Viewer";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),o(l)}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e))}}if(l&&_&&s&&!n&&!j){let e=sessionStorage.getItem("userModels"+l);e?k(JSON.parse(e)):(async()=>{try{let e=await (0,u.Br)(_,l,s,!1,null,null);if(console.log("received teams in user dashboard: ".concat(Object.keys(e),"; team values: ").concat(Object.entries(e.teams))),"Admin"==s){let e=await (0,u.Qy)(_);g(e),console.log("globalSpend:",e)}else g(e.user_info);p(e.keys),m(e.teams);let t=[...e.teams];t.length>0?(console.log("response['teams']: ".concat(t)),I(t[0])):I(w),sessionStorage.setItem("userData"+l,JSON.stringify(e.keys)),sessionStorage.setItem("userSpendData"+l,JSON.stringify(e.user_info));let n=(await (0,u.So)(_,l,s)).data.map(e=>e.id);console.log("available_model_names:",n),k(n),console.log("userModels:",S),sessionStorage.setItem("userModels"+l,JSON.stringify(n))}catch(e){console.error("There was an error fetching the data",e)}})()}},[l,f,_,n,s]),(0,r.useEffect)(()=>{if(null!==n&&null!=N&&null!==N.team_id){let e=0;for(let l of n)N.hasOwnProperty("team_id")&&null!==l.team_id&&l.team_id===N.team_id&&(e+=l.spend);v(e)}else if(null!==n){let e=0;for(let l of n)e+=l.spend;v(e)}},[N]),null==l||null==f){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}if(null==_)return null;if(null==s&&o("App Owner"),s&&"Admin Viewer"==s){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to create keys"})]})}return console.log("inside user dashboard, selected team",N),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(J,{userID:l,userRole:s,selectedTeam:N||null,accessToken:_}),(0,a.jsx)(G,{userID:l,userRole:s,accessToken:_,userSpend:b,selectedTeam:N||null}),(0,a.jsx)(H,{userID:l,userRole:s,accessToken:_,selectedTeam:N||null,data:n,setData:p,teams:t}),(0,a.jsx)(P,{userID:l,team:N||null,userRole:s,accessToken:_,data:n,setData:p},N?N.team_id:null),(0,a.jsx)(Y,{teams:t,setSelectedTeam:I,userRole:s})]})})})},ee=s(49167),el=s(35087),es=s(92836),et=s(26734),en=s(41608),ea=s(32126),er=s(23682),ei=s(47047),eo=s(76628),ed=s(25707),ec=s(44041),em=s(6180),eu=s(28683),eh=s(38302),ex=s(66242),ep=s(78578),ej=s(63954),eg=s(34658),eZ=e=>{let{modelID:l,accessToken:s}=e,[t,n]=(0,r.useState)(!1),i=async()=>{try{k.ZP.info("Making API Call"),n(!0);let e=await (0,u.Og)(s,l);console.log("model delete Response:",e),k.ZP.success("Model ".concat(l," deleted successfully")),n(!1)}catch(e){console.error("Error deleting the model:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{onClick:()=>n(!0),icon:O.Z,size:"sm"}),(0,a.jsx)(w.Z,{open:t,onOk:i,okType:"danger",onCancel:()=>n(!1),children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Delete Model"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)("p",{children:"Are you sure you want to delete this model? This action is irreversible."})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Model ID: ",(0,a.jsx)("b",{children:l})]})})]})})]})},ef=s(97766),e_=s(46495),ey=s(18190),eb=s(91118),ev=e=>{let{modelMetrics:l,modelMetricsCategories:s,customTooltip:t,premiumUser:n}=e;return n?(0,a.jsx)(eb.Z,{title:"Time to First token (s)",className:"h-72",data:l,index:"date",showLegend:!1,categories:s,colors:["indigo","rose"],connectNulls:!0,customTooltip:t}):(0,a.jsxs)("div",{children:[(0,a.jsx)(ey.Z,{title:"✨ Enterprise Feature",color:"teal",className:"mt-2 mb-4",children:"Enterprise features are available for users with a specific license, please contact LiteLLM to unlock this limitation."}),(0,a.jsx)(p.Z,{variant:"primary",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get in touch"})})]})},eS=e=>{let{fields:l,selectedProvider:s}=e;return 0===l.length?null:(0,a.jsx)(a.Fragment,{children:l.map(e=>(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:e.field_name.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),name:e.field_name,tooltip:e.field_description,className:"mb-2",children:(0,a.jsx)(j.Z,{placeholder:e.field_value,type:"password"})},e.field_name))})},ek=s(67951);let{Title:ew,Link:eN}=$.default;(t=n||(n={})).OpenAI="OpenAI",t.Azure="Azure",t.Anthropic="Anthropic",t.Google_AI_Studio="Google AI Studio",t.Bedrock="Amazon Bedrock",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.Databricks="Databricks";let eI={OpenAI:"openai",Azure:"azure",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",OpenAI_Compatible:"openai",Vertex_AI:"vertex_ai",Databricks:"databricks"},eA={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"},eC=async(e,l,s)=>{try{let t=Array.isArray(e.model)?e.model:[e.model];console.log("received deployments: ".concat(t)),console.log("received type of deployments: ".concat(typeof t)),t.forEach(async s=>{console.log("litellm_model: ".concat(s));let t={},n={};t.model=s;let a="";for(let[l,s]of(console.log("formValues add deployment:",e),Object.entries(e)))if(""!==s){if("model_name"==l)a+=s;else if("custom_llm_provider"==l)continue;else if("model"==l)continue;else if("base_model"===l)n[l]=s;else if("litellm_extra_params"==l){console.log("litellm_extra_params:",s);let e={};if(s&&void 0!=s){try{e=JSON.parse(s)}catch(e){throw k.ZP.error("Failed to parse LiteLLM Extra Params: "+e,10),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,s]of Object.entries(e))t[l]=s}}else t[l]=s}let r={model_name:a,litellm_params:t,model_info:n},i=await (0,u.kK)(l,r);console.log("response for model create call: ".concat(i.data))}),s.resetFields()}catch(e){k.ZP.error("Failed to create model: "+e,10)}};var eP=e=>{var l,s,t;let i,{accessToken:o,token:d,userRole:c,userID:m,modelData:h={data:[]},keys:g,setModelData:Z,premiumUser:f}=e,[b,v]=(0,r.useState)([]),[N]=S.Z.useForm(),[C,P]=(0,r.useState)(null),[O,W]=(0,r.useState)(""),[H,G]=(0,r.useState)([]),J=Object.values(n).filter(e=>isNaN(Number(e))),[Y,X]=(0,r.useState)([]),[Q,ey]=(0,r.useState)("OpenAI"),[eb,eP]=(0,r.useState)(""),[eT,eE]=(0,r.useState)(!1),[eO,eF]=(0,r.useState)(!1),[eM,eR]=(0,r.useState)(null),[eD,eL]=(0,r.useState)([]),[eU,eq]=(0,r.useState)(null),[eV,ez]=(0,r.useState)([]),[eB,eK]=(0,r.useState)([]),[eW,eH]=(0,r.useState)([]),[eG,eJ]=(0,r.useState)([]),[eY,eX]=(0,r.useState)([]),[e$,eQ]=(0,r.useState)([]),[e0,e1]=(0,r.useState)([]),[e2,e4]=(0,r.useState)([]),[e5,e8]=(0,r.useState)([]),[e3,e6]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),[e9,e7]=(0,r.useState)(null),[le,ll]=(0,r.useState)(0),[ls,lt]=(0,r.useState)({}),[ln,la]=(0,r.useState)([]),[lr,li]=(0,r.useState)(!1),[lo,ld]=(0,r.useState)(null),[lc,lm]=(0,r.useState)(null),[lu,lh]=(0,r.useState)([]);(0,r.useEffect)(()=>{lb(eU,e3.from,e3.to)},[lo,lc]);let lx=e=>{eR(e),eE(!0)},lp=e=>{eR(e),eF(!0)},lj=async e=>{if(console.log("handleEditSubmit:",e),null==o)return;let l={},s=null;for(let[t,n]of Object.entries(e))"model_id"!==t?l[t]=n:s=n;let t={litellm_params:l,model_info:{id:s}};console.log("handleEditSubmit payload:",t);try{await (0,u.um)(o,t),k.ZP.success("Model updated successfully, restart server to see updates"),eE(!1),eR(null)}catch(e){console.log("Error occurred")}},lg=()=>{W(new Date().toLocaleString())},lZ=async()=>{if(!o){console.error("Access token is missing");return}console.log("new modelGroupRetryPolicy:",e9);try{await (0,u.K_)(o,{router_settings:{model_group_retry_policy:e9}}),k.ZP.success("Retry settings saved successfully")}catch(e){console.error("Failed to save retry settings:",e),k.ZP.error("Failed to save retry settings")}};if((0,r.useEffect)(()=>{if(!o||!d||!c||!m)return;let e=async()=>{try{var e,l,s,t,n,a,r,i,d,h,x,p;let j=await (0,u.hy)(o);X(j);let g=await (0,u.AZ)(o,m,c);console.log("Model data response:",g.data),Z(g);let f=new Set;for(let e=0;e0&&(y=_[_.length-1],console.log("_initial_model_group:",y),eq(y)),console.log("selectedModelGroup:",eU);let b=await (0,u.o6)(o,m,c,y,null===(e=e3.from)||void 0===e?void 0:e.toISOString(),null===(l=e3.to)||void 0===l?void 0:l.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model metrics response:",b),eK(b.data),eH(b.all_api_bases);let v=await (0,u.Rg)(o,y,null===(s=e3.from)||void 0===s?void 0:s.toISOString(),null===(t=e3.to)||void 0===t?void 0:t.toISOString());eJ(v.data),eX(v.all_api_bases);let S=await (0,u.N8)(o,m,c,y,null===(n=e3.from)||void 0===n?void 0:n.toISOString(),null===(a=e3.to)||void 0===a?void 0:a.toISOString(),null==lo?void 0:lo.token,lc);console.log("Model exceptions response:",S),eQ(S.data),e1(S.exception_types);let k=await (0,u.fP)(o,m,c,y,null===(r=e3.from)||void 0===r?void 0:r.toISOString(),null===(i=e3.to)||void 0===i?void 0:i.toISOString(),null==lo?void 0:lo.token,lc),w=await (0,u.n$)(o,null===(d=e3.from)||void 0===d?void 0:d.toISOString().split("T")[0],null===(h=e3.to)||void 0===h?void 0:h.toISOString().split("T")[0],y);lt(w);let N=await (0,u.v9)(o,null===(x=e3.from)||void 0===x?void 0:x.toISOString().split("T")[0],null===(p=e3.to)||void 0===p?void 0:p.toISOString().split("T")[0],y);la(N),console.log("dailyExceptions:",w),console.log("dailyExceptionsPerDeplyment:",N),console.log("slowResponses:",k),e8(k);let I=await (0,u.j2)(o);lh(null==I?void 0:I.end_users);let A=(await (0,u.BL)(o,m,c)).router_settings;console.log("routerSettingsInfo:",A);let C=A.model_group_retry_policy,P=A.num_retries;console.log("model_group_retry_policy:",C),console.log("default_retries:",P),e7(C),ll(P)}catch(e){console.error("There was an error fetching the model data",e)}};o&&d&&c&&m&&e();let l=async()=>{let e=await (0,u.qm)();console.log("received model cost map data: ".concat(Object.keys(e))),P(e)};null==C&&l(),lg()},[o,d,c,m,C,O]),!h||!o||!d||!c||!m)return(0,a.jsx)("div",{children:"Loading..."});let lf=[];for(let e=0;e(console.log("GET PROVIDER CALLED! - ".concat(C)),null!=C&&"object"==typeof C&&e in C)?C[e].litellm_provider:"openai";if(n){let e=n.split("/"),l=e[0];r=1===e.length?u(n):l}else r="openai";a&&(i=null==a?void 0:a.input_cost_per_token,o=null==a?void 0:a.output_cost_per_token,d=null==a?void 0:a.max_tokens,c=null==a?void 0:a.max_input_tokens),(null==t?void 0:t.litellm_params)&&(m=Object.fromEntries(Object.entries(null==t?void 0:t.litellm_params).filter(e=>{let[l]=e;return"model"!==l&&"api_base"!==l}))),h.data[e].provider=r,h.data[e].input_cost=i,h.data[e].output_cost=o,h.data[e].input_cost&&(h.data[e].input_cost=(1e6*Number(h.data[e].input_cost)).toFixed(2)),h.data[e].output_cost&&(h.data[e].output_cost=(1e6*Number(h.data[e].output_cost)).toFixed(2)),h.data[e].max_tokens=d,h.data[e].max_input_tokens=c,h.data[e].api_base=null==t?void 0:null===(s=t.litellm_params)||void 0===s?void 0:s.api_base,h.data[e].cleanedLitellmParams=m,lf.push(t.model_name),console.log(h.data[e])}if(c&&"Admin Viewer"==c){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let l_=e=>{console.log("received provider string: ".concat(e));let l=Object.keys(n).find(l=>n[l]===e);if(l){let e=eI[l];console.log("mappingResult: ".concat(e));let s=[];"object"==typeof C&&Object.entries(C).forEach(l=>{let[t,n]=l;null!==n&&"object"==typeof n&&"litellm_provider"in n&&(n.litellm_provider===e||n.litellm_provider.includes(e))&&s.push(t)}),G(s),console.log("providerModels: ".concat(H))}},ly=async()=>{try{k.ZP.info("Running health check..."),eP("");let e=await (0,u.EY)(o);eP(e)}catch(e){console.error("Error running health check:",e),eP("Error running health check")}},lb=async(e,l,s)=>{if(console.log("Updating model metrics for group:",e),!o||!m||!c||!l||!s)return;console.log("inside updateModelMetrics - startTime:",l,"endTime:",s),eq(e);let t=null==lo?void 0:lo.token;void 0===t&&(t=null);let n=lc;void 0===n&&(n=null),l.setHours(0),l.setMinutes(0),l.setSeconds(0),s.setHours(23),s.setMinutes(59),s.setSeconds(59);try{let a=await (0,u.o6)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model metrics response:",a),eK(a.data),eH(a.all_api_bases);let r=await (0,u.Rg)(o,e,l.toISOString(),s.toISOString());eJ(r.data),eX(r.all_api_bases);let i=await (0,u.N8)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);console.log("Model exceptions response:",i),eQ(i.data),e1(i.exception_types);let d=await (0,u.fP)(o,m,c,e,l.toISOString(),s.toISOString(),t,n);if(console.log("slowResponses:",d),e8(d),e){let t=await (0,u.n$)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);lt(t);let n=await (0,u.v9)(o,null==l?void 0:l.toISOString().split("T")[0],null==s?void 0:s.toISOString().split("T")[0],e);la(n)}}catch(e){console.error("Failed to fetch model metrics",e)}},lv=(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mb-1",children:"Select API Key Name"}),f?(0,a.jsxs)("div",{children:[(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{ld(e)},children:e.key_alias},l):null)]}),(0,a.jsx)(_.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(B.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(K.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>{lm(e)},children:e},l))]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{ld(null)},children:"All Keys"},"all-keys"),null==g?void 0:g.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsxs)(K.Z,{value:String(l),disabled:!0,onClick:()=>{ld(e)},children:["✨ ",e.key_alias," (Enterpise only Feature)"]},l):null)]}),(0,a.jsx)(_.Z,{className:"mt-1",children:"Select Customer Name"}),(0,a.jsxs)(B.Z,{defaultValue:"all-customers",children:[(0,a.jsx)(K.Z,{value:"all-customers",onClick:()=>{lm(null)},children:"All Customers"},"all-customers"),null==lu?void 0:lu.map((e,l)=>(0,a.jsxs)(K.Z,{value:e,disabled:!0,onClick:()=>{lm(e)},children:["✨ ",e," (Enterpise only Feature)"]},l))]})]})]}),lS=e=>{var l,s;let{payload:t,active:n}=e;if(!n||!t)return null;let r=null===(s=t[0])||void 0===s?void 0:null===(l=s.payload)||void 0===l?void 0:l.date,i=t.sort((e,l)=>l.value-e.value);if(i.length>5){let e=i.length-5;(i=i.slice(0,5)).push({dataKey:"".concat(e," other deployments"),value:t.slice(5).reduce((e,l)=>e+l.value,0),color:"gray"})}return(0,a.jsxs)("div",{className:"w-150 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[r&&(0,a.jsxs)("p",{className:"text-tremor-content-emphasis mb-2",children:["Date: ",r]}),i.map((e,l)=>{let s=parseFloat(e.value.toFixed(5)),t=0===s&&e.value>0?"<0.00001":s.toFixed(5);return(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 mt-1 rounded-full bg-".concat(e.color,"-500")}),(0,a.jsx)("p",{className:"text-tremor-content",children:e.dataKey})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis text-righ ml-2",children:t})]},l)})]})};console.log("selectedProvider: ".concat(Q)),console.log("providerModels.length: ".concat(H.length));let lk=Object.keys(n).find(e=>n[e]===Q);return lk&&(i=Y.find(e=>e.name===eI[lk])),(0,a.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(es.Z,{children:"All Models"}),(0,a.jsx)(es.Z,{children:"Add Model"}),(0,a.jsx)(es.Z,{children:(0,a.jsx)("pre",{children:"/health Models"})}),(0,a.jsx)(es.Z,{children:"Model Analytics"}),(0,a.jsx)(es.Z,{children:"Model Retry Settings"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[O&&(0,a.jsxs)(_.Z,{children:["Last Refreshed: ",O]}),(0,a.jsx)(R.Z,{icon:ej.Z,variant:"shadow",size:"xs",className:"self-center",onClick:lg})]})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(_.Z,{children:"Filter by Public Model Name"}),(0,a.jsxs)(B.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eU||eD[0],onValueChange:e=>eq("all"===e?"all":e),value:eU||eD[0],children:[(0,a.jsx)(K.Z,{value:"all",children:"All Models"}),eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>eq(e),children:e},l))]})]}),(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{style:{maxWidth:"1500px",width:"100%"},children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Public Model Name"}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Provider"}),"Admin"===c&&(0,a.jsx)(V.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"API Base"}),(0,a.jsxs)(V.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Input Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsxs)(V.Z,{style:{maxWidth:"85px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:["Output Price"," ",(0,a.jsx)("p",{style:{fontSize:"10px",color:"gray"},children:"/1M Tokens ($)"})]}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:f?"Created At":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created At"]})}),(0,a.jsx)(V.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:f?"Created By":(0,a.jsxs)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",style:{color:"#72bcd4"},children:[" ","✨ Created By"]})}),(0,a.jsx)(V.Z,{style:{maxWidth:"50px",whiteSpace:"normal",wordBreak:"break-word",fontSize:"11px"},children:"Status"}),(0,a.jsx)(V.Z,{})]})}),(0,a.jsx)(L.Z,{children:h.data.filter(e=>"all"===eU||e.model_name===eU||null==eU||""===eU).map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{style:{maxHeight:"1px",minHeight:"1px"},children:[(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.model_name||"-"})}),(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("p",{className:"text-xs",children:e.provider||"-"})}),"Admin"===c&&(0,a.jsx)(U.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)(em.Z,{title:e&&e.api_base,children:(0,a.jsx)("pre",{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},className:"text-xs",title:e&&e.api_base?e.api_base:"",children:e&&e.api_base?e.api_base.slice(0,20):"-"})})}),(0,a.jsx)(U.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.input_cost?e.input_cost:e.litellm_params.input_cost_per_token?(1e6*Number(e.litellm_params.input_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(U.Z,{style:{maxWidth:"80px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsx)("pre",{className:"text-xs",children:e.output_cost?e.output_cost:e.litellm_params.output_cost_per_token?(1e6*Number(e.litellm_params.output_cost_per_token)).toFixed(2):null})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:f&&((s=e.model_info.created_at)?new Date(s).toLocaleDateString("en-US"):null)||"-"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)("p",{className:"text-xs",children:f&&e.model_info.created_by||"-"})}),(0,a.jsx)(U.Z,{style:{maxWidth:"100px",whiteSpace:"normal",wordBreak:"break-word"},children:e.model_info.db_model?(0,a.jsx)(F.Z,{size:"xs",className:"text-white",children:(0,a.jsx)("p",{className:"text-xs",children:"DB Model"})}):(0,a.jsx)(F.Z,{size:"xs",className:"text-black",children:(0,a.jsx)("p",{className:"text-xs",children:"Config Model"})})}),(0,a.jsx)(U.Z,{style:{maxWidth:"150px",whiteSpace:"normal",wordBreak:"break-word"},children:(0,a.jsxs)(x.Z,{numItems:3,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{icon:T.Z,size:"sm",onClick:()=>lp(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>lx(e)})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(eZ,{modelID:e.model_info.id,accessToken:o})})]})})]},l)})})]})})]}),(0,a.jsx)(e=>{let{visible:l,onCancel:s,model:t,onSubmit:n}=e,[r]=S.Z.useForm(),i={},o="",d="";if(t){i=t.litellm_params,o=t.model_name;let e=t.model_info;e&&(d=e.id,console.log("model_id: ".concat(d)),i.model_id=d)}return(0,a.jsx)(w.Z,{title:"Edit Model "+o,visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n(e),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:lj,initialValues:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"api_base",name:"api_base",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"tpm",name:"tpm",tooltip:"int (optional) - Tokens limit for this deployment: in tokens per minute (tpm). Find this information on your model/providers website",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"rpm",name:"rpm",tooltip:"int (optional) - Rate limit for this deployment: in requests per minute (rpm). Find this information on your model/providers website",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"max_retries",name:"max_retries",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"timeout",name:"timeout",tooltip:"int (optional) - Timeout in seconds for LLM requests (Defaults to 600 seconds)",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"stream_timeout",name:"stream_timeout",tooltip:"int (optional) - Timeout for stream requests (seconds)",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"input_cost_per_token",name:"input_cost_per_token",tooltip:"float (optional) - Input cost per token",children:(0,a.jsx)(I.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"output_cost_per_token",name:"output_cost_per_token",tooltip:"float (optional) - Output cost per token",children:(0,a.jsx)(I.Z,{min:0,step:1e-4})}),(0,a.jsx)(S.Z.Item,{label:"model_id",name:"model_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})},{visible:eT,onCancel:()=>{eE(!1),eR(null)},model:eM,onSubmit:lj}),(0,a.jsxs)(w.Z,{title:eM&&eM.model_name,visible:eO,width:800,footer:null,onCancel:()=>{eF(!1),eR(null)},children:[(0,a.jsx)(y.Z,{children:"Model Info"}),(0,a.jsx)(ek.Z,{language:"json",children:eM&&JSON.stringify(eM,null,2)})]})]}),(0,a.jsxs)(ea.Z,{className:"h-full",children:[(0,a.jsx)(ew,{level:2,children:"Add new model"}),(0,a.jsx)(M.Z,{children:(0,a.jsxs)(S.Z,{form:N,onFinish:()=>{N.validateFields().then(e=>{eC(e,o,N)}).catch(e=>{console.error("Validation failed:",e)})},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(B.Z,{value:Q.toString(),children:J.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>{l_(e),ey(e)},children:e},l))})}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Public Model Name",name:"model_name",tooltip:"Model name your users will pass in. Also used for load-balancing, LiteLLM will load balance between all models with this public name.",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"Vertex AI (Anthropic, Gemini, etc.)"===(t=Q.toString())?"gemini-pro":"Anthropic"==t?"claude-3-opus":"Amazon Bedrock"==t?"claude-3-opus":"Google AI Studio"==t?"gemini-pro":"gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(_.Z,{className:"mb-3 mt-1",children:"Model name your users will pass in."})})]}),(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"LiteLLM Model Name(s)",name:"model",tooltip:"Actual model name used for making litellm.completion() call.",className:"mb-0",children:"Azure"===Q?(0,a.jsx)(j.Z,{placeholder:"Enter model name"}):H.length>0?(0,a.jsx)(ei.Z,{value:H,children:H.map((e,l)=>(0,a.jsx)(eo.Z,{value:e,children:e},l))}):(0,a.jsx)(j.Z,{placeholder:"gpt-3.5-turbo-0125"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-3 mt-1",children:["Actual model name used for making"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/providers",target:"_blank",children:"litellm.completion() call"}),". We'll"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/proxy/reliability#step-1---set-deployments-on-config",target:"_blank",children:"loadbalance"})," ","models with the same 'public name'"]})})]}),void 0!==i&&i.fields.length>0&&(0,a.jsx)(eS,{fields:i.fields,selectedProvider:i.name}),"Amazon Bedrock"!=Q&&"Vertex AI (Anthropic, Gemini, etc.)"!=Q&&(void 0===i||0==i.fields.length)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Key",name:"api_key",children:(0,a.jsx)(j.Z,{placeholder:"sk-",type:"password"})}),"OpenAI"==Q&&(0,a.jsx)(S.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,a.jsx)(j.Z,{placeholder:"[OPTIONAL] my-unique-org"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Project",name:"vertex_project",children:(0,a.jsx)(j.Z,{placeholder:"adroit-cadet-1234.."})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Location",name:"vertex_location",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Vertex Credentials",name:"vertex_credentials",className:"mb-0",children:(0,a.jsx)(e_.Z,{name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;N.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"uploading"!==e.file.status&&console.log(e.file,e.fileList),"done"===e.file.status?k.ZP.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&k.ZP.error("".concat(e.file.name," file upload failed."))},children:(0,a.jsx)(A.ZP,{icon:(0,a.jsx)(ef.Z,{}),children:"Click to Upload"})})}),"Vertex AI (Anthropic, Gemini, etc.)"==Q&&(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsx)(_.Z,{className:"mb-3 mt-1",children:"Give litellm a gcp service account(.json file), so it can make the relevant calls"})})]}),("Azure"==Q||"OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)"==Q)&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Base",name:"api_base",children:(0,a.jsx)(j.Z,{placeholder:"https://..."})}),"Azure"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"API Version",name:"api_version",children:(0,a.jsx)(j.Z,{placeholder:"2023-07-01-preview"})}),"Azure"==Q&&(0,a.jsxs)("div",{children:[(0,a.jsx)(S.Z.Item,{label:"Base Model",name:"base_model",className:"mb-0",children:(0,a.jsx)(j.Z,{placeholder:"azure/gpt-3.5-turbo"})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,a.jsx)(eN,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Access Key ID",name:"aws_access_key_id",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Secret Access Key",name:"aws_secret_access_key",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:""})}),"Amazon Bedrock"==Q&&(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"AWS Region Name",name:"aws_region_name",tooltip:"You can provide the raw key or the environment variable (e.g. `os.environ/MY_SECRET_KEY`).",children:(0,a.jsx)(j.Z,{placeholder:"us-east-1"})}),(0,a.jsx)(S.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-0",children:(0,a.jsx)(ep.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,a.jsxs)(eh.Z,{children:[(0,a.jsx)(eu.Z,{span:10}),(0,a.jsx)(eu.Z,{span:10,children:(0,a.jsxs)(_.Z,{className:"mb-3 mt-1",children:["Pass JSON of litellm supported params"," ",(0,a.jsx)(eN,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]})]}),(0,a.jsx)("div",{style:{textAlign:"center",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add Model"})}),(0,a.jsx)(em.Z,{title:"Get help on our github",children:(0,a.jsx)($.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})})]})})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(_.Z,{children:"`/health` will run a very small request through your models configured on litellm"}),(0,a.jsx)(p.Z,{onClick:ly,children:"Run `/health`"}),eb&&(0,a.jsx)("pre",{children:JSON.stringify(eb,null,2)})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:4,className:"mt-2 mb-2",children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:e3,className:"mr-2",onValueChange:e=>{e6(e),lb(eU,e.from,e.to)}})]}),(0,a.jsxs)(eu.Z,{className:"ml-2",children:[(0,a.jsx)(_.Z,{children:"Select Model Group"}),(0,a.jsx)(B.Z,{defaultValue:eU||eD[0],value:eU||eD[0],children:eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>lb(e,e3.from,e3.to),children:e},l))})]}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(ex.Z,{trigger:"click",content:lv,overlayStyle:{width:"20vw"},children:(0,a.jsx)(p.Z,{icon:eg.Z,size:"md",variant:"secondary",className:"mt-4 ml-2",style:{border:"none"},onClick:()=>li(!0)})})})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{className:"mr-2 max-h-[400px] min-h-[400px]",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Avg. Latency per Token"}),(0,a.jsx)(es.Z,{value:"2",children:"✨ Time to first token"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("p",{className:"text-gray-500 italic",children:" (seconds/token)"}),(0,a.jsx)(_.Z,{className:"text-gray-500 italic mt-1 mb-1",children:"average Latency for successfull requests divided by the total tokens"}),eB&&eW&&(0,a.jsx)(ed.Z,{title:"Model Latency",className:"h-72",data:eB,showLegend:!1,index:"date",categories:eW,connectNulls:!0,customTooltip:lS})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ev,{modelMetrics:eG,modelMetricsCategories:eY,customTooltip:lS,premiumUser:f})})]})]})})}),(0,a.jsx)(eu.Z,{children:(0,a.jsx)(M.Z,{className:"ml-2 max-h-[400px] min-h-[400px] overflow-y-auto",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Deployment"}),(0,a.jsx)(V.Z,{children:"Success Responses"}),(0,a.jsxs)(V.Z,{children:["Slow Responses ",(0,a.jsx)("p",{children:"Success Responses taking 600+s"})]})]})}),(0,a.jsx)(L.Z,{children:e5.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.api_base}),(0,a.jsx)(U.Z,{children:e.total_count}),(0,a.jsx)(U.Z,{children:e.slow_count})]},l))})]})})})]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 w-full mt-2",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(y.Z,{children:["All Up Rate Limit Errors (429) for ",eU]}),(0,a.jsxs)(x.Z,{numItems:1,children:[(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",ls.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:ls.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]}),(0,a.jsx)(eu.Z,{})]})]}),f?(0,a.jsx)(a.Fragment,{children:ln.map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base?e.api_base:"Unknown API Base"}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors (429) ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]},l))}):(0,a.jsx)(a.Fragment,{children:ln&&ln.length>0&&ln.slice(0,1).map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Rate Limit Errors by Deployment"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see exceptions for all deployments"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.api_base}),(0,a.jsx)(x.Z,{numItems:1,children:(0,a.jsxs)(eu.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Num Rate Limit Errors ",e.sum_num_rate_limit_exceptions]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["rose"],categories:["num_rate_limit_exceptions"],onValueChange:e=>console.log(e)})]})})]})]},l))})]})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(_.Z,{children:"Filter by Public Model Name"}),(0,a.jsx)(B.Z,{className:"mb-4 mt-2 ml-2 w-50",defaultValue:eU||eD[0],value:eU||eD[0],onValueChange:e=>eq(e),children:eD.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>eq(e),children:e},l))})]}),(0,a.jsxs)(y.Z,{children:["Retry Policy for ",eU]}),(0,a.jsx)(_.Z,{className:"mb-6",children:"How many retries should be attempted based on the Exception"}),eA&&(0,a.jsx)("table",{children:(0,a.jsx)("tbody",{children:Object.entries(eA).map((e,l)=>{var s;let[t,n]=e,r=null==e9?void 0:null===(s=e9[eU])||void 0===s?void 0:s[n];return null==r&&(r=le),(0,a.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("td",{children:(0,a.jsx)(_.Z,{children:t})}),(0,a.jsx)("td",{children:(0,a.jsx)(I.Z,{className:"ml-5",value:r,min:0,step:1,onChange:e=>{e7(l=>{var s;let t=null!==(s=null==l?void 0:l[eU])&&void 0!==s?s:{};return{...null!=l?l:{},[eU]:{...t,[n]:e}}})}})})]},l)})})}),(0,a.jsx)(p.Z,{className:"mt-6 mr-8",onClick:lZ,children:"Save"})]})]})]})})};let{Option:eT}=v.default;var eE=e=>{let{userID:l,accessToken:s,teams:t}=e,[n]=S.Z.useForm(),[i,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[m,h]=(0,r.useState)([]);(0,r.useEffect)(()=>{(async()=>{try{let e=await (0,u.So)(s,l,"any"),t=[];for(let l=0;l{o(!1),n.resetFields()},g=()=>{o(!1),c(null),n.resetFields()},Z=async e=>{try{k.ZP.info("Making API Call"),o(!0),console.log("formValues in create user:",e);let t=await (0,u.Ov)(s,null,e);console.log("user create Response:",t),c(t.key),k.ZP.success("API user Created"),n.resetFields(),localStorage.removeItem("userData"+l)}catch(e){console.error("Error creating the user:",e)}};return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-0",onClick:()=>o(!0),children:"+ Invite User"}),(0,a.jsxs)(w.Z,{title:"Invite User",visible:i,width:800,footer:null,onOk:x,onCancel:g,children:[(0,a.jsx)(_.Z,{className:"mb-1",children:"Invite a user to login to the Admin UI and create Keys"}),(0,a.jsx)(_.Z,{className:"mb-6",children:(0,a.jsx)("b",{children:"Note: SSO Setup Required for this"})}),(0,a.jsxs)(S.Z,{form:n,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(S.Z.Item,{label:"User Email",name:"user_email",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"team_id",children:(0,a.jsx)(v.default,{placeholder:"Select Team ID",style:{width:"100%"},children:t?t.map(e=>(0,a.jsx)(eT,{value:e.team_id,children:e.team_alias},e.team_id)):(0,a.jsx)(eT,{value:null,children:"Default Team"},"default")})}),(0,a.jsx)(S.Z.Item,{label:"Metadata",name:"metadata",children:(0,a.jsx)(N.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create User"})})]})]}),d&&(0,a.jsxs)(w.Z,{title:"User Created Successfully",visible:i,onOk:x,onCancel:g,footer:null,children:[(0,a.jsx)("p",{children:"User has been created to access your proxy. Please Ask them to Log In."}),(0,a.jsx)("br",{}),(0,a.jsx)("p",{children:(0,a.jsx)("b",{children:"Note: This Feature is only supported through SSO on the Admin UI"})})]})]})},eO=e=>{let{visible:l,possibleUIRoles:s,onCancel:t,user:n,onSubmit:i}=e,[o,d]=(0,r.useState)(n),[c]=S.Z.useForm();(0,r.useEffect)(()=>{c.resetFields()},[n]);let m=async()=>{c.resetFields(),t()},u=async e=>{i(e),c.resetFields(),t()};return n?(0,a.jsx)(w.Z,{visible:l,onCancel:m,footer:null,title:"Edit User "+n.user_id,width:1e3,children:(0,a.jsx)(S.Z,{form:c,onFinish:u,initialValues:n,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"User Email",tooltip:"Email of the User",name:"user_email",children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"user_id",name:"user_id",hidden:!0,children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"User Role",name:"user_role",children:(0,a.jsx)(v.default,{children:s&&Object.entries(s).map(e=>{let[l,{ui_label:s,description:t}]=e;return(0,a.jsx)(K.Z,{value:l,title:s,children:(0,a.jsxs)("div",{className:"flex",children:[s," ",(0,a.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:t})]})},l)})})}),(0,a.jsx)(S.Z.Item,{label:"Spend (USD)",name:"spend",tooltip:"(float) - Spend of all LLM calls completed by this user",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)(S.Z.Item,{label:"User Budget (USD)",name:"max_budget",tooltip:"(float) - Maximum budget of this user",children:(0,a.jsx)(I.Z,{min:0,step:1})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})}):null},eF=e=>{let{accessToken:l,token:s,keys:t,userRole:n,userID:i,teams:o,setKeys:d}=e,[c,m]=(0,r.useState)(null),[h,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(0),[Z,f]=r.useState(null),[_,y]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[S,w]=(0,r.useState)(null),[N,I]=(0,r.useState)({}),A=async()=>{w(null),v(!1)},C=async e=>{if(console.log("inside handleEditSubmit:",e),l&&s&&n&&i){try{await (0,u.pf)(l,e,null),k.ZP.success("User ".concat(e.user_id," updated successfully"))}catch(e){console.error("There was an error updating the user",e)}c&&m(c.map(l=>l.user_id===e.user_id?e:l)),w(null),v(!1)}};return((0,r.useEffect)(()=>{if(!l||!s||!n||!i)return;let e=async()=>{try{let e=await (0,u.Br)(l,null,n,!0,j,25);console.log("user data response:",e),m(e);let s=await (0,u.lg)(l);I(s)}catch(e){console.error("There was an error fetching the model data",e)}};l&&s&&n&&i&&e()},[l,s,n,i,j]),c&&l&&s&&n&&i)?(0,a.jsx)("div",{style:{width:"100%"},children:(0,a.jsxs)(x.Z,{className:"gap-2 p-2 h-[90vh] w-full mt-8",children:[(0,a.jsx)(eE,{userID:i,accessToken:l,teams:o}),(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[90vh] mb-4",children:[(0,a.jsx)("div",{className:"mb-4 mt-1"}),(0,a.jsx)(et.Z,{children:(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(D.Z,{className:"mt-5",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"User ID"}),(0,a.jsx)(V.Z,{children:"User Email"}),(0,a.jsx)(V.Z,{children:"Role"}),(0,a.jsx)(V.Z,{children:"User Spend ($ USD)"}),(0,a.jsx)(V.Z,{children:"User Max Budget ($ USD)"}),(0,a.jsx)(V.Z,{children:"API Keys"}),(0,a.jsx)(V.Z,{})]})}),(0,a.jsx)(L.Z,{children:c.map(e=>{var l,s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_id||"-"}),(0,a.jsx)(U.Z,{children:e.user_email||"-"}),(0,a.jsx)(U.Z,{children:(null==N?void 0:null===(l=N[null==e?void 0:e.user_role])||void 0===l?void 0:l.ui_label)||"-"}),(0,a.jsx)(U.Z,{children:e.spend?null===(s=e.spend)||void 0===s?void 0:s.toFixed(2):"-"}),(0,a.jsx)(U.Z,{children:e.max_budget?e.max_budget:"Unlimited"}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(x.Z,{numItems:2,children:e&&e.key_aliases&&e.key_aliases.filter(e=>null!==e).length>0?(0,a.jsxs)(F.Z,{size:"xs",color:"indigo",children:[e.key_aliases.filter(e=>null!==e).length,"\xa0Keys"]}):(0,a.jsx)(F.Z,{size:"xs",color:"gray",children:"No Keys"})})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:E.Z,onClick:()=>{w(e),v(!0)},children:"View Keys"})})]},e.user_id)})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("div",{className:"flex-1 flex justify-between items-center"})]})})]})}),(0,a.jsx)(eO,{visible:b,possibleUIRoles:N,onCancel:A,user:S,onSubmit:C})]}),function(){if(!c)return null;let e=Math.ceil(c.length/25);return(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)("div",{children:["Showing Page ",j+1," of ",e]}),(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none",disabled:0===j,onClick:()=>g(j-1),children:"← Prev"}),(0,a.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r focus:outline-none",onClick:()=>{g(j+1)},children:"Next →"})]})]})}()]})}):(0,a.jsx)("div",{children:"Loading..."})},eM=e=>{let{teams:l,searchParams:s,accessToken:t,setTeams:n,userID:i,userRole:o}=e,[d]=S.Z.useForm(),[c]=S.Z.useForm(),{Title:m,Paragraph:g}=$.default,[Z,f]=(0,r.useState)(""),[y,b]=(0,r.useState)(!1),[C,P]=(0,r.useState)(l?l[0]:null),[T,W]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[J,Y]=(0,r.useState)([]),[X,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)({}),en=e=>{P(e),b(!0)},ea=async e=>{let s=e.team_id;if(console.log("handleEditSubmit:",e),null==t)return;let a=await (0,u.Gh)(t,e);l&&n(l.map(e=>e.team_id===s?a.data:e)),k.ZP.success("Team updated successfully"),b(!1),P(null)},er=async e=>{el(e),Q(!0)},ei=async()=>{if(null!=ee&&null!=l&&null!=t){try{await (0,u.rs)(t,ee);let e=l.filter(e=>e.team_id!==ee);n(e)}catch(e){console.error("Error deleting the team:",e)}Q(!1),el(null)}};(0,r.useEffect)(()=>{let e=async()=>{try{if(null===i||null===o||null===t||null===l)return;console.log("fetching team info:");let e={};for(let s=0;s<(null==l?void 0:l.length);s++){let n=l[s].team_id,a=await (0,u.Xm)(t,n);console.log("teamInfo response:",a),null!==a&&(e={...e,[n]:a})}et(e)}catch(e){console.error("Error fetching team info:",e)}};(async()=>{try{if(null===i||null===o)return;if(null!==t){let e=(await (0,u.So)(t,i,o)).data.map(e=>e.id);console.log("available_model_names:",e),Y(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[t,i,o,l]);let eo=async e=>{try{if(null!=t){var s;let a=null==e?void 0:e.team_alias;if((null!==(s=null==l?void 0:l.map(e=>e.team_alias))&&void 0!==s?s:[]).includes(a))throw Error("Team alias ".concat(a," already exists, please pick another alias"));k.ZP.info("Creating Team");let r=await (0,u.hT)(t,e);null!==l?n([...l,r]):n([r]),console.log("response for team create call: ".concat(r)),k.ZP.success("Team created"),W(!1)}}catch(e){console.error("Error creating the team:",e),k.ZP.error("Error creating the team: "+e,20)}},ed=async e=>{try{if(null!=t&&null!=l){k.ZP.info("Adding Member");let s={role:"user",user_email:e.user_email,user_id:e.user_id},a=await (0,u.cu)(t,C.team_id,s);console.log("response for team create call: ".concat(a.data));let r=l.findIndex(e=>(console.log("team.team_id=".concat(e.team_id,"; response.data.team_id=").concat(a.data.team_id)),e.team_id===a.data.team_id));if(console.log("foundIndex: ".concat(r)),-1!==r){let e=[...l];e[r]=a.data,n(e),P(a.data)}G(!1)}}catch(e){console.error("Error creating the team:",e)}};return console.log("received teams ".concat(JSON.stringify(l))),(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"All Teams"}),(0,a.jsxs)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Team Name"}),(0,a.jsx)(V.Z,{children:"Spend (USD)"}),(0,a.jsx)(V.Z,{children:"Budget (USD)"}),(0,a.jsx)(V.Z,{children:"Models"}),(0,a.jsx)(V.Z,{children:"TPM / RPM Limits"}),(0,a.jsx)(V.Z,{children:"Info"})]})}),(0,a.jsx)(L.Z,{children:l&&l.length>0?l.map(e=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.spend}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.max_budget?e.max_budget:"No limit"}),(0,a.jsx)(U.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},children:Array.isArray(e.models)?(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:0===e.models.length?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})}):e.models.map((e,l)=>"all-proxy-models"===e?(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"red",children:(0,a.jsx)(_.Z,{children:"All Proxy Models"})},l):(0,a.jsx)(F.Z,{size:"xs",className:"mb-1",color:"blue",children:(0,a.jsx)(_.Z,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},l))}):null}),(0,a.jsx)(U.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,a.jsxs)(_.Z,{children:["TPM: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,a.jsx)("br",{}),"RPM:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsxs)(_.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].keys&&es[e.team_id].keys.length," ","Keys"]}),(0,a.jsxs)(_.Z,{children:[es&&e.team_id&&es[e.team_id]&&es[e.team_id].team_info&&es[e.team_id].team_info.members_with_roles&&es[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>en(e)}),(0,a.jsx)(R.Z,{onClick:()=>er(e.team_id),icon:O.Z,size:"sm"})]})]},e.team_id)):null})]}),X&&(0,a.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,a.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,a.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,a.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,a.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,a.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,a.jsx)("div",{className:"sm:flex sm:items-start",children:(0,a.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,a.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Team"}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this team ?"})})]})})}),(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(p.Z,{onClick:ei,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(p.Z,{onClick:()=>{Q(!1),el(null)},children:"Cancel"})]})]})]})})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>W(!0),children:"+ Create New Team"}),(0,a.jsx)(w.Z,{title:"Create Team",visible:T,width:800,footer:null,onOk:()=>{W(!1),d.resetFields()},onCancel:()=>{W(!1),d.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:eo,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),J.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(m,{level:4,children:"Team Members"}),(0,a.jsx)(g,{children:"If you belong to multiple teams, this setting controls which teams members you see."}),l&&l.length>0?(0,a.jsx)(B.Z,{defaultValue:"0",children:l.map((e,l)=>(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{P(e)},children:e.team_alias},l))}):(0,a.jsxs)(g,{children:["No team created. ",(0,a.jsx)("b",{children:"Defaulting to personal account."})]})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Member Name"}),(0,a.jsx)(V.Z,{children:"Role"})]})}),(0,a.jsx)(L.Z,{children:C?C.members_with_roles.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsx)(U.Z,{children:e.role})]},l)):null})]})}),C&&(0,a.jsx)(e=>{let{visible:l,onCancel:s,team:t,onSubmit:n}=e,[r]=S.Z.useForm();return(0,a.jsx)(w.Z,{title:"Edit Team",visible:l,width:800,footer:null,onOk:()=>{r.validateFields().then(e=>{n({...e,team_id:t.team_id}),r.resetFields()}).catch(e=>{console.error("Validation failed:",e)})},onCancel:s,children:(0,a.jsxs)(S.Z,{form:r,onFinish:ea,initialValues:t,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,a.jsx)(j.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"Models",name:"models",children:(0,a.jsxs)(v.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,a.jsx)(v.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),J&&J.map(e=>(0,a.jsx)(v.default.Option,{value:e,children:e},e))]})}),(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,a.jsx)(I.Z,{step:1,width:400})}),(0,a.jsx)(S.Z.Item,{label:"Requests per minute Limit (RPM)",name:"team_id",hidden:!0})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Edit Team"})})]})})},{visible:y,onCancel:()=>{b(!1),P(null)},team:C,onSubmit:ea})]}),(0,a.jsxs)(h.Z,{numColSpan:1,children:[(0,a.jsx)(p.Z,{className:"mx-auto mb-5",onClick:()=>G(!0),children:"+ Add member"}),(0,a.jsx)(w.Z,{title:"Add member",visible:H,width:800,footer:null,onOk:()=>{G(!1),c.resetFields()},onCancel:()=>{G(!1),c.resetFields()},children:(0,a.jsxs)(S.Z,{form:d,onFinish:ed,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,a.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,a.jsx)(S.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,a.jsx)(N.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eR=e=>{let l,{searchParams:s,accessToken:t,showSSOBanner:n}=e,[o]=S.Z.useForm(),[d]=S.Z.useForm(),{Title:c,Paragraph:m}=$.default,[j,g]=(0,r.useState)(""),[Z,f]=(0,r.useState)(null),[y,v]=(0,r.useState)(null),[I,C]=(0,r.useState)(!1),[P,T]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[W,H]=(0,r.useState)(!1),[G,J]=(0,r.useState)(!1),[Y,X]=(0,r.useState)(!1),Q=(0,i.useRouter)(),[ee,el]=(0,r.useState)(null),[es,et]=(0,r.useState)("");try{l=window.location.origin}catch(e){l=""}l+="/fallback/login";let en=()=>{X(!1)},ea=["proxy_admin","proxy_admin_viewer"];(0,r.useEffect)(()=>{if(Q){let{protocol:e,host:l}=window.location;et("".concat(e,"//").concat(l))}},[Q]),(0,r.useEffect)(()=>{(async()=>{if(null!=t){let e=[],l=await (0,u.Xd)(t,"proxy_admin_viewer");l.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy viewers: ".concat(l));let s=await (0,u.Xd)(t,"proxy_admin");s.forEach(l=>{e.push({user_role:l.user_role,user_id:l.user_id,user_email:l.user_email})}),console.log("proxy admins: ".concat(s)),console.log("combinedList: ".concat(e)),f(e),el(await (0,u.lg)(t))}})()},[t]);let er=()=>{H(!1),d.resetFields(),o.resetFields()},ei=()=>{F(!1),d.resetFields(),o.resetFields()},eo=()=>{F(!1),C(!1),d.resetFields(),o.resetFields()},ed=()=>{H(!1),d.resetFields(),o.resetFields()},ec=e=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(S.Z.Item,{label:"Email",name:"user_email",className:"mb-8 mt-4",children:(0,a.jsx)(N.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},className:"mt-4",children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add member"})})]}),em=(e,l,s)=>(0,a.jsxs)(S.Z,{form:o,onFinish:e,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{rules:[{required:!0,message:"Required"}],label:"User Role",name:"user_role",labelCol:{span:10},labelAlign:"left",children:(0,a.jsx)(B.Z,{value:l,children:ea.map((e,l)=>(0,a.jsx)(K.Z,{value:e,children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Team ID",name:"user_id",hidden:!0,initialValue:s,valuePropName:"user_id",className:"mt-8",children:(0,a.jsx)(N.Z,{value:s,disabled:!0})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Update role"})})]}),eu=async e=>{try{if(null!=t&&null!=Z){k.ZP.info("Making API Call");let l=await (0,u.pf)(t,e,null);console.log("response for team create call: ".concat(l));let s=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(l.user_id)),e.user_id===l.user_id));console.log("foundIndex: ".concat(s)),-1==s&&(console.log("updates admin with new user"),Z.push(l),f(Z)),k.ZP.success("Refresh tab to see updated user role"),H(!1)}}catch(e){console.error("Error creating the key:",e)}},eh=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call");let s=await (0,u.pf)(t,e,"proxy_admin_viewer");console.log("response for team create call: ".concat(s));let n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)});let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(s.user_id)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),f(Z)),o.resetFields(),T(!1)}}catch(e){console.error("Error creating the key:",e)}},ex=async e=>{try{if(null!=t&&null!=Z){var l;k.ZP.info("Making API Call"),e.user_email,e.user_id;let s=await (0,u.pf)(t,e,"proxy_admin"),n=(null===(l=s.data)||void 0===l?void 0:l.user_id)||s.user_id;(0,u.XO)(t,n).then(e=>{v(e),C(!0)}),console.log("response for team create call: ".concat(s));let a=Z.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(n)),e.user_id===s.user_id));console.log("foundIndex: ".concat(a)),-1==a&&(console.log("updates admin with new user"),Z.push(s),f(Z)),o.resetFields(),F(!1)}}catch(e){console.error("Error creating the key:",e)}},ep=async e=>{if(null==t)return;let l={environment_variables:{PROXY_BASE_URL:e.proxy_base_url,GOOGLE_CLIENT_ID:e.google_client_id,GOOGLE_CLIENT_SECRET:e.google_client_secret}};(0,u.K_)(t,l)};return console.log("admins: ".concat(null==Z?void 0:Z.length)),(0,a.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,a.jsx)(c,{level:4,children:"Admin Access "}),(0,a.jsxs)(m,{children:[n&&(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#restrict-ui-access",children:"Requires SSO Setup"}),(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin: "})," Can create keys, teams, users, add models, etc."," ",(0,a.jsx)("br",{}),(0,a.jsx)("b",{children:"Proxy Admin Viewer: "}),"Can just view spend. They cannot create keys, teams or grant users access to new models."," "]}),(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-2 w-full",children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(M.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Member Name"}),(0,a.jsx)(V.Z,{children:"Role"})]})}),(0,a.jsx)(L.Z,{children:Z?Z.map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,a.jsxs)(U.Z,{children:[" ",(null==ee?void 0:null===(s=ee[null==e?void 0:e.user_role])||void 0===s?void 0:s.ui_label)||"-"]}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>H(!0)}),(0,a.jsx)(w.Z,{title:"Update role",visible:W,width:800,footer:null,onOk:er,onCancel:ed,children:em(eu,e.user_role,e.user_id)})]})]},l)}):null})]})})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("div",{className:"flex justify-start",children:[(0,a.jsx)(p.Z,{className:"mr-4 mb-5",onClick:()=>F(!0),children:"+ Add admin"}),(0,a.jsx)(w.Z,{title:"Add admin",visible:O,width:800,footer:null,onOk:ei,onCancel:eo,children:ec(ex)}),(0,a.jsxs)(w.Z,{title:"Invitation Link",visible:I,width:800,footer:null,onOk:ei,onCancel:eo,children:[(0,a.jsx)(m,{children:"Copy and send the generated link to onboard this user to the proxy."}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(_.Z,{className:"text-base",children:"User ID"}),(0,a.jsx)(_.Z,{children:null==y?void 0:y.user_id})]}),(0,a.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,a.jsx)(_.Z,{children:"Invitation Link"}),(0,a.jsxs)(_.Z,{children:[es,"/ui/onboarding?id=",null==y?void 0:y.id]})]}),(0,a.jsxs)("div",{className:"flex justify-end mt-5",children:[(0,a.jsx)("div",{}),(0,a.jsx)(b.CopyToClipboard,{text:"".concat(es,"/ui/onboarding?id=").concat(null==y?void 0:y.id),onCopy:()=>k.ZP.success("Copied!"),children:(0,a.jsx)(p.Z,{variant:"primary",children:"Copy invitation link"})})]})]}),(0,a.jsx)(p.Z,{className:"mb-5",onClick:()=>T(!0),children:"+ Add viewer"}),(0,a.jsx)(w.Z,{title:"Add viewer",visible:P,width:800,footer:null,onOk:()=>{T(!1),d.resetFields(),o.resetFields()},onCancel:()=>{T(!1),d.resetFields(),o.resetFields()},children:ec(eh)})]})})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(c,{level:4,children:"Add SSO"}),(0,a.jsxs)("div",{className:"flex justify-start mb-4",children:[(0,a.jsx)(p.Z,{onClick:()=>J(!0),children:"Add SSO"}),(0,a.jsx)(w.Z,{title:"Add SSO",visible:G,width:800,footer:null,onOk:()=>{J(!1),o.resetFields()},onCancel:()=>{J(!1),o.resetFields()},children:(0,a.jsxs)(S.Z,{form:o,onFinish:e=>{ex(e),ep(e),J(!1),X(!0)},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Admin Email",name:"user_email",rules:[{required:!0,message:"Please enter the email of the proxy admin"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"PROXY BASE URL",name:"proxy_base_url",rules:[{required:!0,message:"Please enter the proxy base url"}],children:(0,a.jsx)(N.Z,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT ID",name:"google_client_id",rules:[{required:!0,message:"Please enter the google client id"}],children:(0,a.jsx)(N.Z.Password,{})}),(0,a.jsx)(S.Z.Item,{label:"GOOGLE CLIENT SECRET",name:"google_client_secret",rules:[{required:!0,message:"Please enter the google client secret"}],children:(0,a.jsx)(N.Z.Password,{})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})}),(0,a.jsxs)(w.Z,{title:"SSO Setup Instructions",visible:Y,width:800,footer:null,onOk:en,onCancel:()=>{X(!1)},children:[(0,a.jsx)("p",{children:"Follow these steps to complete the SSO setup:"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"1. DO NOT Exit this TAB"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"2. Open a new tab, visit your proxy base url"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"3. Confirm your SSO is configured correctly and you can login on the new Tab"}),(0,a.jsx)(_.Z,{className:"mt-2",children:"4. If Step 3 is successful, you can close this tab"}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{onClick:en,children:"Done"})})]})]}),(0,a.jsxs)(ey.Z,{title:"Login without SSO",color:"teal",children:["If you need to login without sso, you can access"," ",(0,a.jsxs)("a",{href:l,target:"_blank",children:[(0,a.jsx)("b",{children:l})," "]})]})]})]})},eD=s(42556),eL=s(90252),eU=e=>{let{alertingSettings:l,handleInputChange:s,handleResetField:t,handleSubmit:n,premiumUser:r}=e,[i]=S.Z.useForm();return(0,a.jsxs)(S.Z,{form:i,onFinish:()=>{let e=i.getFieldsValue();Object.values(e).some(e=>""===e||null==e)?console.log("Some form fields are empty."):n(e)},labelAlign:"left",children:[l.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{align:"center",children:[(0,a.jsx)(_.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),e.premium_field?r?(0,a.jsx)(S.Z.Item,{name:e.field_name,children:(0,a.jsx)(U.Z,{children:"Integer"===e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l)}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}):(0,a.jsx)(U.Z,{children:(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})})}):(0,a.jsx)(S.Z.Item,{name:e.field_name,className:"mb-0",children:(0,a.jsx)(U.Z,{children:"Integer"===e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>s(e.field_name,l),className:"p-0"}):(0,a.jsx)(N.Z,{value:e.field_value,onChange:l=>s(e.field_name,l)})})}),(0,a.jsx)(U.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eL.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:O.Z,color:"red",onClick:()=>t(e.field_name,l),children:"Reset"})})]},l)),(0,a.jsx)("div",{children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Update Settings"})})]})},eq=e=>{let{accessToken:l,premiumUser:s}=e,[t,n]=(0,r.useState)([]);return console.log("INSIDE ALERTING SETTINGS"),(0,r.useEffect)(()=>{l&&(0,u.RQ)(l).then(e=>{n(e)})},[l]),(0,a.jsx)(eU,{alertingSettings:t,handleInputChange:(e,l)=>{n(t.map(s=>s.field_name===e?{...s,field_value:l}:s))},handleResetField:(e,s)=>{if(l)try{let l=t.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:l.field_default_value}:l);console.log("INSIDE HANDLE RESET FIELD"),n(l)}catch(e){console.log("ERROR OCCURRED!")}},handleSubmit:e=>{if(!l||null==e||void 0==e)return;let s={};t.forEach(e=>{s[e.field_name]=e.field_value});let n={...e,...s};try{(0,u.jA)(l,"alerting_args",n),k.ZP.success("Wait 10s for proxy to update.")}catch(e){}},premiumUser:s})},eV=s(84406);let{Title:ez,Paragraph:eB}=$.default;var eK=e=>{let{accessToken:l,userRole:s,userID:t,premiumUser:n}=e,[i,o]=(0,r.useState)([]),[d,c]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[g]=S.Z.useForm(),[Z,f]=(0,r.useState)(null),[y,b]=(0,r.useState)([]),[N,I]=(0,r.useState)(""),[C,P]=(0,r.useState)({}),[T,O]=(0,r.useState)([]),[F,B]=(0,r.useState)(!1),[W,H]=(0,r.useState)([]),[G,J]=(0,r.useState)(null),[Y,X]=(0,r.useState)([]),[$,Q]=(0,r.useState)(!1),[ee,el]=(0,r.useState)(null),ei=e=>{T.includes(e)?O(T.filter(l=>l!==e)):O([...T,e])},eo={llm_exceptions:"LLM Exceptions",llm_too_slow:"LLM Responses Too Slow",llm_requests_hanging:"LLM Requests Hanging",budget_alerts:"Budget Alerts (API Keys, Users)",db_exceptions:"Database Exceptions (Read/Write)",daily_reports:"Weekly/Monthly Spend Reports",outage_alerts:"Outage Alerts",region_outage_alerts:"Region Outage Alerts"};(0,r.useEffect)(()=>{l&&s&&t&&(0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.callbacks),H(e.available_callbacks);let l=e.alerts;if(console.log("alerts_data",l),l&&l.length>0){let e=l[0];console.log("_alert_info",e);let s=e.variables.SLACK_WEBHOOK_URL;console.log("catch_all_webhook",s),O(e.active_alerts),I(s),P(e.alerts_to_webhook)}c(l)})},[l,s,t]);let ed=e=>T&&T.includes(e),ec=()=>{if(!l)return;let e={};d.filter(e=>"email"===e.name).forEach(l=>{var s;Object.entries(null!==(s=l.variables)&&void 0!==s?s:{}).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));n&&n.value&&(e[s]=null==n?void 0:n.value)})}),console.log("updatedVariables",e);try{(0,u.K_)(l,{general_settings:{alerting:["email"]},environment_variables:e})}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Email settings updated successfully")},em=async e=>{if(!l)return;let s={};Object.entries(e).forEach(e=>{let[l,t]=e;"callback"!==l&&(s[l]=t)});try{await (0,u.K_)(l,{environment_variables:s}),k.ZP.success("Callback added successfully"),h(!1),g.resetFields(),f(null)}catch(e){k.ZP.error("Failed to add callback: "+e,20)}},eu=async e=>{if(!l)return;let s=null==e?void 0:e.callback,t={};Object.entries(e).forEach(e=>{let[l,s]=e;"callback"!==l&&(t[l]=s)});try{await (0,u.K_)(l,{environment_variables:t,litellm_settings:{success_callback:[s]}}),k.ZP.success("Callback ".concat(s," added successfully")),h(!1),g.resetFields(),f(null)}catch(e){k.ZP.error("Failed to add callback: "+e,20)}},eh=e=>{console.log("inside handleSelectedCallbackChange",e),f(e.litellm_callback_name),console.log("all callbacks",W),e&&e.litellm_callback_params?(X(e.litellm_callback_params),console.log("selectedCallbackParams",Y)):X([])};return l?(console.log("callbacks: ".concat(i)),(0,a.jsxs)("div",{className:"w-full mx-4",children:[(0,a.jsx)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Logging Callbacks"}),(0,a.jsx)(es.Z,{value:"2",children:"Alerting Types"}),(0,a.jsx)(es.Z,{value:"3",children:"Alerting Settings"}),(0,a.jsx)(es.Z,{value:"4",children:"Email Alerts"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)(ez,{level:4,children:"Active Logging Callbacks"}),(0,a.jsx)(x.Z,{numItems:2,children:(0,a.jsx)(M.Z,{className:"max-h-[50vh]",children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsx)(z.Z,{children:(0,a.jsx)(V.Z,{children:"Callback Name"})})}),(0,a.jsx)(L.Z,{children:i.map((e,s)=>(0,a.jsxs)(z.Z,{className:"flex justify-between",children:[(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:e.name})}),(0,a.jsx)(U.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"flex justify-between",children:[(0,a.jsx)(R.Z,{icon:E.Z,size:"sm",onClick:()=>{el(e),Q(!0)}}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,e.name),className:"ml-2",variant:"secondary",children:"Test Callback"})]})})]},s))})]})})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>B(!0),children:"Add Callback"})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(_.Z,{className:"my-2",children:["Alerts are only supported for Slack Webhook URLs. Get your webhook urls from"," ",(0,a.jsx)("a",{href:"https://api.slack.com/messaging/webhooks",target:"_blank",style:{color:"blue"},children:"here"})]}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{}),(0,a.jsx)(V.Z,{}),(0,a.jsx)(V.Z,{children:"Slack Webhook URL"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(eo).map((e,l)=>{let[s,t]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:"region_outage_alerts"==s?n?(0,a.jsx)(eD.Z,{id:"switch",name:"switch",checked:ed(s),onChange:()=>ei(s)}):(0,a.jsx)(p.Z,{className:"flex items-center justify-center",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Enterprise Feature"})}):(0,a.jsx)(eD.Z,{id:"switch",name:"switch",checked:ed(s),onChange:()=>ei(s)})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(_.Z,{children:t})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(j.Z,{name:s,type:"password",defaultValue:C&&C[s]?C[s]:N})})]},l)})})]}),(0,a.jsx)(p.Z,{size:"xs",className:"mt-2",onClick:()=>{if(!l)return;let e={};Object.entries(eo).forEach(l=>{let[s,t]=l,n=document.querySelector('input[name="'.concat(s,'"]'));console.log("key",s),console.log("webhookInput",n);let a=(null==n?void 0:n.value)||"";console.log("newWebhookValue",a),e[s]=a}),console.log("updatedAlertToWebhooks",e);let s={general_settings:{alert_to_webhook_url:e,alert_types:T}};console.log("payload",s);try{(0,u.K_)(l,s)}catch(e){k.ZP.error("Failed to update alerts: "+e,20)}k.ZP.success("Alerts updated successfully")},children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"slack"),className:"mx-2",children:"Test Alerts"})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(eq,{accessToken:l,premiumUser:n})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(ez,{level:4,children:"Email Settings"}),(0,a.jsxs)(_.Z,{children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/email",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: email alerts"})," ",(0,a.jsx)("br",{})]}),(0,a.jsx)("div",{className:"flex w-full",children:d.filter(e=>"email"===e.name).map((e,l)=>{var s;return(0,a.jsx)(U.Z,{children:(0,a.jsx)("ul",{children:(0,a.jsx)(x.Z,{numItems:2,children:Object.entries(null!==(s=e.variables)&&void 0!==s?s:{}).map(e=>{let[l,s]=e;return(0,a.jsxs)("li",{className:"mx-2 my-2",children:[!0!=n&&("EMAIL_LOGO_URL"===l||"EMAIL_SUPPORT_CONTACT"===l)?(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:(0,a.jsxs)(_.Z,{className:"mt-2",children:[" ","✨ ",l]})}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",disabled:!0,style:{width:"400px"}})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)(_.Z,{className:"mt-2",children:l}),(0,a.jsx)(j.Z,{name:l,defaultValue:s,type:"password",style:{width:"400px"}})]}),(0,a.jsxs)("p",{style:{fontSize:"small",fontStyle:"italic"},children:["SMTP_HOST"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP host address, e.g. `smtp.resend.com`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PORT"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP port number, e.g. `587`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_USERNAME"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the SMTP username, e.g. `username`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"SMTP_PASSWORD"===l&&(0,a.jsx)("span",{style:{color:"red"},children:" Required * "}),"SMTP_SENDER_EMAIL"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Enter the sender email address, e.g. `sender@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"TEST_EMAIL_ADDRESS"===l&&(0,a.jsxs)("div",{style:{color:"gray"},children:["Email Address to send `Test Email Alert` to. example: `info@berri.ai`",(0,a.jsx)("span",{style:{color:"red"},children:" Required * "})]}),"EMAIL_LOGO_URL"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the Logo that appears in the email, pass a url to your logo"}),"EMAIL_SUPPORT_CONTACT"===l&&(0,a.jsx)("div",{style:{color:"gray"},children:"(Optional) Customize the support email address that appears in the email. Default is support@berri.ai"})]})]},l)})})})},l)})}),(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>ec(),children:"Save Changes"}),(0,a.jsx)(p.Z,{onClick:()=>(0,u.jE)(l,"email"),className:"mx-2",children:"Test Email Alerts"})]})})]})]})}),(0,a.jsxs)(w.Z,{title:"Add Logging Callback",visible:F,width:800,onCancel:()=>B(!1),footer:null,children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/logging",className:"mb-8 mt-4",target:"_blank",style:{color:"blue"},children:" LiteLLM Docs: Logging"}),(0,a.jsx)(S.Z,{form:g,onFinish:eu,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eV.Z,{label:"Callback",name:"callback",rules:[{required:!0,message:"Please select a callback"}],children:(0,a.jsx)(v.default,{onChange:e=>{let l=W[e];l&&(console.log(l.ui_callback_name),eh(l))},children:W&&Object.values(W).map(e=>(0,a.jsx)(K.Z,{value:e.litellm_callback_name,children:e.ui_callback_name},e.litellm_callback_name))})}),Y&&Y.map(e=>(0,a.jsx)(eV.Z,{label:e,name:e,rules:[{required:!0,message:"Please enter the value for "+e}],children:(0,a.jsx)(j.Z,{type:"password"})},e)),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})]}),(0,a.jsx)(w.Z,{visible:$,width:800,title:"Edit ".concat(null==ee?void 0:ee.name," Settings"),onCancel:()=>Q(!1),footer:null,children:(0,a.jsxs)(S.Z,{form:g,onFinish:em,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(a.Fragment,{children:ee&&ee.variables&&Object.entries(ee.variables).map(e=>{let[l,s]=e;return(0,a.jsx)(eV.Z,{label:l,name:l,children:(0,a.jsx)(j.Z,{type:"password",defaultValue:s})},l)})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Save"})})]})})]})):null};let{Option:eW}=v.default;var eH=e=>{let{models:l,accessToken:s,routerSettings:t,setRouterSettings:n}=e,[i]=S.Z.useForm(),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)("");return(0,a.jsxs)("div",{children:[(0,a.jsx)(p.Z,{className:"mx-auto",onClick:()=>d(!0),children:"+ Add Fallbacks"}),(0,a.jsx)(w.Z,{title:"Add Fallbacks",visible:o,width:800,footer:null,onOk:()=>{d(!1),i.resetFields()},onCancel:()=>{d(!1),i.resetFields()},children:(0,a.jsxs)(S.Z,{form:i,onFinish:e=>{console.log(e);let{model_name:l,models:a}=e,r=[...t.fallbacks||[],{[l]:a}],o={...t,fallbacks:r};console.log(o);try{(0,u.K_)(s,{router_settings:o}),n(o)}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully"),d(!1),i.resetFields()},labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Public Model Name",name:"model_name",rules:[{required:!0,message:"Set the model to fallback for"}],help:"required",children:(0,a.jsx)(B.Z,{defaultValue:c,children:l&&l.map((e,l)=>(0,a.jsx)(K.Z,{value:e,onClick:()=>m(e),children:e},l))})}),(0,a.jsx)(S.Z.Item,{label:"Fallback Models",name:"models",rules:[{required:!0,message:"Please select a model"}],help:"required",children:(0,a.jsx)(ei.Z,{value:l,children:l&&l.filter(e=>e!=c).map(e=>(0,a.jsx)(eo.Z,{value:e,children:e},e))})})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Add Fallbacks"})})]})})]})},eG=s(12968);async function eJ(e,l){console.log("isLocal:",!1);let s=window.location.origin,t=new eG.ZP.OpenAI({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0});try{let l=await t.chat.completions.create({model:e,messages:[{role:"user",content:"Hi, this is a test message"}],mock_testing_fallbacks:!0});k.ZP.success((0,a.jsxs)("span",{children:["Test model=",(0,a.jsx)("strong",{children:e}),", received model=",(0,a.jsx)("strong",{children:l.model}),". See"," ",(0,a.jsx)("a",{href:"#",onClick:()=>window.open("https://docs.litellm.ai/docs/proxy/reliability","_blank"),style:{textDecoration:"underline",color:"blue"},children:"curl"})]}))}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}let eY={ttl:3600,lowest_latency_buffer:0},eX=e=>{let{selectedStrategy:l,strategyArgs:s,paramExplanation:t}=e;return(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(f.Z,{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Routing Strategy Specific Args"}),(0,a.jsx)(Z.Z,{children:"latency-based-routing"==l?(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(s).map(e=>{let[l,s]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:t[l]})]}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]})}):(0,a.jsx)(_.Z,{children:"No specific settings"})})]})};var e$=e=>{let{accessToken:l,userRole:s,userID:t,modelData:n}=e,[i,o]=(0,r.useState)({}),[d,c]=(0,r.useState)({}),[m,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)(!1),[b]=S.Z.useForm(),[v,w]=(0,r.useState)(null),[N,A]=(0,r.useState)(null),[C,P]=(0,r.useState)(null),T={routing_strategy_args:"(dict) Arguments to pass to the routing strategy",routing_strategy:"(string) Routing strategy to use",allowed_fails:"(int) Number of times a deployment can fail before being added to cooldown",cooldown_time:"(int) time in seconds to cooldown a deployment after failure",num_retries:"(int) Number of retries for failed requests. Defaults to 0.",timeout:"(float) Timeout for requests. Defaults to None.",retry_after:"(int) Minimum time to wait before retrying a failed request",ttl:"(int) Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"(float) Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};(0,r.useEffect)(()=>{l&&s&&t&&((0,u.BL)(l,t,s).then(e=>{console.log("callbacks",e),o(e.router_settings)}),(0,u.YU)(l).then(e=>{g(e)}))},[l,s,t]);let E=async e=>{if(l){console.log("received key: ".concat(e)),console.log("routerSettings['fallbacks']: ".concat(i.fallbacks)),i.fallbacks.map(l=>(e in l&&delete l[e],l));try{await (0,u.K_)(l,{router_settings:i}),o({...i}),A(i.routing_strategy),k.ZP.success("Router settings updated successfully")}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}}},W=(e,l)=>{g(m.map(s=>s.field_name===e?{...s,field_value:l}:s))},H=(e,s)=>{if(!l)return;let t=m[s].field_value;if(null!=t&&void 0!=t)try{(0,u.jA)(l,e,t);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:!0}:l);g(s)}catch(e){}},G=(e,s)=>{if(l)try{(0,u.ao)(l,e);let s=m.map(l=>l.field_name===e?{...l,stored_in_db:null,field_value:null}:l);g(s)}catch(e){}},J=e=>{if(!l)return;console.log("router_settings",e);let s=Object.fromEntries(Object.entries(e).map(e=>{let[l,s]=e;if("routing_strategy_args"!==l&&"routing_strategy"!==l){var t;return[l,(null===(t=document.querySelector('input[name="'.concat(l,'"]')))||void 0===t?void 0:t.value)||s]}if("routing_strategy"==l)return[l,N];if("routing_strategy_args"==l&&"latency-based-routing"==N){let e={},l=document.querySelector('input[name="lowest_latency_buffer"]'),s=document.querySelector('input[name="ttl"]');return(null==l?void 0:l.value)&&(e.lowest_latency_buffer=Number(l.value)),(null==s?void 0:s.value)&&(e.ttl=Number(s.value)),console.log("setRoutingStrategyArgs: ".concat(e)),["routing_strategy_args",e]}return null}).filter(e=>null!=e));console.log("updatedVariables",s);try{(0,u.K_)(l,{router_settings:s})}catch(e){k.ZP.error("Failed to update router settings: "+e,20)}k.ZP.success("router settings updated successfully")};return l?(0,a.jsx)("div",{className:"w-full mx-4",children:(0,a.jsxs)(et.Z,{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)(en.Z,{variant:"line",defaultValue:"1",children:[(0,a.jsx)(es.Z,{value:"1",children:"Loadbalancing"}),(0,a.jsx)(es.Z,{value:"2",children:"Fallbacks"}),(0,a.jsx)(es.Z,{value:"3",children:"General"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:[(0,a.jsx)(y.Z,{children:"Router Settings"}),(0,a.jsxs)(M.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"})]})}),(0,a.jsx)(L.Z,{children:Object.entries(i).filter(e=>{let[l,s]=e;return"fallbacks"!=l&&"context_window_fallbacks"!=l&&"routing_strategy_args"!=l}).map(e=>{let[l,s]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:l}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:T[l]})]}),(0,a.jsx)(U.Z,{children:"routing_strategy"==l?(0,a.jsxs)(B.Z,{defaultValue:s,className:"w-full max-w-md",onValueChange:A,children:[(0,a.jsx)(K.Z,{value:"usage-based-routing",children:"usage-based-routing"}),(0,a.jsx)(K.Z,{value:"latency-based-routing",children:"latency-based-routing"}),(0,a.jsx)(K.Z,{value:"simple-shuffle",children:"simple-shuffle"})]}):(0,a.jsx)(j.Z,{name:l,defaultValue:"object"==typeof s?JSON.stringify(s,null,2):s.toString()})})]},l)})})]}),(0,a.jsx)(eX,{selectedStrategy:N,strategyArgs:i&&i.routing_strategy_args&&Object.keys(i.routing_strategy_args).length>0?i.routing_strategy_args:eY,paramExplanation:T})]}),(0,a.jsx)(h.Z,{children:(0,a.jsx)(p.Z,{className:"mt-2",onClick:()=>J(i),children:"Save Changes"})})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Model Name"}),(0,a.jsx)(V.Z,{children:"Fallbacks"})]})}),(0,a.jsx)(L.Z,{children:i.fallbacks&&i.fallbacks.map((e,s)=>Object.entries(e).map(e=>{let[t,n]=e;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:t}),(0,a.jsx)(U.Z,{children:Array.isArray(n)?n.join(", "):n}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(p.Z,{onClick:()=>eJ(t,l),children:"Test Fallback"})}),(0,a.jsx)(U.Z,{children:(0,a.jsx)(R.Z,{icon:O.Z,size:"sm",onClick:()=>E(t)})})]},s.toString()+t)}))})]}),(0,a.jsx)(eH,{models:(null==n?void 0:n.data)?n.data.map(e=>e.model_name):[],accessToken:l,routerSettings:i,setRouterSettings:o})]}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(M.Z,{children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Setting"}),(0,a.jsx)(V.Z,{children:"Value"}),(0,a.jsx)(V.Z,{children:"Status"}),(0,a.jsx)(V.Z,{children:"Action"})]})}),(0,a.jsx)(L.Z,{children:m.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(_.Z,{children:e.field_name}),(0,a.jsx)("p",{style:{fontSize:"0.65rem",color:"#808080",fontStyle:"italic"},className:"mt-1",children:e.field_description})]}),(0,a.jsx)(U.Z,{children:"Integer"==e.field_type?(0,a.jsx)(I.Z,{step:1,value:e.field_value,onChange:l=>W(e.field_name,l)}):null}),(0,a.jsx)(U.Z,{children:!0==e.stored_in_db?(0,a.jsx)(F.Z,{icon:eL.Z,className:"text-white",children:"In DB"}):!1==e.stored_in_db?(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"In Config"}):(0,a.jsx)(F.Z,{className:"text-gray bg-white outline",children:"Not Set"})}),(0,a.jsxs)(U.Z,{children:[(0,a.jsx)(p.Z,{onClick:()=>H(e.field_name,l),children:"Update"}),(0,a.jsx)(R.Z,{icon:O.Z,color:"red",onClick:()=>G(e.field_name,l),children:"Reset"})]})]},l))})]})})})]})]})}):null},eQ=e=>{let{isModalVisible:l,accessToken:s,setIsModalVisible:t,setBudgetList:n}=e,[r]=S.Z.useForm(),i=async e=>{if(null!=s&&void 0!=s)try{k.ZP.info("Making API Call");let l=await (0,u.Zr)(s,e);console.log("key create Response:",l),n(e=>e?[...e,l]:[l]),k.ZP.success("API Key Created"),r.resetFields()}catch(e){console.error("Error creating the key:",e),k.ZP.error("Error creating the key: ".concat(e),20)}};return(0,a.jsx)(w.Z,{title:"Create Budget",visible:l,width:800,footer:null,onOk:()=>{t(!1),r.resetFields()},onCancel:()=>{t(!1),r.resetFields()},children:(0,a.jsxs)(S.Z,{form:r,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,a.jsx)(j.Z,{placeholder:""})}),(0,a.jsx)(S.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,a.jsx)(I.Z,{step:1,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,a.jsx)(I.Z,{step:1,precision:2,width:200})}),(0,a.jsxs)(g.Z,{className:"mt-20 mb-8",children:[(0,a.jsx)(f.Z,{children:(0,a.jsx)("b",{children:"Optional Settings"})}),(0,a.jsxs)(Z.Z,{children:[(0,a.jsx)(S.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,a.jsx)(I.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(S.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,a.jsxs)(v.default,{defaultValue:null,placeholder:"n/a",children:[(0,a.jsx)(v.default.Option,{value:"24h",children:"daily"}),(0,a.jsx)(v.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(A.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},e0=e=>{let{accessToken:l}=e,[s,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&(0,u.O3)(l).then(e=>{i(e)})},[l]);let o=async(e,s)=>{if(null==l)return;k.ZP.info("Request made"),await (0,u.NV)(l,e);let t=[...n];t.splice(s,1),i(t),k.ZP.success("Budget Deleted.")};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsx)(p.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>t(!0),children:"+ Create Budget"}),(0,a.jsx)(eQ,{accessToken:l,isModalVisible:s,setIsModalVisible:t,setBudgetList:i}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(_.Z,{children:"Create a budget to assign to customers."}),(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Budget ID"}),(0,a.jsx)(V.Z,{children:"Max Budget"}),(0,a.jsx)(V.Z,{children:"TPM"}),(0,a.jsx)(V.Z,{children:"RPM"})]})}),(0,a.jsx)(L.Z,{children:n.map((e,l)=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.budget_id}),(0,a.jsx)(U.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,a.jsx)(U.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,a.jsx)(U.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,a.jsx)(R.Z,{icon:O.Z,size:"sm",onClick:()=>o(e.budget_id,l)})]},l))})]})]}),(0,a.jsxs)("div",{className:"mt-5",children:[(0,a.jsx)(_.Z,{className:"text-base",children:"How to use budget id"}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"Assign Budget to Customer"}),(0,a.jsx)(es.Z,{children:"Test it (Curl)"}),(0,a.jsx)(es.Z,{children:"Test it (OpenAI SDK)"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="{let{}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsxs)("div",{className:"mb-5",children:[(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,a.jsx)(_.Z,{className:"mt-2 mb-2",children:"LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below "}),(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{children:[(0,a.jsx)(es.Z,{children:"OpenAI Python SDK"}),(0,a.jsx)(es.Z,{children:"LlamaIndex"}),(0,a.jsx)(es.Z,{children:"Langchain Py"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n '})}),(0,a.jsx)(ea.Z,{children:(0,a.jsx)(ek.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "gpt-3.5-turbo",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n '})})]})]})]})})})};async function e4(e,l,s,t){console.log("isLocal:",!1);let n=window.location.origin,a=new eG.ZP.OpenAI({apiKey:t,baseURL:n,dangerouslyAllowBrowser:!0});try{for await(let t of(await a.chat.completions.create({model:s,stream:!0,messages:[{role:"user",content:e}]})))console.log(t),t.choices[0].delta.content&&l(t.choices[0].delta.content)}catch(e){k.ZP.error("Error occurred while generating model response. Please try again. Error: ".concat(e),20)}}var e5=e=>{let{accessToken:l,token:s,userRole:t,userID:n}=e,[i,o]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)(void 0),[y,b]=(0,r.useState)([]);(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{let e=await (0,u.So)(l,n,t);if(console.log("model_info:",e),(null==e?void 0:e.data.length)>0){let l=e.data.map(e=>({value:e.id,label:e.id}));console.log(l),b(l),f(e.data[0].id)}}catch(e){console.error("Error fetching model info:",e)}})()},[l,n,t]);let S=(e,l)=>{g(s=>{let t=s[s.length-1];return t&&t.role===e?[...s.slice(0,s.length-1),{role:e,content:t.content+l}]:[...s,{role:e,content:l}]})},k=async()=>{if(""!==d.trim()&&i&&s&&t&&n){g(e=>[...e,{role:"user",content:d}]);try{Z&&await e4(d,e=>S("assistant",e),Z,i)}catch(e){console.error("Error fetching model response",e),S("assistant","Error fetching model response")}c("")}};if(t&&"Admin Viewer"==t){let{Title:e,Paragraph:l}=$.default;return(0,a.jsxs)("div",{children:[(0,a.jsx)(e,{level:1,children:"Access Denied"}),(0,a.jsx)(l,{children:"Ask your proxy admin for access to test models"})]})}return(0,a.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,a.jsx)(x.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,a.jsx)(M.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsx)(en.Z,{children:(0,a.jsx)(es.Z,{children:"Chat"})}),(0,a.jsx)(er.Z,{children:(0,a.jsxs)(ea.Z,{children:[(0,a.jsx)("div",{className:"sm:max-w-2xl",children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"API Key"}),(0,a.jsx)(j.Z,{placeholder:"Type API Key here",type:"password",onValueChange:o,value:i})]}),(0,a.jsxs)(h.Z,{className:"mx-2",children:[(0,a.jsx)(_.Z,{children:"Select Model:"}),(0,a.jsx)(v.default,{placeholder:"Select a Model",onChange:e=>{console.log("selected ".concat(e)),f(e)},options:y,style:{width:"200px"}})]})]})}),(0,a.jsxs)(D.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,a.jsx)(q.Z,{children:(0,a.jsx)(z.Z,{children:(0,a.jsx)(U.Z,{})})}),(0,a.jsx)(L.Z,{children:m.map((e,l)=>(0,a.jsx)(z.Z,{children:(0,a.jsx)(U.Z,{children:"".concat(e.role,": ").concat(e.content)})},l))})]}),(0,a.jsx)("div",{className:"mt-3",style:{position:"absolute",bottom:5,width:"95%"},children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(j.Z,{type:"text",value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&k()},placeholder:"Type your message..."}),(0,a.jsx)(p.Z,{onClick:k,className:"ml-2",children:"Send"})]})})]})})]})})})})},e8=s(33509),e3=s(95781);let{Sider:e6}=e8.default;var e9=e=>{let{setPage:l,userRole:s,defaultSelectedKey:t}=e;return"Admin Viewer"==s?(0,a.jsx)(e8.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,a.jsx)(e6,{width:120,children:(0,a.jsx)(e3.Z,{mode:"inline",defaultSelectedKeys:t||["4"],style:{height:"100%",borderRight:0},children:(0,a.jsx)(e3.Z.Item,{onClick:()=>l("usage"),children:"Usage"},"1")})})}):(0,a.jsx)(e8.default,{style:{minHeight:"100vh",maxWidth:"145px"},children:(0,a.jsx)(e6,{width:145,children:(0,a.jsxs)(e3.Z,{mode:"inline",defaultSelectedKeys:t||["1"],style:{height:"100%",borderRight:0},children:[(0,a.jsx)(e3.Z.Item,{onClick:()=>l("api-keys"),children:(0,a.jsx)(_.Z,{children:"API Keys"})},"1"),(0,a.jsx)(e3.Z.Item,{onClick:()=>l("llm-playground"),children:(0,a.jsx)(_.Z,{children:"Test Key"})},"3"),"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("models"),children:(0,a.jsx)(_.Z,{children:"Models"})},"2"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("usage"),children:(0,a.jsx)(_.Z,{children:"Usage"})},"4"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("teams"),children:(0,a.jsx)(_.Z,{children:"Teams"})},"6"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("users"),children:(0,a.jsx)(_.Z,{children:"Internal Users"})},"5"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("settings"),children:(0,a.jsx)(_.Z,{children:"Logging & Alerts"})},"8"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("budgets"),children:(0,a.jsx)(_.Z,{children:"Budgets"})},"9"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("general-settings"),children:(0,a.jsx)(_.Z,{children:"Router Settings"})},"10"):null,"Admin"==s?(0,a.jsx)(e3.Z.Item,{onClick:()=>l("admin-panel"),children:(0,a.jsx)(_.Z,{children:"Admin"})},"11"):null,(0,a.jsx)(e3.Z.Item,{onClick:()=>l("api_ref"),children:(0,a.jsx)(_.Z,{children:"API Reference"})},"12"),(0,a.jsx)(e3.Z.Item,{onClick:()=>l("model-hub"),children:(0,a.jsx)(_.Z,{children:"Model Hub"})},"14")]})})})},e7=s(67989),le=s(52703),ll=e=>{let{accessToken:l,token:s,userRole:t,userID:n,keys:i,premiumUser:o}=e,d=new Date,[c,m]=(0,r.useState)([]),[j,g]=(0,r.useState)([]),[Z,f]=(0,r.useState)([]),[b,v]=(0,r.useState)([]),[S,k]=(0,r.useState)([]),[w,N]=(0,r.useState)([]),[I,A]=(0,r.useState)([]),[C,P]=(0,r.useState)([]),[T,E]=(0,r.useState)([]),[O,F]=(0,r.useState)([]),[R,W]=(0,r.useState)({}),[H,J]=(0,r.useState)([]),[Y,X]=(0,r.useState)(""),[$,Q]=(0,r.useState)(["all-tags"]),[em,eu]=(0,r.useState)({from:new Date(Date.now()-6048e5),to:new Date}),eh=new Date(d.getFullYear(),d.getMonth(),1),ex=new Date(d.getFullYear(),d.getMonth()+1,0),ep=e_(eh),ej=e_(ex);function eg(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}console.log("keys in usage",i),console.log("premium user in usage",o),(0,r.useEffect)(()=>{ef(em.from,em.to)},[em,$]);let eZ=async(e,s,t)=>{if(!e||!s||!l)return;s.setHours(23,59,59,999),e.setHours(0,0,0,0),console.log("uiSelectedKey",t);let n=await (0,u.b1)(l,t,e.toISOString(),s.toISOString());console.log("End user data updated successfully",n),v(n)},ef=async(e,s)=>{e&&s&&l&&(s.setHours(23,59,59,999),e.setHours(0,0,0,0),N((await (0,u.J$)(l,e.toISOString(),s.toISOString(),0===$.length?void 0:$)).spend_per_tag),console.log("Tag spend data updated successfully"))};function e_(e){let l=e.getFullYear(),s=e.getMonth()+1,t=e.getDate();return"".concat(l,"-").concat(s<10?"0"+s:s,"-").concat(t<10?"0"+t:t)}return console.log("Start date is ".concat(ep)),console.log("End date is ".concat(ej)),(0,r.useEffect)(()=>{l&&s&&t&&n&&(async()=>{try{if(console.log("user role: ".concat(t)),"Admin"==t||"Admin Viewer"==t){var e,a;let t=await (0,u.FC)(l);m(t);let n=await (0,u.OU)(l,s,ep,ej);console.log("provider_spend",n),F(n);let r=(await (0,u.tN)(l)).map(e=>({key:(e.key_alias||e.key_name||e.api_key).substring(0,10),spend:e.total_spend}));g(r);let i=(await (0,u.Au)(l)).map(e=>({key:e.model,spend:e.total_spend}));f(i);let o=await (0,u.mR)(l);console.log("teamSpend",o),k(o.daily_spend),P(o.teams);let d=o.total_spend_per_team;d=d.map(e=>(e.name=e.team_id||"",e.value=e.total_spend||0,e.value=e.value.toFixed(2),e)),E(d);let c=await (0,u.X)(l);A(c.tag_names);let h=await (0,u.J$)(l,null===(e=em.from)||void 0===e?void 0:e.toISOString(),null===(a=em.to)||void 0===a?void 0:a.toISOString(),void 0);N(h.spend_per_tag);let x=await (0,u.b1)(l,null,void 0,void 0);v(x),console.log("spend/user result",x);let p=await (0,u.wd)(l,ep,ej);W(p);let j=await (0,u.xA)(l,ep,ej);console.log("global activity per model",j),J(j)}else"App Owner"==t&&await (0,u.HK)(l,s,t,n,ep,ej).then(async e=>{if(console.log("result from spend logs call",e),"daily_spend"in e){let l=e.daily_spend;console.log("daily spend",l),m(l);let s=e.top_api_keys;g(s)}else{let s=(await (0,u.e2)(l,function(e){let l=[];e.forEach(e=>{Object.entries(e).forEach(e=>{let[s,t]=e;"spend"!==s&&"startTime"!==s&&"models"!==s&&"users"!==s&&l.push({key:s,spend:t})})}),l.sort((e,l)=>Number(l.spend)-Number(e.spend));let s=l.slice(0,5).map(e=>e.key);return console.log("topKeys: ".concat(Object.keys(s[0]))),s}(e))).info.map(e=>({key:(e.key_name||e.key_alias).substring(0,10),spend:e.spend}));g(s),m(e)}})}catch(e){console.error("There was an error fetching the data",e)}})()},[l,s,t,n,ep,ej]),(0,a.jsx)("div",{style:{width:"100%"},className:"p-8",children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{className:"mt-2",children:[(0,a.jsx)(es.Z,{children:"All Up"}),(0,a.jsx)(es.Z,{children:"Team Based Usage"}),(0,a.jsx)(es.Z,{children:"Customer Usage"}),(0,a.jsx)(es.Z,{children:"Tag Based Usage"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(et.Z,{children:[(0,a.jsxs)(en.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(es.Z,{children:"Cost"}),(0,a.jsx)(es.Z,{children:"Activity"})]}),(0,a.jsxs)(er.Z,{children:[(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[100vh] w-full",children:[(0,a.jsx)(G,{userID:n,userRole:t,accessToken:l,userSpend:null,selectedTeam:null}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Monthly Spend"}),(0,a.jsx)(ec.Z,{data:c,index:"date",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Top API Keys"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:j,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:80,tickGap:5,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Top Models"}),(0,a.jsx)(ec.Z,{className:"mt-4 h-40",data:Z,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,a.jsx)(h.Z,{numColSpan:1}),(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"✨ Spend by Provider"}),o?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(le.Z,{className:"mt-4 h-40",variant:"pie",data:O,index:"provider",category:"spend"})}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)(D.Z,{children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Provider"}),(0,a.jsx)(V.Z,{children:"Spend"})]})}),(0,a.jsx)(L.Z,{children:O.map(e=>(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.provider}),(0,a.jsx)(U.Z,{children:1e-5>parseFloat(e.spend.toFixed(2))?"less than 0.00":e.spend.toFixed(2)})]},e.provider))})]})})]})}):(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to use this feature"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})]})]})})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:1,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"All Up"}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(R.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:R.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["api_requests"],onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(R.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:R.daily_data,valueFormatter:eg,index:"date",colors:["cyan"],categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]}),o?(0,a.jsx)(a.Fragment,{children:H.map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["total_tokens"],valueFormatter:eg,onValueChange:e=>console.log(e)})]})]})]},l))}):(0,a.jsx)(a.Fragment,{children:H&&H.length>0&&H.slice(0,1).map((e,l)=>(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"✨ Activity by Model"}),(0,a.jsx)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:"Upgrade to see analytics for all models"}),(0,a.jsx)(p.Z,{variant:"primary",className:"mb-2",children:(0,a.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:e.model}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["API Requests ",eg(e.sum_api_requests)]}),(0,a.jsx)(ed.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],categories:["api_requests"],valueFormatter:eg,onValueChange:e=>console.log(e)})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsxs)(ee.Z,{style:{fontSize:"15px",fontWeight:"normal",color:"#535452"},children:["Tokens ",eg(e.sum_total_tokens)]}),(0,a.jsx)(ec.Z,{className:"h-40",data:e.daily_data,index:"date",colors:["cyan"],valueFormatter:eg,categories:["total_tokens"],onValueChange:e=>console.log(e)})]})]})]})]},l))})]})})]})]})}),(0,a.jsx)(ea.Z,{children:(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full",children:[(0,a.jsxs)(h.Z,{numColSpan:2,children:[(0,a.jsxs)(M.Z,{className:"mb-2",children:[(0,a.jsx)(y.Z,{children:"Total Spend Per Team"}),(0,a.jsx)(e7.Z,{data:T})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Daily Spend Per Team"}),(0,a.jsx)(ec.Z,{className:"h-72",data:S,showLegend:!0,index:"date",categories:C,yAxisWidth:80,colors:["blue","green","yellow","red","purple"],stack:!0})]})]}),(0,a.jsx)(h.Z,{numColSpan:2})]})}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)("p",{className:"mb-2 text-gray-500 italic text-[12px]",children:["Customers of your LLM API calls. Tracked when a `user` param is passed in your LLM calls ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/users",target:"_blank",children:"docs here"})]}),(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Time Range"}),(0,a.jsx)(el.Z,{enableSelect:!0,value:em,onValueChange:e=>{eu(e),eZ(e.from,e.to,null)}})]}),(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(_.Z,{children:"Select Key"}),(0,a.jsxs)(B.Z,{defaultValue:"all-keys",children:[(0,a.jsx)(K.Z,{value:"all-keys",onClick:()=>{eZ(em.from,em.to,null)},children:"All Keys"},"all-keys"),null==i?void 0:i.map((e,l)=>e&&null!==e.key_alias&&e.key_alias.length>0?(0,a.jsx)(K.Z,{value:String(l),onClick:()=>{eZ(em.from,em.to,e.token)},children:e.key_alias},l):null)]})]})]}),(0,a.jsx)(M.Z,{className:"mt-4",children:(0,a.jsxs)(D.Z,{className:"max-h-[70vh] min-h-[500px]",children:[(0,a.jsx)(q.Z,{children:(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(V.Z,{children:"Customer"}),(0,a.jsx)(V.Z,{children:"Spend"}),(0,a.jsx)(V.Z,{children:"Total Events"})]})}),(0,a.jsx)(L.Z,{children:null==b?void 0:b.map((e,l)=>{var s;return(0,a.jsxs)(z.Z,{children:[(0,a.jsx)(U.Z,{children:e.end_user}),(0,a.jsx)(U.Z,{children:null===(s=e.total_spend)||void 0===s?void 0:s.toFixed(4)}),(0,a.jsx)(U.Z,{children:e.total_count})]},l)})})]})})]}),(0,a.jsxs)(ea.Z,{children:[(0,a.jsxs)(x.Z,{numItems:2,children:[(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsx)(el.Z,{className:"mb-4",enableSelect:!0,value:em,onValueChange:e=>{eu(e),ef(e.from,e.to)}})}),(0,a.jsx)(h.Z,{children:o?(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),I&&I.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsx)(eo.Z,{value:String(e),children:e},e))]})}):(0,a.jsx)("div",{children:(0,a.jsxs)(ei.Z,{value:$,onValueChange:e=>Q(e),children:[(0,a.jsx)(eo.Z,{value:"all-tags",onClick:()=>Q(["all-tags"]),children:"All Tags"},"all-tags"),I&&I.filter(e=>"all-tags"!==e).map((e,l)=>(0,a.jsxs)(K.Z,{value:String(e),disabled:!0,children:["✨ ",e," (Enterpise only Feature)"]},e))]})})})]}),(0,a.jsxs)(x.Z,{numItems:2,className:"gap-2 h-[75vh] w-full mb-4",children:[(0,a.jsx)(h.Z,{numColSpan:2,children:(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(y.Z,{children:"Spend Per Tag"}),(0,a.jsxs)(_.Z,{children:["Get Started Tracking cost per tag ",(0,a.jsx)("a",{className:"text-blue-500",href:"https://docs.litellm.ai/docs/proxy/cost_tracking",target:"_blank",children:"here"})]}),(0,a.jsx)(ec.Z,{className:"h-72",data:w,index:"name",categories:["spend"],colors:["blue"]})]})}),(0,a.jsx)(h.Z,{numColSpan:2})]})]})]})]})})},ls=()=>{let{Title:e,Paragraph:l}=$.default,[s,t]=(0,r.useState)(""),[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[u,h]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[j,g]=(0,r.useState)(!0),Z=(0,i.useSearchParams)(),[f,_]=(0,r.useState)({data:[]}),y=Z.get("userID"),b=Z.get("token"),[v,S]=(0,r.useState)("api-keys"),[k,w]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(b){let e=(0,X.o)(b);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),w(e.key),e.user_role){let l=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e.toLowerCase())),console.log("Received user role length: ".concat(e.toLowerCase().length)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"internal_user":return"Internal User";case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",l),t(l),"Admin Viewer"==l&&S("usage")}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e)),e.login_method?g("username_password"==e.login_method):console.log("User Email is not set ".concat(e)),e.premium_user&&o(e.premium_user)}}},[b]),(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("div",{children:"Loading..."}),children:(0,a.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,a.jsx)(m,{userID:y,userRole:s,userEmail:d,showSSOBanner:j,premiumUser:n}),(0,a.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,a.jsx)("div",{className:"mt-8",children:(0,a.jsx)(e9,{setPage:S,userRole:s,defaultSelectedKey:null})}),"api-keys"==v?(0,a.jsx)(Q,{userID:y,userRole:s,teams:u,keys:x,setUserRole:t,userEmail:d,setUserEmail:c,setTeams:h,setKeys:p}):"models"==v?(0,a.jsx)(eP,{userID:y,userRole:s,token:b,keys:x,accessToken:k,modelData:f,setModelData:_,premiumUser:n}):"llm-playground"==v?(0,a.jsx)(e5,{userID:y,userRole:s,token:b,accessToken:k}):"users"==v?(0,a.jsx)(eF,{userID:y,userRole:s,token:b,keys:x,teams:u,accessToken:k,setKeys:p}):"teams"==v?(0,a.jsx)(eM,{teams:u,setTeams:h,searchParams:Z,accessToken:k,userID:y,userRole:s}):"admin-panel"==v?(0,a.jsx)(eR,{setTeams:h,searchParams:Z,accessToken:k,showSSOBanner:j}):"api_ref"==v?(0,a.jsx)(e2,{}):"settings"==v?(0,a.jsx)(eK,{userID:y,userRole:s,accessToken:k,premiumUser:n}):"budgets"==v?(0,a.jsx)(e0,{accessToken:k}):"general-settings"==v?(0,a.jsx)(e$,{userID:y,userRole:s,accessToken:k,modelData:f}):"model-hub"==v?(0,a.jsx)(e1.Z,{accessToken:k,publicPage:!1,premiumUser:n}):(0,a.jsx)(ll,{userID:y,userRole:s,token:b,accessToken:k,keys:x,premiumUser:n})]})]})})}},41134:function(e,l,s){"use strict";s.d(l,{Z:function(){return y}});var t=s(3827),n=s(64090),a=s(47907),r=s(777),i=s(16450),o=s(13810),d=s(92836),c=s(26734),m=s(41608),u=s(32126),h=s(23682),x=s(71801),p=s(42440),j=s(84174),g=s(50459),Z=s(6180),f=s(99129),_=s(67951),y=e=>{var l;let{accessToken:s,publicPage:y,premiumUser:b}=e,[v,S]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),[N,I]=(0,n.useState)(!1),[A,C]=(0,n.useState)(!1),[P,T]=(0,n.useState)(null),E=(0,a.useRouter)();(0,n.useEffect)(()=>{s&&(async()=>{try{let e=await (0,r.kn)(s);console.log("ModelHubData:",e),w(e.data),(0,r.E9)(s,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&S(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}})()},[s,y]);let O=e=>{T(e),I(!0)},F=async()=>{s&&(0,r.jA)(s,"enable_public_model_hub",!0).then(e=>{C(!0)})},M=()=>{I(!1),C(!1),T(null)},R=()=>{I(!1),C(!1),T(null)},D=e=>{navigator.clipboard.writeText(e)};return(0,t.jsxs)("div",{children:[y&&v||!1==y?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsx)("div",{className:"relative w-full"}),(0,t.jsxs)("div",{className:"flex ".concat(y?"justify-between":"items-center"),children:[(0,t.jsx)(p.Z,{className:"ml-8 text-center ",children:"Model Hub"}),!1==y?b?(0,t.jsx)(i.Z,{className:"ml-4",onClick:()=>F(),children:"✨ Make Public"}):(0,t.jsx)(i.Z,{className:"ml-4",children:(0,t.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"✨ Make Public"})}):(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("p",{children:"Filter by key:"}),(0,t.jsx)(x.Z,{className:"bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center",children:"/ui/model_hub?key="})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-6 sm:grid-cols-3 lg:grid-cols-4 pr-8",children:k&&k.map(e=>(0,t.jsxs)(o.Z,{className:"mt-5 mx-8",children:[(0,t.jsxs)("pre",{className:"flex justify-between",children:[(0,t.jsx)(p.Z,{children:e.model_group}),(0,t.jsx)(Z.Z,{title:e.model_group,children:(0,t.jsx)(j.Z,{onClick:()=>D(e.model_group),style:{cursor:"pointer",marginRight:"10px"}})})]}),(0,t.jsxs)("div",{className:"my-5",children:[(0,t.jsxs)(x.Z,{children:["Mode: ",e.mode]}),(0,t.jsxs)(x.Z,{children:["Supports Function Calling:"," ",(null==e?void 0:e.supports_function_calling)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Supports Vision:"," ",(null==e?void 0:e.supports_vision)==!0?"Yes":"No"]}),(0,t.jsxs)(x.Z,{children:["Max Input Tokens:"," ",(null==e?void 0:e.max_input_tokens)?null==e?void 0:e.max_input_tokens:"N/A"]}),(0,t.jsxs)(x.Z,{children:["Max Output Tokens:"," ",(null==e?void 0:e.max_output_tokens)?null==e?void 0:e.max_output_tokens:"N/A"]})]}),(0,t.jsx)("div",{style:{marginTop:"auto",textAlign:"right"},children:(0,t.jsxs)("a",{href:"#",onClick:()=>O(e),style:{color:"#1890ff",fontSize:"smaller"},children:["View more ",(0,t.jsx)(g.Z,{})]})})]},e.model_group))})]}):(0,t.jsxs)(o.Z,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(x.Z,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(f.Z,{title:"Public Model Hub",width:600,visible:A,footer:null,onOk:M,onCancel:R,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(x.Z,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(x.Z,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"/ui/model_hub?key="})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Z,{onClick:()=>{E.replace("/model_hub?key=".concat(s))},children:"See Page"})})]})}),(0,t.jsx)(f.Z,{title:P&&P.model_group?P.model_group:"Unknown Model",width:800,visible:N,footer:null,onOk:M,onCancel:R,children:P&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-4",children:(0,t.jsx)("strong",{children:"Model Information & Usage"})}),(0,t.jsxs)(c.Z,{children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(d.Z,{children:"OpenAI Python SDK"}),(0,t.jsx)(d.Z,{children:"Supported OpenAI Params"}),(0,t.jsx)(d.Z,{children:"LlamaIndex"}),(0,t.jsx)(d.Z,{children:"Langchain Py"})]}),(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(P.model_group,'", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:"".concat(null===(l=P.supported_openai_params)||void 0===l?void 0:l.map(e=>"".concat(e,"\n")).join(""))})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="'.concat(P.model_group,'", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n ')})}),(0,t.jsx)(u.Z,{children:(0,t.jsx)(_.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:4000",\n model = "'.concat(P.model_group,'",\n temperature=0.1\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n ')})})]})]})]})})]})}}},function(e){e.O(0,[936,294,131,684,759,777,971,69,744],function(){return e(e.s=20661)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_buildManifest.js b/ui/litellm-dashboard/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_buildManifest.js
similarity index 100%
rename from ui/litellm-dashboard/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_buildManifest.js
rename to ui/litellm-dashboard/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_buildManifest.js
diff --git a/ui/litellm-dashboard/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_ssgManifest.js b/ui/litellm-dashboard/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_ssgManifest.js
similarity index 100%
rename from ui/litellm-dashboard/out/_next/static/WPKSRXMTZwo2QWewBmJsa/_ssgManifest.js
rename to ui/litellm-dashboard/out/_next/static/mFLHIb9p_OgUy_J1Tzem7/_ssgManifest.js
diff --git a/ui/litellm-dashboard/out/index.html b/ui/litellm-dashboard/out/index.html
index f458d65ec..5a054d50f 100644
--- a/ui/litellm-dashboard/out/index.html
+++ b/ui/litellm-dashboard/out/index.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/index.txt b/ui/litellm-dashboard/out/index.txt
index 9189dd058..b6ba7c9a5 100644
--- a/ui/litellm-dashboard/out/index.txt
+++ b/ui/litellm-dashboard/out/index.txt
@@ -1,7 +1,7 @@
2:I[77831,[],""]
-3:I[30217,["936","static/chunks/2f6dbc85-052c4579f80d66ae.js","294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","235","static/chunks/235-bab36c9b7a1c87ea.js","759","static/chunks/759-83a8bdddfe32b5d9.js","777","static/chunks/777-ce1c9c18434e9ecb.js","931","static/chunks/app/page-42570e92ea8bcf56.js"],""]
+3:I[31034,["936","static/chunks/2f6dbc85-052c4579f80d66ae.js","294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","684","static/chunks/684-bb2d2f93d92acb0b.js","759","static/chunks/759-83a8bdddfe32b5d9.js","777","static/chunks/777-ce1c9c18434e9ecb.js","931","static/chunks/app/page-7788673d99ee79d9.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/out/model_hub.html b/ui/litellm-dashboard/out/model_hub.html
index 0e379c329..80a9a9ee0 100644
--- a/ui/litellm-dashboard/out/model_hub.html
+++ b/ui/litellm-dashboard/out/model_hub.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/model_hub.txt b/ui/litellm-dashboard/out/model_hub.txt
index 68e46fe14..53fcf5eca 100644
--- a/ui/litellm-dashboard/out/model_hub.txt
+++ b/ui/litellm-dashboard/out/model_hub.txt
@@ -2,6 +2,6 @@
3:I[87494,["294","static/chunks/294-0e35509d5ca95267.js","131","static/chunks/131-6a03368053f9d26d.js","777","static/chunks/777-ce1c9c18434e9ecb.js","418","static/chunks/app/model_hub/page-ed96a1646c72dbd1.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["model_hub",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["model_hub",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","model_hub","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["model_hub",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["model_hub",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","model_hub","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/out/onboarding.html b/ui/litellm-dashboard/out/onboarding.html
index 01b9a2047..50b15455f 100644
--- a/ui/litellm-dashboard/out/onboarding.html
+++ b/ui/litellm-dashboard/out/onboarding.html
@@ -1 +1 @@
-LiteLLM Dashboard
\ No newline at end of file
+LiteLLM Dashboard
\ No newline at end of file
diff --git a/ui/litellm-dashboard/out/onboarding.txt b/ui/litellm-dashboard/out/onboarding.txt
index 90d840005..e4c35ff96 100644
--- a/ui/litellm-dashboard/out/onboarding.txt
+++ b/ui/litellm-dashboard/out/onboarding.txt
@@ -1,7 +1,7 @@
2:I[77831,[],""]
-3:I[667,["665","static/chunks/3014691f-589a5f4865c3822f.js","294","static/chunks/294-0e35509d5ca95267.js","235","static/chunks/235-bab36c9b7a1c87ea.js","777","static/chunks/777-ce1c9c18434e9ecb.js","461","static/chunks/app/onboarding/page-65fcd3f148cc3f6e.js"],""]
+3:I[667,["665","static/chunks/3014691f-589a5f4865c3822f.js","294","static/chunks/294-0e35509d5ca95267.js","684","static/chunks/684-bb2d2f93d92acb0b.js","777","static/chunks/777-ce1c9c18434e9ecb.js","461","static/chunks/app/onboarding/page-3c7091570f67cd10.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
-0:["WPKSRXMTZwo2QWewBmJsa",[[["",{"children":["onboarding",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["onboarding",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","onboarding","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+0:["mFLHIb9p_OgUy_J1Tzem7",[[["",{"children":["onboarding",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["onboarding",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","onboarding","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/f02cb03d96e276ef.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"LiteLLM Dashboard"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/src/components/settings.tsx b/ui/litellm-dashboard/src/components/settings.tsx
index 0ca13e6eb..fe2735d4a 100644
--- a/ui/litellm-dashboard/src/components/settings.tsx
+++ b/ui/litellm-dashboard/src/components/settings.tsx
@@ -841,6 +841,7 @@ const Settings: React.FC = ({
@@ -877,6 +878,7 @@ const Settings: React.FC = ({