-
${t.model} ${t.provider?`(${t.provider})`:""}
-
-
-
-
-
- | Cost Type |
- Per Request |
- ${null!==t.daily_cost?"Daily | ":""}
- ${null!==t.monthly_cost?"Monthly | ":""}
-
-
- | Input Cost |
- ${eT(t.input_cost_per_request)} |
- ${null!==t.daily_cost?`${eT(t.daily_input_cost)} | `:""}
- ${null!==t.monthly_cost?`${eT(t.monthly_input_cost)} | `:""}
-
-
- | Output Cost |
- ${eT(t.output_cost_per_request)} |
- ${null!==t.daily_cost?`${eT(t.daily_output_cost)} | `:""}
- ${null!==t.monthly_cost?`${eT(t.monthly_output_cost)} | `:""}
-
-
- | Margin/Fee |
- ${eT(t.margin_cost_per_request)} |
- ${null!==t.daily_cost?`${eT(t.daily_margin_cost)} | `:""}
- ${null!==t.monthly_cost?`${eT(t.monthly_margin_cost)} | `:""}
-
-
- | Total |
- ${eT(t.cost_per_request)} |
- ${null!==t.daily_cost?`${eT(t.daily_cost)} | `:""}
- ${null!==t.monthly_cost?`${eT(t.monthly_cost)} | `:""}
-
-
-
- `}).join("")}
-
-
-
-
- `;t.document.write(a),t.document.close(),t.onload=()=>{t.print()}})(e),a(!1)},children:[(0,t.jsx)(e_.FilePdfOutlined,{className:"mr-3 text-red-500"}),"Export as PDF"]}),(0,t.jsxs)("button",{className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>{(e=>{let t=e.entries.filter(e=>null!==e.result),s=[["LLM Multi-Model Cost Estimate Report"],["Generated",new Date().toLocaleString()],[""]];for(let r of(s.push(["COMBINED TOTALS"],["Total Per Request",e.totals.cost_per_request.toString()],["Total Daily",e.totals.daily_cost?.toString()||"-"],["Total Monthly",e.totals.monthly_cost?.toString()||"-"],["Margin Per Request",e.totals.margin_per_request.toString()],["Daily Margin",e.totals.daily_margin?.toString()||"-"],["Monthly Margin",e.totals.monthly_margin?.toString()||"-"],[""]),s.push(["Model","Provider","Input Tokens","Output Tokens","Requests/Day","Requests/Month","Cost/Request","Daily Cost","Monthly Cost","Input Cost/Req","Output Cost/Req","Margin/Req"]),t)){let e=r.result;s.push([e.model,e.provider||"-",e.input_tokens.toString(),e.output_tokens.toString(),e.num_requests_per_day?.toString()||"-",e.num_requests_per_month?.toString()||"-",e.cost_per_request.toString(),e.daily_cost?.toString()||"-",e.monthly_cost?.toString()||"-",e.input_cost_per_request.toString(),e.output_cost_per_request.toString(),e.margin_cost_per_request.toString()])}let r=new Blob([s.map(e=>e.map(e=>`"${e}"`).join(",")).join("\n")],{type:"text/csv;charset=utf-8;"}),a=window.URL.createObjectURL(r),l=document.createElement("a");l.href=a,l.download=`cost_estimate_multi_model_${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(a)})(e),a(!1)},children:[(0,t.jsx)(eC,{className:"mr-3 text-green-600"}),"Export as CSV"]})]})]}):null},eP=e=>null==e?"-":0===e?"$0":e<1e-4?`$${e.toExponential(2)}`:e<1?`$${e.toFixed(4)}`:`$${(0,ej.formatNumberWithCommas)(e,2,!0)}`,eM=({result:e,loading:s,timePeriod:r})=>{let l="day"===r?"Daily":"Monthly",n="day"===r?e.daily_cost:e.monthly_cost,o="day"===r?e.daily_input_cost:e.monthly_input_cost,i="day"===r?e.daily_output_cost:e.monthly_output_cost,d="day"===r?e.daily_margin_cost:e.monthly_margin_cost,c="day"===r?e.num_requests_per_day:e.num_requests_per_month;return(0,t.jsxs)("div",{className:"space-y-3 bg-gray-50 p-4 rounded-lg",children:[s&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-500 text-sm",children:[(0,t.jsx)(eg.Spin,{indicator:(0,t.jsx)(ef.LoadingOutlined,{spin:!0}),size:"small"}),(0,t.jsx)("span",{children:"Updating..."})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"text-xs text-gray-500 block",children:"Total/Request"}),(0,t.jsx)(a.Text,{className:"text-base font-semibold text-blue-600",children:eP(e.cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"text-xs text-gray-500 block",children:"Input Cost"}),(0,t.jsx)(a.Text,{className:"text-sm",children:eP(e.input_cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"text-xs text-gray-500 block",children:"Output Cost"}),(0,t.jsx)(a.Text,{className:"text-sm",children:eP(e.output_cost_per_request)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"text-xs text-gray-500 block",children:"Margin Fee"}),(0,t.jsx)(a.Text,{className:`text-sm ${e.margin_cost_per_request>0?"text-amber-600":""}`,children:eP(e.margin_cost_per_request)})]})]}),null!==n&&(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4 pt-2 border-t border-gray-200",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.Text,{className:"text-xs text-gray-500 block",children:[l," Total (",null==c?"-":(0,ej.formatNumberWithCommas)(c,0,!0)," req)"]}),(0,t.jsx)(a.Text,{className:`text-base font-semibold ${"day"===r?"text-green-600":"text-purple-600"}`,children:eP(n)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.Text,{className:"text-xs text-gray-500 block",children:[l," Input"]}),(0,t.jsx)(a.Text,{className:"text-sm",children:eP(o)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.Text,{className:"text-xs text-gray-500 block",children:[l," Output"]}),(0,t.jsx)(a.Text,{className:"text-sm",children:eP(i)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(a.Text,{className:"text-xs text-gray-500 block",children:[l," Margin Fee"]}),(0,t.jsx)(a.Text,{className:`text-sm ${(d??0)>0?"text-amber-600":""}`,children:eP(d)})]})]}),(e.input_cost_per_token||e.output_cost_per_token)&&(0,t.jsxs)("div",{className:"text-xs text-gray-400 pt-2 border-t border-gray-200",children:["Token Pricing:"," ",e.input_cost_per_token&&(0,t.jsxs)("span",{children:["Input $",(0,ej.formatNumberWithCommas)(1e6*e.input_cost_per_token,2),"/1M"]}),e.input_cost_per_token&&e.output_cost_per_token&&" | ",e.output_cost_per_token&&(0,t.jsxs)("span",{children:["Output $",(0,ej.formatNumberWithCommas)(1e6*e.output_cost_per_token,2),"/1M"]})]})]})},eq=({multiResult:e,timePeriod:r})=>{let[n,o]=(0,s.useState)(new Set),i=e.entries.filter(e=>null!==e.result),d=e.entries.filter(e=>e.loading),c=e.entries.filter(e=>null!==e.error),m=i.length>0,u=d.length>0,x=c.length>0;if(!m&&!u&&!x)return(0,t.jsx)("div",{className:"py-6 text-center border border-dashed border-gray-300 rounded-lg bg-gray-50",children:(0,t.jsx)(a.Text,{className:"text-gray-500",children:"Select models above to see cost estimates"})});if(!m&&u&&!x)return(0,t.jsxs)("div",{className:"py-6 text-center",children:[(0,t.jsx)(eg.Spin,{indicator:(0,t.jsx)(ef.LoadingOutlined,{spin:!0})}),(0,t.jsx)(a.Text,{className:"text-gray-500 block mt-2",children:"Calculating costs..."})]});if(!m&&x)return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(ep.Divider,{className:"my-4"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(a.Text,{className:"text-base font-semibold text-gray-900",children:"Cost Estimates"}),u&&(0,t.jsx)(eg.Spin,{indicator:(0,t.jsx)(ef.LoadingOutlined,{spin:!0}),size:"small"})]}),c.map(e=>(0,t.jsxs)("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-lg border border-red-200",children:[(0,t.jsxs)("span",{className:"font-medium",children:[e.entry.model||"Unknown model",": "]}),e.error]},e.entry.id))]});let p=e.totals.margin_per_request>0,g="day"===r?"Daily":"Monthly",h=[{title:"Model",dataIndex:"model",key:"model",render:(e,s)=>(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e}),s.provider&&(0,t.jsx)(eh.Tag,{color:"blue",className:"text-xs",children:s.provider}),s.loading&&(0,t.jsx)(eg.Spin,{indicator:(0,t.jsx)(ef.LoadingOutlined,{spin:!0}),size:"small"})]}),s.error&&(0,t.jsxs)("div",{className:"text-xs text-red-600 bg-red-50 px-2 py-1 rounded-sm",children:["⚠️ ",s.error]}),s.hasZeroCost&&!s.error&&(0,t.jsx)("div",{className:"text-xs text-amber-600 bg-amber-50 px-2 py-1 rounded-sm",children:"⚠️ No pricing data found for this model. Set base_model in config."})]})},{title:"Per Request",dataIndex:"cost_per_request",key:"cost_per_request",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:"font-mono text-sm",children:eP(e)})},{title:"Margin Fee",dataIndex:"margin_cost_per_request",key:"margin_cost_per_request",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:`font-mono text-sm ${(e??0)>0?"text-amber-600":"text-gray-400"}`,children:eP(e)})},{title:g,dataIndex:"day"===r?"daily_cost":"monthly_cost",key:"period_cost",align:"right",render:(e,s)=>s.error?(0,t.jsx)("span",{className:"text-gray-400",children:"-"}):(0,t.jsx)("span",{className:"font-mono text-sm",children:eP(e)})},{title:"",key:"expand",width:40,render:(e,s)=>s.error?null:(0,t.jsx)(l.Button,{size:"xs",variant:"light",onClick:()=>{var e;return e=s.id,void o(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},className:"text-gray-400 hover:text-gray-600",children:n.has(s.id)?(0,t.jsx)(ey.DownOutlined,{}):(0,t.jsx)(ev.RightOutlined,{})})}],f=e.entries.filter(e=>e.entry.model).map(e=>({key:e.entry.id,id:e.entry.id,model:e.result?.model||e.entry.model,provider:e.result?.provider,cost_per_request:e.result?.cost_per_request??null,margin_cost_per_request:e.result?.margin_cost_per_request??null,daily_cost:e.result?.daily_cost??null,monthly_cost:e.result?.monthly_cost??null,error:e.error,loading:e.loading,hasZeroCost:e.result&&0===e.result.cost_per_request}));return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(ep.Divider,{className:"my-4"}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(a.Text,{className:"text-base font-semibold text-gray-900",children:"Cost Estimates"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[u&&(0,t.jsx)(eg.Spin,{indicator:(0,t.jsx)(ef.LoadingOutlined,{spin:!0}),size:"small"}),(0,t.jsx)(e$,{multiResult:e})]})]}),(0,t.jsxs)(W.Card,{size:"small",className:"bg-linear-to-r from-slate-50 to-blue-50 border-slate-200",children:[(0,t.jsxs)(eu.Row,{gutter:[16,8],children:[(0,t.jsx)(ex.Col,{xs:24,sm:12,children:(0,t.jsx)(eo,{title:(0,t.jsx)("span",{className:"text-xs",children:"Total Per Request"}),value:eP(e.totals.cost_per_request),valueStyle:{color:"#1890ff",fontSize:"18px",fontFamily:"monospace"}})}),(0,t.jsx)(ex.Col,{xs:24,sm:12,children:(0,t.jsx)(eo,{title:(0,t.jsxs)("span",{className:"text-xs",children:["Total ",g]}),value:eP("day"===r?e.totals.daily_cost:e.totals.monthly_cost),valueStyle:{color:"day"===r?"#52c41a":"#722ed1",fontSize:"18px",fontFamily:"monospace"}})})]}),p&&(0,t.jsxs)(eu.Row,{gutter:[16,8],className:"mt-3 pt-3 border-t border-slate-200",children:[(0,t.jsxs)(ex.Col,{xs:24,sm:12,children:[(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Margin Fee/Request"}),(0,t.jsx)("div",{className:"text-sm font-mono text-amber-600",children:eP(e.totals.margin_per_request)})]}),(0,t.jsxs)(ex.Col,{xs:24,sm:12,children:[(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[g," Margin Fee"]}),(0,t.jsx)("div",{className:"text-sm font-mono text-amber-600",children:eP("day"===r?e.totals.daily_margin:e.totals.monthly_margin)})]})]})]}),f.length>0&&(0,t.jsx)(z.Table,{columns:h,dataSource:f,pagination:!1,size:"small",className:"border border-gray-200 rounded-lg",expandable:{expandedRowKeys:Array.from(n),expandedRowRender:e=>{let s=i.find(t=>t.entry.id===e.id);return s?.result?(0,t.jsx)("div",{className:"py-2",children:(0,t.jsx)(eM,{result:s.result,loading:s.loading,timePeriod:r})}):null},showExpandColumn:!1}})]})};var eO=e.i(602869);let eE=()=>({id:`entry-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,model:"",input_tokens:1e3,output_tokens:500,num_requests_per_day:void 0,num_requests_per_month:void 0}),eF=({accessToken:e,models:r})=>{let[a,l]=(0,s.useState)([eE()]),[n,o]=(0,s.useState)("month"),{debouncedFetchForEntry:i,removeEntry:d,getMultiModelResult:c}=function(e){let[t,r]=(0,s.useState)(new Map),a=(0,s.useRef)(new Map),l=(0,s.useCallback)(async t=>{if(!e||!t.model)return void r(e=>{let s=new Map(e);return s.set(t.id,{entry:t,result:null,loading:!1,error:null}),s});r(e=>{let s=new Map(e),r=s.get(t.id);return s.set(t.id,{entry:t,result:r?.result??null,loading:!0,error:null}),s});try{let s=(0,eO.getProxyBaseUrl)(),a=s?`${s}/cost/estimate`:"/cost/estimate",l={model:t.model,input_tokens:t.input_tokens||0,output_tokens:t.output_tokens||0,num_requests_per_day:t.num_requests_per_day||null,num_requests_per_month:t.num_requests_per_month||null},n=await fetch(a,{method:"POST",headers:{[(0,eO.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(l)});if(n.ok){let e=await n.json();r(s=>{let r=new Map(s);return r.set(t.id,{entry:t,result:e,loading:!1,error:null}),r})}else{let e=await n.json(),s=e.detail?.error||e.detail||"Failed to estimate cost";r(e=>{let r=new Map(e);return r.set(t.id,{entry:t,result:null,loading:!1,error:s}),r})}}catch(e){console.error("Error estimating cost:",e),r(e=>{let s=new Map(e);return s.set(t.id,{entry:t,result:null,loading:!1,error:"Network error"}),s})}},[e]),n=(0,s.useCallback)(e=>{let t=a.current.get(e.id);t&&clearTimeout(t);let s=setTimeout(()=>{l(e)},500);a.current.set(e.id,s)},[l]),o=(0,s.useCallback)(e=>{let t=a.current.get(e);t&&(clearTimeout(t),a.current.delete(e)),r(t=>{let s=new Map(t);return s.delete(e),s})},[]);return(0,s.useEffect)(()=>{let e=a.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]),{debouncedFetchForEntry:n,removeEntry:o,getMultiModelResult:(0,s.useCallback)(e=>{let s=e.map(e=>{let s=t.get(e.id);return{entry:e,result:s?.result??null,loading:s?.loading??!1,error:s?.error??null}}),r=0,a=null,l=null,n=0,o=null,i=null;for(let e of s)e.result&&(r+=e.result.cost_per_request,n+=e.result.margin_cost_per_request,null!==e.result.daily_cost&&(a=(a??0)+e.result.daily_cost),null!==e.result.daily_margin_cost&&(o=(o??0)+e.result.daily_margin_cost),null!==e.result.monthly_cost&&(l=(l??0)+e.result.monthly_cost),null!==e.result.monthly_margin_cost&&(i=(i??0)+e.result.monthly_margin_cost));return{entries:s,totals:{cost_per_request:r,daily_cost:a,monthly_cost:l,margin_per_request:n,daily_margin:o,monthly_margin:i}}},[t])}}(e),m=(0,s.useCallback)((e,t,s)=>{l(r=>{let a=r.map(r=>r.id===e?{...r,[t]:s}:r),l=a.find(t=>t.id===e);return l&&l.model&&i(l),a})},[i]),u=(0,s.useCallback)(e=>{o(e),l(t=>t.map(t=>({...t,num_requests_per_day:"day"===e?t.num_requests_per_day:void 0,num_requests_per_month:"month"===e?t.num_requests_per_month:void 0})))},[]),x=(0,s.useCallback)(()=>{l(e=>[...e,eE()])},[]),p=(0,s.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e)),d(e)},[d]),g=c(a),h=[{title:"Model",dataIndex:"model",key:"model",width:"35%",render:(e,s)=>(0,t.jsx)(F.Select,{showSearch:!0,placeholder:"Select a model",value:s.model||void 0,onChange:e=>m(s.id,"model",e),optionFilterProp:"label",filterOption:(e,t)=>String(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:r.map(e=>({value:e,label:e})),style:{width:"100%"},size:"small"})},{title:"Input Tokens",dataIndex:"input_tokens",key:"input_tokens",width:"18%",render:(e,s)=>(0,t.jsx)(H.InputNumber,{min:0,value:s.input_tokens,onChange:e=>m(s.id,"input_tokens",e??0),style:{width:"100%"},size:"small",formatter:e=>`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")})},{title:"Output Tokens",dataIndex:"output_tokens",key:"output_tokens",width:"18%",render:(e,s)=>(0,t.jsx)(H.InputNumber,{min:0,value:s.output_tokens,onChange:e=>m(s.id,"output_tokens",e??0),style:{width:"100%"},size:"small",formatter:e=>`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")})},{title:`Requests/${"day"===n?"Day":"Month"}`,dataIndex:"day"===n?"num_requests_per_day":"num_requests_per_month",key:"num_requests",width:"20%",render:(e,s)=>(0,t.jsx)(H.InputNumber,{min:0,value:"day"===n?s.num_requests_per_day:s.num_requests_per_month,onChange:e=>m(s.id,"day"===n?"num_requests_per_day":"num_requests_per_month",e??void 0),style:{width:"100%"},size:"small",placeholder:"-",formatter:e=>e?`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,","):""})},{title:"",key:"actions",width:50,render:(e,s)=>(0,t.jsx)(G.Button,{type:"text",icon:(0,t.jsx)(V.DeleteOutlined,{}),onClick:()=>p(s.id),disabled:1===a.length,danger:!0,size:"small"})}];return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,t.jsxs)(A.Radio.Group,{value:n,onChange:e=>u(e.target.value),size:"small",optionType:"button",buttonStyle:"solid",children:[(0,t.jsx)(A.Radio.Button,{value:"day",children:"Per Day"}),(0,t.jsx)(A.Radio.Button,{value:"month",children:"Per Month"})]})}),(0,t.jsx)(z.Table,{columns:h,dataSource:a,rowKey:"id",pagination:!1,size:"small",footer:()=>(0,t.jsx)(G.Button,{type:"dashed",onClick:x,icon:(0,t.jsx)(U.PlusOutlined,{}),className:"w-full",children:"Add Another Model"})}),(0,t.jsx)(eq,{multiResult:g,timePeriod:n})]})};var eR=e.i(270377),eL=e.i(778917),eI=e.i(664659);let eD=({items:e,children:r="Docs",className:a=""})=>{let[l,n]=(0,s.useState)(!1),o=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&n(!1)};return l&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l]),(0,t.jsxs)("div",{className:`relative inline-block ${a}`,ref:o,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(!l),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm px-2 py-1","aria-expanded":l,"aria-haspopup":"true",children:[(0,t.jsx)("span",{children:r}),(0,t.jsx)(eI.ChevronDown,{className:`h-3 w-3 transition-transform ${l?"rotate-180":""}`,"aria-hidden":"true"})]}),l&&(0,t.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:e.map((e,s)=>(0,t.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>n(!1),children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)(eL.ExternalLink,{className:"h-3.5 w-3.5 text-gray-400 shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var eA=e.i(466828);let eB=()=>{let[e,r]=(0,s.useState)(""),[l,n]=(0,s.useState)(""),o=(0,s.useMemo)(()=>{let t=parseFloat(e),s=parseFloat(l);if(isNaN(t)||isNaN(s)||0===t||0===s)return null;let r=t+s,a=s/r*100;return{originalCost:r.toFixed(10),finalCost:t.toFixed(10),discountAmount:s.toFixed(10),discountPercentage:a.toFixed(2)}},[e,l]);return(0,t.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,t.jsxs)(a.Text,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs:"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded-sm text-xs",children:"final_cost = base_cost × (1 - discount%/100)"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 × (1 - 0.05) = $9.50"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,t.jsx)(eA.default,{language:"bash",code:`curl -X POST -i http://your-proxy:4000/chat/completions \\
- -H "Content-Type: application/json" \\
- -H "Authorization: Bearer sk-1234" \\
- -d '{
- "model": "gemini/gemini-2.5-pro",
- "messages": [{"role": "user", "content": "Hello"}]
- }'`}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded-sm text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded-sm text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded-sm text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,t.jsx)(a.Text,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,t.jsx)(a.Text,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,t.jsx)(h.TextInput,{placeholder:"0.0171938125",value:e,onValueChange:r,className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,t.jsx)(h.TextInput,{placeholder:"0.0009049375",value:l,onValueChange:n,className:"text-sm"})]})]}),o&&(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,t.jsx)(a.Text,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(a.Text,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",o.originalCost]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(a.Text,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",o.finalCost]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(a.Text,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,t.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",o.discountAmount]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,t.jsx)(a.Text,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,t.jsxs)(a.Text,{className:"text-sm font-bold text-blue-900",children:[o.discountPercentage,"%"]})]})]})]})]})]})};var ez=e.i(727749),eH=e.i(695411);let eG=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}],eV=({userID:e,userRole:h,accessToken:f})=>{let[y,v]=(0,s.useState)(void 0),[j,b]=(0,s.useState)(""),[_,N]=(0,s.useState)(!0),[w,k]=(0,s.useState)(!1),[C,T]=(0,s.useState)(!1),[S,P]=(0,s.useState)(void 0),[M,O]=(0,s.useState)("percentage"),[F,R]=(0,s.useState)(""),[L,A]=(0,s.useState)(""),[z,H]=(0,s.useState)([]),[G]=g.Form.useForm(),[V]=g.Form.useForm(),[U,W]=p.Modal.useModal(),K="proxy_admin"===h||"Admin"===h,{discountConfig:J,fetchDiscountConfig:X,handleAddProvider:Y,handleRemoveProvider:Z,handleDiscountChange:Q}=function({accessToken:e}){let[t,r]=(0,s.useState)({}),a=(0,s.useCallback)(async()=>{try{let t=(0,eO.getProxyBaseUrl)(),s=t?`${t}/config/cost_discount_config`:"/config/cost_discount_config",a=await fetch(s,{method:"GET",headers:{[(0,eO.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(a.ok){let e=await a.json();r(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),ez.default.fromBackend("Failed to fetch discount configuration")}},[e]),l=(0,s.useCallback)(async t=>{try{let s=(0,eO.getProxyBaseUrl)(),r=s?`${s}/config/cost_discount_config`:"/config/cost_discount_config",l=await fetch(r,{method:"PATCH",headers:{[(0,eO.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(l.ok)ez.default.success("Discount configuration updated successfully"),await a();else{let e=await l.json(),t=e.detail?.error||e.detail||"Failed to update settings";ez.default.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),ez.default.fromBackend("Failed to update discount configuration")}},[e,a]),n=(0,s.useCallback)(async(e,s)=>{if(!e||!s)return ez.default.fromBackend("Please select a provider and enter discount percentage"),!1;let a=parseFloat(s);if(isNaN(a)||a<0||a>100)return ez.default.fromBackend("Discount must be between 0% and 100%"),!1;let n=q(e);if(!n)return ez.default.fromBackend("Invalid provider selected"),!1;if(t[n])return ez.default.fromBackend(`Discount for ${$.Providers[e]} already exists. Edit it in the table above.`),!1;let o={...t,[n]:a/100};return r(o),await l(o),!0},[t,l]),o=(0,s.useCallback)(async e=>{let s={...t};delete s[e],r(s),await l(s)},[t,l]),i=(0,s.useCallback)(async(e,s)=>{let a=parseFloat(s);if(!isNaN(a)&&a>=0&&a<=1){let s={...t,[e]:a};r(s),await l(s)}},[t,l]);return{discountConfig:t,setDiscountConfig:r,fetchDiscountConfig:a,saveDiscountConfig:l,handleAddProvider:n,handleRemoveProvider:o,handleDiscountChange:i}}({accessToken:f}),{marginConfig:ee,fetchMarginConfig:et,handleAddMargin:es,handleRemoveMargin:er,handleMarginChange:ea}=function({accessToken:e}){let[t,r]=(0,s.useState)({}),a=(0,s.useCallback)(async()=>{try{let t=(0,eO.getProxyBaseUrl)(),s=t?`${t}/config/cost_margin_config`:"/config/cost_margin_config",a=await fetch(s,{method:"GET",headers:{[(0,eO.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"}});if(a.ok){let e=await a.json();r(e.values||{})}else console.error("Failed to fetch margin config")}catch(e){console.error("Error fetching margin config:",e),ez.default.fromBackend("Failed to fetch margin configuration")}},[e]),l=(0,s.useCallback)(async t=>{try{let s=(0,eO.getProxyBaseUrl)(),r=s?`${s}/config/cost_margin_config`:"/config/cost_margin_config",l=await fetch(r,{method:"PATCH",headers:{[(0,eO.getGlobalLitellmHeaderName)()]:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(t)});if(l.ok)ez.default.success("Margin configuration updated successfully"),await a();else{let e=await l.json(),t=e.detail?.error||e.detail||"Failed to update settings";ez.default.fromBackend(t)}}catch(e){console.error("Error updating margin config:",e),ez.default.fromBackend("Failed to update margin configuration")}},[e,a]),n=(0,s.useCallback)(async e=>{let s,a,{selectedProvider:n,marginType:o,percentageValue:i,fixedAmountValue:d}=e;if(!n)return ez.default.fromBackend("Please select a provider"),!1;if("global"===n)s="global";else{let e=q(n);if(!e)return ez.default.fromBackend("Invalid provider selected"),!1;s=e}if(t[s]){let e="global"===s?"Global":$.Providers[n];return ez.default.fromBackend(`Margin for ${e} already exists. Edit it in the table above.`),!1}if("percentage"===o){let e=parseFloat(i);if(isNaN(e)||e<0||e>1e3)return ez.default.fromBackend("Percentage must be between 0% and 1000%"),!1;a=e/100}else{let e=parseFloat(d);if(isNaN(e)||e<0)return ez.default.fromBackend("Fixed amount must be non-negative"),!1;a={fixed_amount:e}}let c={...t,[s]:a};return r(c),await l(c),!0},[t,l]),o=(0,s.useCallback)(async e=>{let s={...t};delete s[e],r(s),await l(s)},[t,l]),i=(0,s.useCallback)(async(e,s)=>{let a={...t,[e]:s};r(a),await l(a)},[t,l]);return{marginConfig:t,setMarginConfig:r,fetchMarginConfig:a,saveMarginConfig:l,handleAddMargin:n,handleRemoveMargin:o,handleMarginChange:i}}({accessToken:f});(0,s.useEffect)(()=>{f&&(Promise.all([X(),et()]).finally(()=>{N(!1)}),(async()=>{try{let e=await (0,eH.fetchAvailableModels)(f);H(e.map(e=>e.model_group))}catch(e){console.error("Error fetching models:",e)}})())},[f,X,et]);let el=async()=>{await Y(y,j)&&(v(void 0),b(""),k(!1))},en=async(e,s)=>{U.confirm({title:"Remove Provider Discount",icon:(0,t.jsx)(eR.ExclamationCircleOutlined,{}),content:`Are you sure you want to remove the discount for ${s}?`,okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:()=>Z(e)})},eo=async()=>{await es({selectedProvider:S,marginType:M,percentageValue:F,fixedAmountValue:L})&&(P(void 0),R(""),A(""),O("percentage"),T(!1))},ei=async(e,s)=>{U.confirm({title:"Remove Provider Margin",icon:(0,t.jsx)(eR.ExclamationCircleOutlined,{}),content:`Are you sure you want to remove the margin for ${s}?`,okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:()=>er(e)})};return f?(0,t.jsxs)("div",{className:"w-full p-8",children:[W,(0,t.jsx)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Title,{children:"Cost Tracking Settings"}),(0,t.jsx)(eD,{items:eG})]}),(0,t.jsx)(a.Text,{className:"text-gray-500 mt-1",children:"Configure cost discounts and margins for different LLM providers. Changes are saved automatically."})]})}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm w-full max-w-full space-y-4",children:[K&&(0,t.jsxs)(n.Accordion,{children:[(0,t.jsx)(o.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(a.Text,{className:"text-lg font-semibold text-gray-900",children:"Provider Discounts"}),(0,t.jsx)(a.Text,{className:"text-sm text-gray-500 mt-1",children:"Apply percentage-based discounts to reduce costs for specific providers"})]})}),(0,t.jsx)(i.AccordionBody,{className:"px-0",children:(0,t.jsxs)(d.TabGroup,{children:[(0,t.jsxs)(c.TabList,{className:"px-6 pt-4",children:[(0,t.jsx)(m.Tab,{children:"Discounts"}),(0,t.jsx)(m.Tab,{children:"Test It"})]}),(0,t.jsxs)(u.TabPanels,{children:[(0,t.jsx)(x.TabPanel,{children:(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(l.Button,{onClick:()=>k(!0),children:"+ Add Provider Discount"})}),_?(0,t.jsx)("div",{className:"py-12 text-center",children:(0,t.jsx)(a.Text,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(J).length>0?(0,t.jsx)(E,{discountConfig:J,onDiscountChange:Q,onRemoveProvider:en}):(0,t.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)(a.Text,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})]})}),(0,t.jsx)(x.TabPanel,{children:(0,t.jsx)("div",{className:"px-6 pb-4",children:(0,t.jsx)(eB,{})})})]})]})})]}),K&&(0,t.jsxs)(n.Accordion,{children:[(0,t.jsx)(o.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(a.Text,{className:"text-lg font-semibold text-gray-900",children:"Fee/Price Margin"}),(0,t.jsx)(a.Text,{className:"text-sm text-gray-500 mt-1",children:"Add fees or margins to LLM costs for internal billing and cost recovery"})]})}),(0,t.jsx)(i.AccordionBody,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6",children:[(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(l.Button,{onClick:()=>T(!0),children:"+ Add Provider Margin"})}),_?(0,t.jsx)("div",{className:"py-12 text-center",children:(0,t.jsx)(a.Text,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(ee).length>0?(0,t.jsx)(D,{marginConfig:ee,onMarginChange:ea,onRemoveProvider:ei}):(0,t.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)(a.Text,{className:"text-gray-700 font-medium mb-2",children:"No provider margins configured"}),(0,t.jsx)(a.Text,{className:"text-gray-500 text-sm",children:'Click "Add Provider Margin" to get started'})]})]})})]}),(0,t.jsxs)(n.Accordion,{defaultOpen:!0,children:[(0,t.jsx)(o.AccordionHeader,{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,t.jsx)(a.Text,{className:"text-lg font-semibold text-gray-900",children:"Pricing Calculator"}),(0,t.jsx)(a.Text,{className:"text-sm text-gray-500 mt-1",children:"Estimate LLM costs based on expected token usage and request volume"})]})}),(0,t.jsx)(i.AccordionBody,{className:"px-0",children:(0,t.jsx)("div",{className:"p-6",children:(0,t.jsx)(eF,{accessToken:f,models:z})})})]})]}),(0,t.jsx)(p.Modal,{title:(0,t.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:w,width:1e3,onCancel:()=>{k(!1),G.resetFields(),v(void 0),b("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(a.Text,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,t.jsx)(g.Form,{form:G,onFinish:()=>{el()},layout:"vertical",className:"space-y-6",children:(0,t.jsx)(I,{discountConfig:J,selectedProvider:y,newDiscount:j,onProviderChange:v,onDiscountChange:b,onAddProvider:el})})]})}),(0,t.jsx)(p.Modal,{title:(0,t.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Margin"})}),open:C,width:1e3,onCancel:()=>{T(!1),V.resetFields(),P(void 0),R(""),A(""),O("percentage")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(a.Text,{className:"text-sm text-gray-600 mb-6",children:'Select a provider (or "Global" for all providers) and configure the margin. You can use percentage-based or fixed amount.'}),(0,t.jsx)(g.Form,{form:V,layout:"vertical",className:"space-y-6",children:(0,t.jsx)(B,{marginConfig:ee,selectedProvider:S,marginType:M,percentageValue:F,fixedAmountValue:L,onProviderChange:P,onMarginTypeChange:O,onPercentageChange:R,onFixedAmountChange:A,onAddProvider:eo})})]})})]}):null};var eU=e.i(135214);e.s(["default",0,function(){let{accessToken:e,userRole:s,userId:r}=(0,eU.default)();return(0,t.jsx)(eV,{userID:r,userRole:s,accessToken:e})}],193317)}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/068p6o.s_qzmk.js b/litellm/proxy/_experimental/out/_next/static/chunks/068p6o.s_qzmk.js
deleted file mode 100644
index 3af24ecefd2..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/068p6o.s_qzmk.js
+++ /dev/null
@@ -1,35 +0,0 @@
-(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95779,e=>{"use strict";var t=e.i(480731);let r=[t.BaseColors.Blue,t.BaseColors.Cyan,t.BaseColors.Sky,t.BaseColors.Indigo,t.BaseColors.Violet,t.BaseColors.Purple,t.BaseColors.Fuchsia,t.BaseColors.Slate,t.BaseColors.Gray,t.BaseColors.Zinc,t.BaseColors.Neutral,t.BaseColors.Stone,t.BaseColors.Red,t.BaseColors.Orange,t.BaseColors.Amber,t.BaseColors.Yellow,t.BaseColors.Lime,t.BaseColors.Green,t.BaseColors.Emerald,t.BaseColors.Teal,t.BaseColors.Pink,t.BaseColors.Rose];e.s(["colorPalette",0,{canvasBackground:50,lightBackground:100,background:500,darkBackground:600,darkestBackground:800,lightBorder:200,border:500,darkBorder:700,lightRing:200,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700,darkestText:900,icon:500},"themeColorRange",0,r])},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),o=e.i(444755),s=e.i(673706),l=e.i(271645);let a=l.default.forwardRef((e,a)=>{let{color:i,children:n,className:d}=e,c=(0,t.__rest)(e,["color","children","className"]);return l.default.createElement("p",Object.assign({ref:a,className:(0,o.tremorTwMerge)("font-medium text-tremor-title",i?(0,s.getColorClassNames)(i,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),n)});a.displayName="Title",e.s(["Title",0,a],629569)},166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},411929,e=>{"use strict";var t=e.i(843476),r=e.i(271645),o=e.i(464571),s=e.i(166406),l=e.i(629569),a=e.i(602869),i=e.i(727749);let n=({accessToken:e})=>{let[n,d]=(0,r.useState)(`{
- "model": "openai/gpt-4o",
- "messages": [
- {
- "role": "system",
- "content": "You are a helpful assistant."
- },
- {
- "role": "user",
- "content": "Explain quantum computing in simple terms"
- }
- ],
- "temperature": 0.7,
- "max_tokens": 500,
- "stream": true
-}`),[c,u]=(0,r.useState)(""),[p,x]=(0,r.useState)(!1),m=async()=>{x(!0);try{let s;try{s=JSON.parse(n)}catch(e){i.default.fromBackend("Invalid JSON in request body"),x(!1);return}let l={call_type:"completion",request_body:s};if(!e){i.default.fromBackend("No access token found"),x(!1);return}let d=await (0,a.transformRequestCall)(e,l);if(d.raw_request_api_base&&d.raw_request_body){var t,r,o;let e,s,l=(t=d.raw_request_api_base,r=d.raw_request_body,o=d.raw_request_headers||{},e=JSON.stringify(r,null,2).split("\n").map(e=>` ${e}`).join("\n"),s=Object.entries(o).map(([e,t])=>`-H '${e}: ${t}'`).join(" \\\n "),`curl -X POST \\
- ${t} \\
- ${s?`${s} \\
- `:""}-H 'Content-Type: application/json' \\
- -d '{
-${e}
- }'`);u(l),i.default.success("Request transformed successfully")}else{let e="string"==typeof d?d:JSON.stringify(d);u(e),i.default.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),i.default.fromBackend("Failed to transform request")}finally{x(!1)}};return(0,t.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,t.jsx)(l.Title,{children:"Playground"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,t.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,t.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,t.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,t.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,t.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,t.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:n,onChange:e=>d(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),m())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,t.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,t.jsxs)(o.Button,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:m,loading:p,children:[(0,t.jsx)("span",{children:"Transform"}),(0,t.jsx)("span",{children:"→"})]})})]}),(0,t.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,t.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,t.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,t.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,t.jsx)("br",{}),(0,t.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,t.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,t.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:c||`curl -X POST \\
- https://api.openai.com/v1/chat/completions \\
- -H 'Authorization: Bearer sk-xxx' \\
- -H 'Content-Type: application/json' \\
- -d '{
- "model": "gpt-4",
- "messages": [
- {
- "role": "system",
- "content": "You are a helpful assistant."
- }
- ],
- "temperature": 0.7
- }'`}),(0,t.jsx)(o.Button,{type:"text",icon:(0,t.jsx)(s.CopyOutlined,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(c||""),i.default.success("Copied to clipboard")}})]})]})]}),(0,t.jsx)("div",{className:"mt-4 text-right w-full",children:(0,t.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,t.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})};var d=e.i(135214);e.s(["default",0,function(){let{accessToken:e}=(0,d.default)();return(0,t.jsx)(n,{accessToken:e})}],411929)}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/069dx5~5osue0.js b/litellm/proxy/_experimental/out/_next/static/chunks/069dx5~5osue0.js
deleted file mode 100644
index 29d4e7549f5..00000000000
--- a/litellm/proxy/_experimental/out/_next/static/chunks/069dx5~5osue0.js
+++ /dev/null
@@ -1 +0,0 @@
-(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,166406,e=>{"use strict";var t=e.i(190144);e.s(["CopyOutlined",()=>t.default])},447566,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};var a=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(a.default,(0,t.default)({},e,{ref:o,icon:s}))});e.s(["ArrowLeftOutlined",0,o],447566)},389083,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(829087),a=e.i(480731),o=e.i(95779),l=e.i(444755),i=e.i(673706);let n={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},c={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},d=(0,i.makeClassName)("Badge"),m=r.default.forwardRef((e,m)=>{let{color:u,icon:g,size:h=a.Sizes.SM,tooltip:p,className:f,children:x}=e,b=(0,t.__rest)(e,["color","icon","size","tooltip","className","children"]),v=g||null,{tooltipProps:w,getReferenceProps:N}=(0,s.useTooltip)();return r.default.createElement("span",Object.assign({ref:(0,i.mergeRefs)([m,w.refs.setReference]),className:(0,l.tremorTwMerge)(d("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",u?(0,l.tremorTwMerge)((0,i.getColorClassNames)(u,o.colorPalette.background).bgColor,(0,i.getColorClassNames)(u,o.colorPalette.iconText).textColor,(0,i.getColorClassNames)(u,o.colorPalette.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,l.tremorTwMerge)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),n[h].paddingX,n[h].paddingY,n[h].fontSize,f)},N,b),r.default.createElement(s.default,Object.assign({text:p},w)),v?r.default.createElement(v,{className:(0,l.tremorTwMerge)(d("icon"),"shrink-0 -ml-1 mr-1.5",c[h].height,c[h].width)}):null,r.default.createElement("span",{className:(0,l.tremorTwMerge)(d("text"),"whitespace-nowrap")},x))});m.displayName="Badge",e.s(["Badge",0,m],389083)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("Table"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,s.tremorTwMerge)(a("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},n),l))});o.displayName="Table",e.s(["Table",0,o],269200)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("TableHead"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},n),l))});o.displayName="TableHead",e.s(["TableHead",0,o],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("TableHeaderCell"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},n),l))});o.displayName="TableHeaderCell",e.s(["TableHeaderCell",0,o],64848)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("TableBody"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},n),l))});o.displayName="TableBody",e.s(["TableBody",0,o],942232)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("TableRow"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("row"),i)},n),l))});o.displayName="TableRow",e.s(["TableRow",0,o],496020)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(444755);let a=(0,e.i(673706).makeClassName)("TableCell"),o=r.default.forwardRef((e,o)=>{let{children:l,className:i}=e,n=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:o,className:(0,s.tremorTwMerge)(a("root"),"align-middle whitespace-nowrap text-left p-4",i)},n),l))});o.displayName="TableCell",e.s(["TableCell",0,o],977572)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},278587,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))});e.s(["RefreshIcon",0,r],278587)},871943,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,r],871943)},502547,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.s(["ChevronRightIcon",0,r],502547)},637235,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"};var a=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(a.default,(0,t.default)({},e,{ref:o,icon:s}))});e.s(["ClockCircleOutlined",0,o],637235)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),s=e.i(444755),a=e.i(673706),o=e.i(271645);let l=o.default.forwardRef((e,l)=>{let{color:i,children:n,className:c}=e,d=(0,t.__rest)(e,["color","children","className"]);return o.default.createElement("p",Object.assign({ref:l,className:(0,s.tremorTwMerge)("font-medium text-tremor-title",i?(0,a.getColorClassNames)(i,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",c)},d),n)});l.displayName="Title",e.s(["Title",0,l],629569)},95779,e=>{"use strict";var t=e.i(480731);let r=[t.BaseColors.Blue,t.BaseColors.Cyan,t.BaseColors.Sky,t.BaseColors.Indigo,t.BaseColors.Violet,t.BaseColors.Purple,t.BaseColors.Fuchsia,t.BaseColors.Slate,t.BaseColors.Gray,t.BaseColors.Zinc,t.BaseColors.Neutral,t.BaseColors.Stone,t.BaseColors.Red,t.BaseColors.Orange,t.BaseColors.Amber,t.BaseColors.Yellow,t.BaseColors.Lime,t.BaseColors.Green,t.BaseColors.Emerald,t.BaseColors.Teal,t.BaseColors.Pink,t.BaseColors.Rose];e.s(["colorPalette",0,{canvasBackground:50,lightBackground:100,background:500,darkBackground:600,darkestBackground:800,lightBorder:200,border:500,darkBorder:700,lightRing:200,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700,darkestText:900,icon:500},"themeColorRange",0,r])},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),s=e.i(673706),a=e.i(271645);let o=a.default.forwardRef((e,o)=>{let{color:l,className:i,children:n}=e;return a.default.createElement("p",{ref:o,className:(0,r.tremorTwMerge)("text-tremor-default",l?(0,s.getColorClassNames)(l,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},n)});o.displayName="Text",e.s(["default",0,o],936325),e.s(["Text",0,o],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),s=e.i(271645);let a=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],o=e=>({_s:e,status:a[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),l=e=>e?6:5,i=(e,t,r,s,a)=>{clearTimeout(s.current);let l=o(e);t(l),r.current=l,a&&a({current:l})};var n=e.i(480731),c=e.i(444755),d=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return s.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),s.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),s.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var u=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},h=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,d.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,d.getColorClassNames)(t,u.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,d.getColorClassNames)(t,u.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,d.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,d.getColorClassNames)(t,u.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,d.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,u.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,c.tremorTwMerge)((0,d.getColorClassNames)(t,u.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,d.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,d.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,d.getColorClassNames)(t,u.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,d.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,d.makeClassName)("Button"),f=({loading:e,iconSize:t,iconPosition:r,Icon:a,needMargin:o,transitionStatus:l})=>{let i=o?r===n.HorizontalPositions.Left?(0,c.tremorTwMerge)("-ml-1","mr-1.5"):(0,c.tremorTwMerge)("-mr-1","ml-1.5"):"",d=(0,c.tremorTwMerge)("w-0 h-0"),u={default:d,entering:d,entered:t,exiting:t,exited:d};return e?s.default.createElement(m,{className:(0,c.tremorTwMerge)(p("icon"),"animate-spin shrink-0",i,u.default,u[l]),style:{transition:"width 150ms"}}):s.default.createElement(a,{className:(0,c.tremorTwMerge)(p("icon"),"shrink-0",t,i)})},x=s.default.forwardRef((e,a)=>{let{icon:m,iconPosition:u=n.HorizontalPositions.Left,size:x=n.Sizes.SM,color:b,variant:v="primary",disabled:w,loading:N=!1,loadingText:y,children:C,tooltip:k,className:j}=e,T=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),M=N||w,S=void 0!==m||N,E=N&&y,_=!(!C&&!E),R=(0,c.tremorTwMerge)(g[x].height,g[x].width),B="light"!==v?(0,c.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",P=h(v,b),O=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[x],{tooltipProps:z,getReferenceProps:L}=(0,r.useTooltip)(300),[I,H]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:a,timeout:n,initialEntered:c,mountOnEnter:d,unmountOnExit:m,onStateChange:u}={})=>{let[g,h]=(0,s.useState)(()=>o(c?2:l(d))),p=(0,s.useRef)(g),f=(0,s.useRef)(0),[x,b]="object"==typeof n?[n.enter,n.exit]:[n,n],v=(0,s.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return l(t)}})(p.current._s,m);e&&i(e,h,p,f,u)},[u,m]);return[g,(0,s.useCallback)(s=>{let o=e=>{switch(i(e,h,p,f,u),e){case 1:x>=0&&(f.current=((...e)=>setTimeout(...e))(v,x));break;case 4:b>=0&&(f.current=((...e)=>setTimeout(...e))(v,b));break;case 0:case 3:f.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||o(e+1)},0)}},n=p.current.isEnter;"boolean"!=typeof s&&(s=!n),s?n||o(e?+!r:2):n&&o(t?a?3:4:l(m))},[v,u,e,t,r,a,x,b,m]),v]})({timeout:50});return(0,s.useEffect)(()=>{H(N)},[N]),s.default.createElement("button",Object.assign({ref:(0,d.mergeRefs)([a,z.refs.setReference]),className:(0,c.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",B,O.paddingX,O.paddingY,O.fontSize,P.textColor,P.bgColor,P.borderColor,P.hoverBorderColor,M?"opacity-50 cursor-not-allowed":(0,c.tremorTwMerge)(h(v,b).hoverTextColor,h(v,b).hoverBgColor,h(v,b).hoverBorderColor),j),disabled:M},L,T),s.default.createElement(r.default,Object.assign({text:k},z)),S&&u!==n.HorizontalPositions.Right?s.default.createElement(f,{loading:N,iconSize:R,iconPosition:u,Icon:m,transitionStatus:I.status,needMargin:_}):null,E||C?s.default.createElement("span",{className:(0,c.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},E?y:C):null,S&&u===n.HorizontalPositions.Right?s.default.createElement(f,{loading:N,iconSize:R,iconPosition:u,Icon:m,transitionStatus:I.status,needMargin:_}):null)});x.displayName="Button",e.s(["Button",0,x],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),s=e.i(480731),a=e.i(95779),o=e.i(444755),l=e.i(673706);let i=(0,l.makeClassName)("Card"),n=r.default.forwardRef((e,n)=>{let{decoration:c="",decorationColor:d,children:m,className:u}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:n,className:(0,o.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",d?(0,l.getColorClassNames)(d,a.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case s.HorizontalPositions.Left:return"border-l-4";case s.VerticalPositions.Top:return"border-t-4";case s.HorizontalPositions.Right:return"border-r-4";case s.VerticalPositions.Bottom:return"border-b-4";default:return""}})(c),u)},g),m)});n.displayName="Card",e.s(["Card",0,n],304967)},954616,e=>{"use strict";var t=e.i(271645),r=e.i(114272),s=e.i(540143),a=e.i(915823),o=e.i(619273),l=class extends a.Subscribable{#e;#t=void 0;#r;#s;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.hashKey)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#a(),this.#o(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#a(),this.#o()}mutate(e,t){return this.#s=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#a(){let e=this.#r?.state??(0,r.getDefaultState)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#o(e){s.notifyManager.batch(()=>{if(this.#s&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#s.onSuccess?.(e.data,t,r,s)}catch(e){Promise.reject(e)}try{this.#s.onSettled?.(e.data,null,t,r,s)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#s.onError?.(e.error,t,r,s)}catch(e){Promise.reject(e)}try{this.#s.onSettled?.(void 0,e.error,t,r,s)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},i=e.i(912598);e.s(["useMutation",0,function(e,r){let a=(0,i.useQueryClient)(r),[n]=t.useState(()=>new l(a,e));t.useEffect(()=>{n.setOptions(e)},[n,e]);let c=t.useSyncExternalStore(t.useCallback(e=>n.subscribe(s.notifyManager.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),d=t.useCallback((e,t)=>{n.mutate(e,t).catch(o.noop)},[n]);if(c.error&&(0,o.shouldThrowError)(n.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:d,mutateAsync:c.mutate}}],954616)},646563,e=>{"use strict";var t=e.i(959013);e.s(["PlusOutlined",()=>t.default])},597440,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"};var a=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(a.default,(0,t.default)({},e,{ref:o,icon:s}))});e.s(["default",0,o],597440)},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])},891547,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(602869);e.s(["default",0,({onChange:e,value:o,className:l,accessToken:i,disabled:n})=>{let[c,d]=(0,r.useState)([]),[m,u]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(i){u(!0);try{let e=await (0,a.getGuardrailsList)(i);e.guardrails&&d(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{u(!1)}}})()},[i]),(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",disabled:n,placeholder:n?"Setting guardrails is a premium feature.":"Select guardrails",onChange:t=>{e(t)},value:o,loading:m,className:l,allowClear:!0,options:c.map(e=>({label:`${e.guardrail_name}`,value:e.guardrail_name})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})}])},921511,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(199133),a=e.i(602869);function o(e){return e.filter(e=>(e.version_status??"draft")!=="draft").map(e=>{var t;let r=e.version_number??1,s=e.version_status??"draft";return{label:`${e.policy_name} — v${r} (${s})${e.description?` — ${e.description}`:""}`,value:"production"===s?e.policy_name:e.policy_id?(t=e.policy_id,`policy_${t}`):e.policy_name}})}e.s(["default",0,({onChange:e,value:l,className:i,accessToken:n,disabled:c,onPoliciesLoaded:d})=>{let[m,u]=(0,r.useState)([]),[g,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(n){h(!0);try{let e=await (0,a.getPoliciesList)(n);e.policies&&(u(e.policies),d?.(e.policies))}catch(e){console.error("Error fetching policies:",e)}finally{h(!1)}}})()},[n,d]),(0,t.jsx)("div",{children:(0,t.jsx)(s.Select,{mode:"multiple",disabled:c,placeholder:c?"Setting policies is a premium feature.":"Select policies (production or published versions)",onChange:t=>{e(t)},value:l,loading:g,className:i,allowClear:!0,options:o(m),optionFilterProp:"label",showSearch:!0,style:{width:"100%"}})})},"getPolicyOptionEntries",0,o])},384767,e=>{"use strict";var t=e.i(843476),r=e.i(599724),s=e.i(271645),a=e.i(389083);let o=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});var l=e.i(602869);let i=function({vectorStores:e,accessToken:i}){let[n,c]=(0,s.useState)([]);return(0,s.useEffect)(()=>{(async()=>{if(i&&0!==e.length)try{let e=await (0,l.vectorStoreListCall)(i);e.data&&c(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[i,e.length]),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,t.jsx)(a.Badge,{color:"blue",size:"xs",children:e.length})]}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,r)=>{let s;return(0,t.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:(s=n.find(t=>t.vector_store_id===e))?`${s.vector_store_name||s.vector_store_id} (${s.vector_store_id})`:e},r)})}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(o,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},n=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});var c=e.i(871943),d=e.i(502547),m=e.i(592968),u=e.i(234713);let g=function({mcpServers:e,mcpAccessGroups:o=[],mcpToolPermissions:i={},mcpToolsets:g=[],accessToken:h}){let[p,f]=(0,s.useState)([]),[x,b]=(0,s.useState)([]),[v,w]=(0,s.useState)(new Set),[N,y]=(0,s.useState)(new Set);(0,s.useEffect)(()=>{(async()=>{if(h&&e.length>0)try{let e=await (0,l.fetchMCPServers)(h);e&&Array.isArray(e)?f(e):e.data&&Array.isArray(e.data)&&f(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[h,e.length]),(0,s.useEffect)(()=>{(async()=>{if(h&&g.length>0)try{let e=await (0,l.fetchMCPToolsets)(h),t=Array.isArray(e)?e.filter(e=>g.includes(e.toolset_id)):[];b(t)}catch(e){console.error("Error fetching toolsets:",e)}})()},[h,g.length]);let C=e.includes(u.NO_MCP_SERVERS_SENTINEL),k=e.includes(u.ALL_PROXY_MCP_SERVERS_SENTINEL),j=[...e.filter(e=>e!==u.NO_MCP_SERVERS_SENTINEL&&e!==u.ALL_PROXY_MCP_SERVERS_SENTINEL).map(e=>({type:"server",value:e})),...o.map(e=>({type:"accessGroup",value:e}))],T=j.length+g.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-blue-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,t.jsx)(a.Badge,{color:C?"red":"blue",size:"xs",children:C?"Blocked":k?"All":T})]}),C?(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-red-50 border border-red-200",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-red-400"}),(0,t.jsx)(r.Text,{className:"text-red-700 text-sm",children:"No MCP servers — this key is blocked from all MCP servers, including its team's servers"})]}):k?(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-50 border border-blue-200",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-blue-400"}),(0,t.jsx)(r.Text,{className:"text-blue-700 text-sm",children:"All Proxy MCP Servers"})]}):T>0?(0,t.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:[j.map((e,r)=>{let s="server"===e.type?i[e.value]:void 0,a=s&&s.length>0,o=v.has(e.value);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>{var t;return a&&(t=e.value,void w(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}))},className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ${a?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=p.find(t=>t.server_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.alias} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded-sm uppercase tracking-wide shrink-0",children:"Group"})]})}),a&&(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),o?(0,t.jsx)(c.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(d.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),a&&o&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,r)=>(0,t.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},r))})})]},r)}),g.length>0&&g.map((e,r)=>{let s=x.find(t=>t.toolset_id===e),a=N.has(e),o=s?.tools.length??0;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{onClick:()=>o>0&&void y(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r}),className:`flex items-center gap-3 py-2 px-3 rounded-lg border border-purple-200 transition-all ${o>0?"cursor-pointer hover:bg-purple-50 hover:border-purple-300":"bg-white"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:s?.toolset_name??e}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-purple-600 bg-purple-50 border border-purple-200 rounded-sm uppercase tracking-wide shrink-0",children:"Toolset"})]}),o>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-gray-600",children:o}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:1===o?"tool":"tools"}),a?(0,t.jsx)(c.ChevronDownIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,t.jsx)(d.ChevronRightIcon,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),o>0&&a&&s&&(0,t.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-purple-200 pb-1",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.tools.map((e,r)=>(0,t.jsxs)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-purple-50 border border-purple-200 text-purple-800 text-xs font-medium",children:[(0,t.jsxs)("span",{className:"text-purple-400 mr-1 text-[10px]",children:[e.server_id.slice(0,6),"…"]}),e.tool_name]},r))})})]},`toolset-${r}`)})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(n,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No MCP servers, access groups, or toolsets configured"})]})]})},h=s.forwardRef(function(e,t){return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))}),p=function({agents:e,agentAccessGroups:o=[],accessToken:i}){let[n,c]=(0,s.useState)([]);(0,s.useEffect)(()=>{(async()=>{if(i&&e.length>0)try{let e=await (0,l.getAgentsList)(i);e&&e.agents&&Array.isArray(e.agents)&&c(e.agents)}catch(e){console.error("Error fetching agents:",e)}})()},[i,e.length]);let d=[...e.map(e=>({type:"agent",value:e})),...o.map(e=>({type:"accessGroup",value:e}))],u=d.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h,{className:"h-4 w-4 text-purple-600"}),(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Agents"}),(0,t.jsx)(a.Badge,{color:"purple",size:"xs",children:u})]}),u>0?(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:d.map((e,r)=>(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 bg-white",children:(0,t.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"agent"===e.type?(0,t.jsx)(m.Tooltip,{title:`Full ID: ${e.value}`,placement:"top",children:(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-purple-500 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:(e=>{let t=n.find(t=>t.agent_id===e);if(t){let r=e.length>7?`${e.slice(0,3)}...${e.slice(-4)}`:e;return`${t.agent_name} (${r})`}return e})(e.value)})]})}):(0,t.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,t.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:e.value}),(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded-sm uppercase tracking-wide shrink-0",children:"Group"})]})})})},r))}):(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,t.jsx)(h,{className:"h-4 w-4 text-gray-400"}),(0,t.jsx)(r.Text,{className:"text-gray-500 text-sm",children:"No agents or access groups configured"})]})]})};e.s(["default",0,function({objectPermission:e,variant:s="card",className:a="",accessToken:o}){let l=e?.vector_stores||[],n=e?.mcp_servers||[],c=e?.mcp_access_groups||[],d=e?.mcp_tool_permissions||{},m=e?.mcp_toolsets||[],u=e?.agents||[],h=e?.agent_access_groups||[],f=e?.search_tools||[],x=(0,t.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:[(0,t.jsx)(i,{vectorStores:l,accessToken:o}),(0,t.jsx)(g,{mcpServers:n,mcpAccessGroups:c,mcpToolPermissions:d,mcpToolsets:m,accessToken:o}),(0,t.jsx)(p,{agents:u,agentAccessGroups:h,accessToken:o}),(0,t.jsxs)("div",{className:"rounded-md border border-gray-100 p-4",children:[(0,t.jsx)(r.Text,{className:"text-sm font-medium text-gray-800",children:"Search tools"}),0===f.length?(0,t.jsx)(r.Text,{className:"mt-1 block text-xs text-gray-500",children:"No restriction — all configured search tools are allowed for this team."}):(0,t.jsx)(r.Text,{className:"mt-1 block text-xs text-gray-700",children:f.join(", ")})]})]});return"card"===s?(0,t.jsxs)("div",{className:`bg-white border border-gray-200 rounded-lg p-6 ${a}`,children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.Text,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,t.jsx)(r.Text,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),x]}):(0,t.jsxs)("div",{className:`${a}`,children:[(0,t.jsx)(r.Text,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),x]})}],384767)},530212,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.s(["ArrowLeftIcon",0,r],530212)},350967,46757,e=>{"use strict";var t=e.i(290571),r=e.i(444755),s=e.i(673706),a=e.i(271645);let o={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"},l={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"},i={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"},n={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"};e.s(["colSpan",0,{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"},"colSpanLg",0,{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"},"colSpanMd",0,{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"},"colSpanSm",0,{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"},"gridCols",0,o,"gridColsLg",0,n,"gridColsMd",0,i,"gridColsSm",0,l],46757);let c=(0,s.makeClassName)("Grid"),d=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",m=a.default.forwardRef((e,s)=>{let{numItems:m=1,numItemsSm:u,numItemsMd:g,numItemsLg:h,children:p,className:f}=e,x=(0,t.__rest)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),b=d(m,o),v=d(u,l),w=d(g,i),N=d(h,n),y=(0,r.tremorTwMerge)(b,v,w,N);return a.default.createElement("div",Object.assign({ref:s,className:(0,r.tremorTwMerge)(c("root"),"grid",y,f)},x),p)});m.displayName="Grid",e.s(["Grid",0,m],350967)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},555987,e=>{"use strict";var t=e.i(221688),r=e.i(950643);let s=/^(https?:|data:|blob:|\/\/)/i;e.s(["resolveLogoSrc",0,(e,a=t.serverRootPath)=>{if(e){let t;return s.test(e)?e:(t=(0,r.normalizeRootPath)(a),`${t}${e.startsWith("/")?e:`/${e}`}`)}}])},962944,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"};var a=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(a.default,(0,t.default)({},e,{ref:o,icon:s}))});e.s(["ThunderboltOutlined",0,o],962944)},72713,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"};var a=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(a.default,(0,t.default)({},e,{ref:o,icon:s}))});e.s(["CalendarOutlined",0,o],72713)},595727,234662,677241,281092,688594,e=>{"use strict";let t=Symbol.for("constructDateFrom");function r(e,r){return"function"==typeof e?e(r):e&&"object"==typeof e&&t in e?e[t](r):e instanceof Date?new e.constructor(r):new Date(r)}function s(e,t){return r(t||e,e)}e.s(["constructFromSymbol",0,t,"millisecondsInDay",0,864e5,"millisecondsInHour",0,36e5,"millisecondsInMinute",0,6e4,"millisecondsInSecond",0,1e3,"millisecondsInWeek",0,6048e5],234662),e.s(["constructFrom",0,r],677241),e.s(["toDate",0,s],281092),e.s(["addDays",0,function(e,t,a){let o=s(e,a?.in);return isNaN(t)?r(a?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}],595727),e.s(["addMonths",0,function(e,t,a){let o=s(e,a?.in);if(isNaN(t))return r(a?.in||e,NaN);if(!t)return o;let l=o.getDate(),i=r(a?.in||e,o.getTime());return(i.setMonth(o.getMonth()+t+1,0),l>=i.getDate())?i:(o.setFullYear(i.getFullYear(),i.getMonth(),l),o)}],688594)},24529,e=>{"use strict";var t=e.i(595727),r=e.i(688594),s=e.i(677241),a=e.i(281092);function o(e,o,l){let{years:i=0,months:n=0,weeks:c=0,days:d=0,hours:m=0,minutes:u=0,seconds:g=0}=o,h=(0,a.toDate)(e,l?.in),p=n||i?(0,r.addMonths)(h,n+12*i):h,f=d||c?(0,t.addDays)(p,d+7*c):p;return(0,s.constructFrom)(l?.in||e,+f+1e3*(g+60*(u+60*m)))}let l=/[zZ]$|[+-]\d{2}:?\d{2}$/;function i(e){return Date.parse(l.test(e)?e:`${e}Z`)}e.s(["calculateExpiryPreviewFromDuration",0,function(e){if(!e)return null;try{let t,r=parseInt(e);if(Number.isNaN(r))throw Error("Invalid duration format");let s=new Date;if(e.endsWith("mo"))t=o(s,{months:r});else if(e.endsWith("s"))t=o(s,{seconds:r});else if(e.endsWith("m"))t=o(s,{minutes:r});else if(e.endsWith("h"))t=o(s,{hours:r});else if(e.endsWith("d"))t=o(s,{days:r});else if(e.endsWith("w"))t=o(s,{weeks:r});else throw Error("Invalid duration format");return t.toLocaleString()}catch{return null}},"formatExpiresUtc",0,function(e){let t=i(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()},"isKeyExpired",0,function(e){if(!e)return!1;let t=i(e);return!Number.isNaN(t)&&t